This commit is contained in:
2023-12-01 23:02:33 +01:00
commit 7634b181de
48 changed files with 8610 additions and 0 deletions

29
ent/schema/logentry.go Normal file
View File

@ -0,0 +1,29 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"time"
)
// Logentry holds the schema definition for the Logentry entity.
type Logentry struct {
ent.Schema
}
// Fields of the Logentry.
func (Logentry) Fields() []ent.Field {
return []ent.Field{
field.Int("id"),
field.Time("date").Default(time.Now).Immutable(),
field.Text("content"),
}
}
// Edges of the Logentry.
func (Logentry) Edges() []ent.Edge {
return []ent.Edge{
edge.From("project", Project.Type).Ref("logentries").Unique(),
}
}

35
ent/schema/project.go Normal file
View File

@ -0,0 +1,35 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"time"
)
// Project holds the schema definition for the Project entity.
type Project struct {
ent.Schema
}
// Fields of the Project.
func (Project) Fields() []ent.Field {
return []ent.Field{
field.Int("id"),
field.Time("create_time").Default(time.Now).Immutable(),
field.String("user"),
field.String("group"),
field.String("root_path"),
field.String("service_name"),
field.String("binary_path"),
field.Bool("move_to_target").Default(false),
field.String("binary_target_path").Optional(),
}
}
// Edges of the Project.
func (Project) Edges() []ent.Edge {
return []ent.Edge{
edge.To("logentries", Logentry.Type),
}
}