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

@ -9,13 +9,13 @@ import (
"github.com/hay-kot/homebox/backend/internal/data/ent/attachment"
"github.com/hay-kot/homebox/backend/internal/data/ent/authtokens"
"github.com/hay-kot/homebox/backend/internal/data/ent/document"
"github.com/hay-kot/homebox/backend/internal/data/ent/documenttoken"
"github.com/hay-kot/homebox/backend/internal/data/ent/group"
"github.com/hay-kot/homebox/backend/internal/data/ent/groupinvitationtoken"
"github.com/hay-kot/homebox/backend/internal/data/ent/item"
"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"
"github.com/hay-kot/homebox/backend/internal/data/ent/schema"
"github.com/hay-kot/homebox/backend/internal/data/ent/user"
)
@ -123,37 +123,6 @@ func init() {
documentDescID := documentMixinFields0[0].Descriptor()
// document.DefaultID holds the default value on creation for the id field.
document.DefaultID = documentDescID.Default.(func() uuid.UUID)
documenttokenMixin := schema.DocumentToken{}.Mixin()
documenttokenMixinFields0 := documenttokenMixin[0].Fields()
_ = documenttokenMixinFields0
documenttokenFields := schema.DocumentToken{}.Fields()
_ = documenttokenFields
// documenttokenDescCreatedAt is the schema descriptor for created_at field.
documenttokenDescCreatedAt := documenttokenMixinFields0[1].Descriptor()
// documenttoken.DefaultCreatedAt holds the default value on creation for the created_at field.
documenttoken.DefaultCreatedAt = documenttokenDescCreatedAt.Default.(func() time.Time)
// documenttokenDescUpdatedAt is the schema descriptor for updated_at field.
documenttokenDescUpdatedAt := documenttokenMixinFields0[2].Descriptor()
// documenttoken.DefaultUpdatedAt holds the default value on creation for the updated_at field.
documenttoken.DefaultUpdatedAt = documenttokenDescUpdatedAt.Default.(func() time.Time)
// documenttoken.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
documenttoken.UpdateDefaultUpdatedAt = documenttokenDescUpdatedAt.UpdateDefault.(func() time.Time)
// documenttokenDescToken is the schema descriptor for token field.
documenttokenDescToken := documenttokenFields[0].Descriptor()
// documenttoken.TokenValidator is a validator for the "token" field. It is called by the builders before save.
documenttoken.TokenValidator = documenttokenDescToken.Validators[0].(func([]byte) error)
// documenttokenDescUses is the schema descriptor for uses field.
documenttokenDescUses := documenttokenFields[1].Descriptor()
// documenttoken.DefaultUses holds the default value on creation for the uses field.
documenttoken.DefaultUses = documenttokenDescUses.Default.(int)
// documenttokenDescExpiresAt is the schema descriptor for expires_at field.
documenttokenDescExpiresAt := documenttokenFields[2].Descriptor()
// documenttoken.DefaultExpiresAt holds the default value on creation for the expires_at field.
documenttoken.DefaultExpiresAt = documenttokenDescExpiresAt.Default.(func() time.Time)
// documenttokenDescID is the schema descriptor for id field.
documenttokenDescID := documenttokenMixinFields0[0].Descriptor()
// documenttoken.DefaultID holds the default value on creation for the id field.
documenttoken.DefaultID = documenttokenDescID.Default.(func() uuid.UUID)
groupMixin := schema.Group{}.Mixin()
groupMixinFields0 := groupMixin[0].Fields()
_ = groupMixinFields0
@ -462,6 +431,55 @@ func init() {
locationDescID := locationMixinFields0[0].Descriptor()
// location.DefaultID holds the default value on creation for the id field.
location.DefaultID = locationDescID.Default.(func() uuid.UUID)
maintenanceentryMixin := schema.MaintenanceEntry{}.Mixin()
maintenanceentryMixinFields0 := maintenanceentryMixin[0].Fields()
_ = maintenanceentryMixinFields0
maintenanceentryFields := schema.MaintenanceEntry{}.Fields()
_ = maintenanceentryFields
// maintenanceentryDescCreatedAt is the schema descriptor for created_at field.
maintenanceentryDescCreatedAt := maintenanceentryMixinFields0[1].Descriptor()
// maintenanceentry.DefaultCreatedAt holds the default value on creation for the created_at field.
maintenanceentry.DefaultCreatedAt = maintenanceentryDescCreatedAt.Default.(func() time.Time)
// maintenanceentryDescUpdatedAt is the schema descriptor for updated_at field.
maintenanceentryDescUpdatedAt := maintenanceentryMixinFields0[2].Descriptor()
// maintenanceentry.DefaultUpdatedAt holds the default value on creation for the updated_at field.
maintenanceentry.DefaultUpdatedAt = maintenanceentryDescUpdatedAt.Default.(func() time.Time)
// maintenanceentry.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
maintenanceentry.UpdateDefaultUpdatedAt = maintenanceentryDescUpdatedAt.UpdateDefault.(func() time.Time)
// maintenanceentryDescDate is the schema descriptor for date field.
maintenanceentryDescDate := maintenanceentryFields[1].Descriptor()
// maintenanceentry.DefaultDate holds the default value on creation for the date field.
maintenanceentry.DefaultDate = maintenanceentryDescDate.Default.(func() time.Time)
// maintenanceentryDescName is the schema descriptor for name field.
maintenanceentryDescName := maintenanceentryFields[2].Descriptor()
// maintenanceentry.NameValidator is a validator for the "name" field. It is called by the builders before save.
maintenanceentry.NameValidator = func() func(string) error {
validators := maintenanceentryDescName.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(name string) error {
for _, fn := range fns {
if err := fn(name); err != nil {
return err
}
}
return nil
}
}()
// maintenanceentryDescDescription is the schema descriptor for description field.
maintenanceentryDescDescription := maintenanceentryFields[3].Descriptor()
// maintenanceentry.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
maintenanceentry.DescriptionValidator = maintenanceentryDescDescription.Validators[0].(func(string) error)
// maintenanceentryDescCost is the schema descriptor for cost field.
maintenanceentryDescCost := maintenanceentryFields[4].Descriptor()
// maintenanceentry.DefaultCost holds the default value on creation for the cost field.
maintenanceentry.DefaultCost = maintenanceentryDescCost.Default.(float64)
// maintenanceentryDescID is the schema descriptor for id field.
maintenanceentryDescID := maintenanceentryMixinFields0[0].Descriptor()
// maintenanceentry.DefaultID holds the default value on creation for the id field.
maintenanceentry.DefaultID = maintenanceentryDescID.Default.(func() uuid.UUID)
userMixin := schema.User{}.Mixin()
userMixinFields0 := userMixin[0].Fields()
_ = userMixinFields0