mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-25 05:08:36 +00:00
refactor: remove empty services (#116)
* remove empty services * remove old factory * remove old static files * cleanup more duplicate service code * file/folder reorg
This commit is contained in:
parent
6529549289
commit
cd82fe0d89
179 changed files with 514 additions and 582 deletions
42
backend/internal/data/ent/schema/mixins/base.go
Normal file
42
backend/internal/data/ent/schema/mixins/base.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
package mixins
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/mixin"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type BaseMixin struct {
|
||||
mixin.Schema
|
||||
}
|
||||
|
||||
func (BaseMixin) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.UUID("id", uuid.UUID{}).
|
||||
Default(uuid.New),
|
||||
field.Time("created_at").
|
||||
Immutable().
|
||||
Default(time.Now),
|
||||
field.Time("updated_at").
|
||||
Default(time.Now).
|
||||
UpdateDefault(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
type DetailsMixin struct {
|
||||
mixin.Schema
|
||||
}
|
||||
|
||||
func (DetailsMixin) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("name").
|
||||
MaxLen(255).
|
||||
NotEmpty(),
|
||||
field.String("description").
|
||||
MaxLen(1000).
|
||||
Optional(),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue