api-platform/internal/entity/Api.go
2024-11-24 01:28:44 +08:00

37 lines
1.1 KiB
Go

package entity
import (
"gorm.io/gorm"
"leafdev.top/Leaf/api-platform/internal/schema"
"time"
)
type Api struct {
Model
Name string `json:"name"`
Description string `json:"description"`
BackendUrl string `json:"backend_url"`
AuthToken string `json:"auth_token"`
OwnershipVerifiedAt *time.Time `json:"ownership_verified_at"`
OwnershipVerificationToken string `json:"ownership_verification_token"`
UserId schema.UserId `json:"user_id"`
Status string `json:"status"`
DeletedAt gorm.DeletedAt `json:"deleted_at"`
}
func (u *Api) TableName() string {
return "apis"
}
type ApiDocument struct {
Model
ApiId schema.EntityId `json:"api_id"`
Api *Api `json:"api"`
OpenAPIUrl string `json:"openapi_url" gorm:"column:openapi_url"`
Content string `json:"content"`
}
func (u *ApiDocument) TableName() string {
return "api_documents"
}