36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package org
|
|
|
|
import "time"
|
|
|
|
type Organization struct {
|
|
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"`
|
|
}
|
|
|
|
type UpdateOrgRequest struct {
|
|
Name string `json:"name" binding:"required,min=2,max=100" example:"My Corp Updated"`
|
|
}
|
|
|
|
type OrgResponse struct {
|
|
Organization Organization `json:"organization"`
|
|
}
|
|
|
|
type OrgListResponse struct {
|
|
Organizations []Organization `json:"organizations"`
|
|
Total int `json:"total"`
|
|
Limit int `json:"limit"`
|
|
Offset int `json:"offset"`
|
|
}
|
|
|
|
type ErrorResponse struct {
|
|
Error string `json:"error"`
|
|
}
|