feat: new entity

This commit is contained in:
2025-03-09 21:16:00 +07:00
parent 2e577171f3
commit bd4be08c37

View File

@@ -1,7 +1,12 @@
package models
var Entities = []any{
&Post{}, &Author{},
&Post{}, &Author{}, &PostType{},
}
type PostType struct {
Id uint `gorm:"primaryKey" ui:"hidden"`
Name string `ui:"label:Название;"`
}
type Post struct {
@@ -11,6 +16,8 @@ type Post struct {
CreatedAt int64 `gorm:"autoCreateTime" ui:"readonly;datatype:datetime;"`
AuthorId uint `ui:"hidden" gorm:"foreignKey:Id;references:AuthorId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Author Author `ui:"label:Автор; field:Name;"`
TypeId uint `ui:"hidden"`
PostType PostType `ui:"label:Тип; field:Name;" gorm:"foreignKey:Id;references:TypeId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}
type Author struct {