[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
41
backend/ent/schema/contributor.go
Normal file
41
backend/ent/schema/contributor.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Contributor holds the schema definition for the Contributor entity.
|
||||
type Contributor struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Contributor.
|
||||
func (Contributor) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("name").
|
||||
NotEmpty(),
|
||||
field.String("avatar_url").
|
||||
Optional(),
|
||||
field.Text("bio").
|
||||
Optional(),
|
||||
field.Time("created_at").
|
||||
Default(time.Now),
|
||||
field.Time("updated_at").
|
||||
Default(time.Now).
|
||||
UpdateDefault(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Contributor.
|
||||
func (Contributor) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("user", User.Type).
|
||||
Ref("contributors").
|
||||
Unique(),
|
||||
edge.To("social_links", ContributorSocialLink.Type),
|
||||
edge.To("posts", PostContributor.Type),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue