[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
47
backend/ent/schema/media.go
Normal file
47
backend/ent/schema/media.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Media holds the schema definition for the Media entity.
|
||||
type Media struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Media.
|
||||
func (Media) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("storage_id").
|
||||
NotEmpty().
|
||||
Unique(),
|
||||
field.String("original_name").
|
||||
NotEmpty(),
|
||||
field.String("mime_type").
|
||||
NotEmpty(),
|
||||
field.Int64("size").
|
||||
Positive(),
|
||||
field.String("url").
|
||||
NotEmpty(),
|
||||
field.Time("created_at").
|
||||
Default(time.Now).
|
||||
Immutable(),
|
||||
field.Time("updated_at").
|
||||
Default(time.Now).
|
||||
UpdateDefault(time.Now),
|
||||
field.String("created_by").
|
||||
Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Media.
|
||||
func (Media) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("owner", User.Type).
|
||||
Ref("media").
|
||||
Unique(),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue