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:
Hayden 2022-12-09 20:57:57 -09:00 committed by GitHub
parent d6da63187b
commit 5bbb969763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 6320 additions and 4957 deletions

View file

@ -17,6 +17,7 @@ import (
"github.com/hay-kot/homebox/backend/internal/data/ent/itemfield"
"github.com/hay-kot/homebox/backend/internal/data/ent/label"
"github.com/hay-kot/homebox/backend/internal/data/ent/location"
"github.com/hay-kot/homebox/backend/internal/data/ent/maintenanceentry"
)
// ItemCreate is the builder for creating a Item entity.
@ -448,6 +449,21 @@ func (ic *ItemCreate) AddFields(i ...*ItemField) *ItemCreate {
return ic.AddFieldIDs(ids...)
}
// AddMaintenanceEntryIDs adds the "maintenance_entries" edge to the MaintenanceEntry entity by IDs.
func (ic *ItemCreate) AddMaintenanceEntryIDs(ids ...uuid.UUID) *ItemCreate {
ic.mutation.AddMaintenanceEntryIDs(ids...)
return ic
}
// AddMaintenanceEntries adds the "maintenance_entries" edges to the MaintenanceEntry entity.
func (ic *ItemCreate) AddMaintenanceEntries(m ...*MaintenanceEntry) *ItemCreate {
ids := make([]uuid.UUID, len(m))
for i := range m {
ids[i] = m[i].ID
}
return ic.AddMaintenanceEntryIDs(ids...)
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
func (ic *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate {
ic.mutation.AddAttachmentIDs(ids...)
@ -907,6 +923,25 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := ic.mutation.MaintenanceEntriesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: item.MaintenanceEntriesTable,
Columns: []string{item.MaintenanceEntriesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: maintenanceentry.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := ic.mutation.AttachmentsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,