Files
Control-plane/internal/org/models.go
T
Mephimeow 2da484d781
ci / build (push) Successful in 2m58s
ci / build (pull_request) Successful in 2m47s
refactor: migrate from raw pgx to GORM, unify ErrNoRows, cleanup auth
2026-06-14 16:41:33 +00:00

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"`
}