refactor: migrate from raw pgx to GORM, unify ErrNoRows, cleanup auth
This commit is contained in:
@@ -3,16 +3,16 @@ package org
|
||||
import "time"
|
||||
|
||||
type Organization struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID string `gorm:"type:uuid;primaryKey" json:"id"`
|
||||
Name string `gorm:"type:text;not null" json:"name"`
|
||||
Slug string `gorm:"type:text;not null;uniqueIndex" json:"slug"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
||||
}
|
||||
|
||||
type CreateOrgRequest struct {
|
||||
Name string `json:"name" binding:"required,min=2,max=100" example:"My Corp"`
|
||||
Slug string `json:"slug" binding:"required,min=2,max=50" example:"my-corp"`
|
||||
Slug string `json:"slug" binding:"required,min=2,max=50" example:"my-corp"`
|
||||
}
|
||||
|
||||
type UpdateOrgRequest struct {
|
||||
@@ -26,6 +26,8 @@ type OrgResponse struct {
|
||||
type OrgListResponse struct {
|
||||
Organizations []Organization `json:"organizations"`
|
||||
Total int `json:"total"`
|
||||
Limit int `json:"limit"`
|
||||
Offset int `json:"offset"`
|
||||
}
|
||||
|
||||
type ErrorResponse struct {
|
||||
|
||||
Reference in New Issue
Block a user