mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-27 06:08:36 +00:00
feat: maintenance log (#170)
* remove repo for document tokens * remove schema for doc tokens * fix id template and generate cmd * schema updates * code gen * bump dependencies * fix broken migrations + add maintenance entry type * spelling * remove debug logger * implement repository layer * routes * API client * wip: maintenance log * remove depreciated call
This commit is contained in:
parent
d6da63187b
commit
5bbb969763
79 changed files with 6320 additions and 4957 deletions
48
backend/internal/data/ent/schema/maintenance_entry.go
Normal file
48
backend/internal/data/ent/schema/maintenance_entry.go
Normal file
|
@ -0,0 +1,48 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"github.com/google/uuid"
|
||||
"github.com/hay-kot/homebox/backend/internal/data/ent/schema/mixins"
|
||||
)
|
||||
|
||||
type MaintenanceEntry struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (MaintenanceEntry) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
mixins.BaseMixin{},
|
||||
}
|
||||
}
|
||||
|
||||
func (MaintenanceEntry) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.UUID("item_id", uuid.UUID{}),
|
||||
field.Time("date").
|
||||
Default(time.Now),
|
||||
field.String("name").
|
||||
MaxLen(255).
|
||||
NotEmpty(),
|
||||
field.String("description").
|
||||
MaxLen(2500).
|
||||
Optional(),
|
||||
field.Float("cost").
|
||||
Default(0.0),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the ItemField.
|
||||
func (MaintenanceEntry) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("item", Item.Type).
|
||||
Field("item_id").
|
||||
Ref("maintenance_entries").
|
||||
Required().
|
||||
Unique(),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue