Other changes include: * Also removing httprouter mux in favour of gorilla for being more mature and having more integrations and resources available for debugging. * Adding http middlewares for logging req processing time and handling authentication. TODO: Need to add context in the middleware as well. Will be useful for logging and debugging.
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type (
|
|
// TODO: Embed BaseModel into all the other components. The problem is the map -> struct
|
|
// in utils.ConvertMapToStruct fxn
|
|
|
|
BaseModel struct {
|
|
ID int64 `json:"id,omitempty" sql:"id"`
|
|
CreatedAt time.Time `json:"created_at,omitempty" sql:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at,omitempty" sql:"updated_at"`
|
|
}
|
|
|
|
Component struct {
|
|
ID int64 `json:"id,omitempty" sql:"id"`
|
|
CreatedAt time.Time `json:"created_at,omitempty" sql:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at,omitempty" sql:"updated_at"`
|
|
|
|
Name string `json:"name,omitempty" sql:"name"`
|
|
ComponentType string `json:"component_type,omitempty" sql:"component_type"`
|
|
Plan string `json:"plan,omitempty" sql:"plan"`
|
|
}
|
|
|
|
Account struct {
|
|
ID int64 `json:"id,omitempty" sql:"id"`
|
|
CreatedAt time.Time `json:"created_at,omitempty" sql:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at,omitempty" sql:"updated_at"`
|
|
|
|
Name string `json:"name" sql:"name"`
|
|
}
|
|
|
|
Page struct {
|
|
ID int64 `json:"id,omitempty" sql:"id"`
|
|
CreatedAt time.Time `json:"created_at,omitempty" sql:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at,omitempty" sql:"updated_at"`
|
|
}
|
|
)
|