/
accounts.go
49 lines (43 loc) · 1.02 KB
/
accounts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Package classification of Account API
//
// Documentation for Account API
//
// Schemes: http
// BasePath: /
// Version: 1.0.0
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
// swagger:meta
package handlers
import (
"log"
"github.com/florianwoelki/insta-clone/internal"
"gorm.io/gorm"
)
// A single account response
// swagger:response accountResponse
type accountResponse struct {
// The id of the account that will be returned
// in: path
// required: true
ID uint `json:"id"`
// Returned account in the system
// in: body
Body []internal.Account
}
// KeyAccount for serialization/deserialization
type KeyAccount struct{}
// Accounts handler for getting, creating and updating accounts
type Accounts struct {
logger *log.Logger
db *gorm.DB
validator *internal.Validation
}
// NewAccounts returns a new accounts handler with the given logger
func NewAccounts(logger *log.Logger, db *gorm.DB, validator *internal.Validation) *Accounts {
return &Accounts{logger, db, validator}
}