Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidPassword ¶
Types ¶
type AdminRegisterParams ¶
type CreatePostParams ¶
type CreateUserParams ¶
type CreateUserParams struct {
Username string `json:"username"`
Email string `json:"email"`
Password string `json:"password"`
}
func (*CreateUserParams) Validate ¶
func (p *CreateUserParams) Validate() map[string]string
type Post ¶
type Post struct {
ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primarykey" json:"Id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Content string `json:"content"`
Author uuid.UUID `json:"author"`
}
func CreatePostFromParams ¶
func CreatePostFromParams(params CreatePostParams) *Post
type PostResponse ¶
type ResponseUser ¶
type ResponseUser struct {
ID uuid.UUID `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Post []Post `json:"posts"`
}
func UsersToUserResponses ¶
func UsersToUserResponses(users []*User) []ResponseUser
type SubscriberResponse ¶
func UserToSubscriberResponse ¶
func UserToSubscriberResponse(user []*User) []SubscriberResponse
type Subscription ¶
type SubscriptionResponse ¶
type SubscriptionResponse struct {
Username string `json:"username"`
}
type UpdateUsernameParams ¶
type UpdateUsernameParams struct {
Username string `json:"username"`
}
type User ¶
type User struct {
ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primarykey" json:"Id"`
CreatedAt time.Time `gorm:"not null" json:"created_at"`
UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
Username string `gorm:"unique;size:100" json:"username"`
Password string `gorm:"size:100" json:"password"`
Email string `gorm:"unique;size:100" json:"email"`
Post []Post `gorm:"foreignKey:Author;constraint:OnDelete:CASCADE"`
IsAdmin bool `gorm:"default:false"`
Subscriber []Subscription `gorm:"foreignKey:SubscriberID;constraint:OnDelete:CASCADE"`
Target []Subscription `gorm:"foreignKey:TargetID;constraint:OnDelete:CASCADE"`
Profile Profile
}
func NewUserFromParams ¶
func NewUserFromParams(params CreateUserParams) (*User, error)
func (*User) ResponseUser ¶
func (u *User) ResponseUser() *ResponseUser
func (*User) SubcriberResponse ¶
func (u *User) SubcriberResponse() *SubscriberResponse
Click to show internal directories.
Click to hide internal directories.