[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
50
backend/ent/schema/postcontributor.go
Normal file
50
backend/ent/schema/postcontributor.go
Normal file
|
@ -0,0 +1,50 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/index"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PostContributor holds the schema definition for the PostContributor entity.
|
||||
type PostContributor struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the PostContributor.
|
||||
func (PostContributor) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Enum("language_code").
|
||||
Values("en", "zh-Hans", "zh-Hant").
|
||||
Optional().
|
||||
Nillable(),
|
||||
field.Time("created_at").
|
||||
Default(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the PostContributor.
|
||||
func (PostContributor) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("post", Post.Type).
|
||||
Ref("contributors").
|
||||
Unique(),
|
||||
edge.From("contributor", Contributor.Type).
|
||||
Ref("posts").
|
||||
Unique(),
|
||||
edge.From("role", ContributorRole.Type).
|
||||
Ref("post_contributors").
|
||||
Unique(),
|
||||
}
|
||||
}
|
||||
|
||||
// Indexes of the PostContributor.
|
||||
func (PostContributor) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("language_code").
|
||||
Edges("post", "contributor", "role").
|
||||
Unique(),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue