backend api, swagger, tooling, frontend skeleton

This commit is contained in:
2026-01-21 22:05:02 +01:00
parent a9d1ad79ca
commit 88624f3bed
107 changed files with 34393 additions and 6 deletions

View File

@@ -0,0 +1,64 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"context"
"fmt"
"io"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql/schema"
)
var (
// WithGlobalUniqueID sets the universal ids options to the migration.
// If this option is enabled, ent migration will allocate a 1<<32 range
// for the ids of each entity (table).
// Note that this option cannot be applied on tables that already exist.
WithGlobalUniqueID = schema.WithGlobalUniqueID
// WithDropColumn sets the drop column option to the migration.
// If this option is enabled, ent migration will drop old columns
// that were used for both fields and edges. This defaults to false.
WithDropColumn = schema.WithDropColumn
// WithDropIndex sets the drop index option to the migration.
// If this option is enabled, ent migration will drop old indexes
// that were defined in the schema. This defaults to false.
// Note that unique constraints are defined using `UNIQUE INDEX`,
// and therefore, it's recommended to enable this option to get more
// flexibility in the schema changes.
WithDropIndex = schema.WithDropIndex
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
WithForeignKeys = schema.WithForeignKeys
)
// Schema is the API for creating, migrating and dropping a schema.
type Schema struct {
drv dialect.Driver
}
// NewSchema creates a new schema client.
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
// Create creates all schema resources.
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
return Create(ctx, s, Tables, opts...)
}
// Create creates all table resources using the given schema driver.
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
migrate, err := schema.NewMigrate(s.drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, tables...)
}
// WriteTo writes the schema changes to w instead of running them against the database.
//
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
// log.Fatal(err)
// }
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
}

View File

@@ -0,0 +1,202 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// CategorieColumns holds the columns for the "categorie" table.
CategorieColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "nom", Type: field.TypeString},
{Name: "slug", Type: field.TypeString, Nullable: true},
{Name: "icone", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "parent_id", Type: field.TypeUUID, Nullable: true},
}
// CategorieTable holds the schema information for the "categorie" table.
CategorieTable = &schema.Table{
Name: "categorie",
Columns: CategorieColumns,
PrimaryKey: []*schema.Column{CategorieColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "categorie_categorie_enfants",
Columns: []*schema.Column{CategorieColumns[6]},
RefColumns: []*schema.Column{CategorieColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// ChampPersonnaliseColumns holds the columns for the "champ_personnalise" table.
ChampPersonnaliseColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "nom_champ", Type: field.TypeString},
{Name: "type_champ", Type: field.TypeEnum, Enums: []string{"string", "int", "bool", "date"}, Default: "string"},
{Name: "valeur", Type: field.TypeString, Nullable: true},
{Name: "unite", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "objet_id", Type: field.TypeUUID},
}
// ChampPersonnaliseTable holds the schema information for the "champ_personnalise" table.
ChampPersonnaliseTable = &schema.Table{
Name: "champ_personnalise",
Columns: ChampPersonnaliseColumns,
PrimaryKey: []*schema.Column{ChampPersonnaliseColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "champ_personnalise_objet_champs_personnalises",
Columns: []*schema.Column{ChampPersonnaliseColumns[7]},
RefColumns: []*schema.Column{ObjetColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// EmplacementColumns holds the columns for the "emplacement" table.
EmplacementColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "nom", Type: field.TypeString},
{Name: "slug", Type: field.TypeString, Nullable: true},
{Name: "piece", Type: field.TypeString, Nullable: true},
{Name: "meuble", Type: field.TypeString, Nullable: true},
{Name: "numero_boite", Type: field.TypeString, Nullable: true},
{Name: "icone", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "parent_id", Type: field.TypeUUID, Nullable: true},
}
// EmplacementTable holds the schema information for the "emplacement" table.
EmplacementTable = &schema.Table{
Name: "emplacement",
Columns: EmplacementColumns,
PrimaryKey: []*schema.Column{EmplacementColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "emplacement_emplacement_enfants",
Columns: []*schema.Column{EmplacementColumns[9]},
RefColumns: []*schema.Column{EmplacementColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// LienObjetEmplacementColumns holds the columns for the "lien_objet_emplacement" table.
LienObjetEmplacementColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "type", Type: field.TypeEnum, Enums: []string{"stocke", "utilise_dans"}, Default: "stocke"},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "emplacement_id", Type: field.TypeUUID},
{Name: "objet_id", Type: field.TypeUUID},
}
// LienObjetEmplacementTable holds the schema information for the "lien_objet_emplacement" table.
LienObjetEmplacementTable = &schema.Table{
Name: "lien_objet_emplacement",
Columns: LienObjetEmplacementColumns,
PrimaryKey: []*schema.Column{LienObjetEmplacementColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "lien_objet_emplacement_emplacement_liens_objets",
Columns: []*schema.Column{LienObjetEmplacementColumns[4]},
RefColumns: []*schema.Column{EmplacementColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "lien_objet_emplacement_objet_liens_emplacements",
Columns: []*schema.Column{LienObjetEmplacementColumns[5]},
RefColumns: []*schema.Column{ObjetColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// ObjetColumns holds the columns for the "objet" table.
ObjetColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "nom", Type: field.TypeString},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "quantite", Type: field.TypeInt, Default: 0},
{Name: "prix_achat", Type: field.TypeFloat64, Nullable: true},
{Name: "date_achat", Type: field.TypeTime, Nullable: true},
{Name: "boutique", Type: field.TypeString, Nullable: true},
{Name: "numero_serie", Type: field.TypeString, Nullable: true},
{Name: "numero_modele", Type: field.TypeString, Nullable: true},
{Name: "fabricant", Type: field.TypeString, Nullable: true},
{Name: "statut", Type: field.TypeEnum, Enums: []string{"en_stock", "pret", "hors_service", "archive"}, Default: "en_stock"},
{Name: "caracteristiques", Type: field.TypeJSON, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
}
// ObjetTable holds the schema information for the "objet" table.
ObjetTable = &schema.Table{
Name: "objet",
Columns: ObjetColumns,
PrimaryKey: []*schema.Column{ObjetColumns[0]},
}
// PieceJointeColumns holds the columns for the "piece_jointe" table.
PieceJointeColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "nom_fichier", Type: field.TypeString},
{Name: "chemin", Type: field.TypeString},
{Name: "type_mime", Type: field.TypeString},
{Name: "est_principale", Type: field.TypeBool, Default: false},
{Name: "categorie", Type: field.TypeEnum, Enums: []string{"image", "pdf_notice", "markdown_tuto"}, Default: "image"},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "objet_id", Type: field.TypeUUID},
}
// PieceJointeTable holds the schema information for the "piece_jointe" table.
PieceJointeTable = &schema.Table{
Name: "piece_jointe",
Columns: PieceJointeColumns,
PrimaryKey: []*schema.Column{PieceJointeColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "piece_jointe_objet_pieces_jointes",
Columns: []*schema.Column{PieceJointeColumns[8]},
RefColumns: []*schema.Column{ObjetColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
CategorieTable,
ChampPersonnaliseTable,
EmplacementTable,
LienObjetEmplacementTable,
ObjetTable,
PieceJointeTable,
}
)
func init() {
CategorieTable.ForeignKeys[0].RefTable = CategorieTable
CategorieTable.Annotation = &entsql.Annotation{
Table: "categorie",
}
ChampPersonnaliseTable.ForeignKeys[0].RefTable = ObjetTable
ChampPersonnaliseTable.Annotation = &entsql.Annotation{
Table: "champ_personnalise",
}
EmplacementTable.ForeignKeys[0].RefTable = EmplacementTable
EmplacementTable.Annotation = &entsql.Annotation{
Table: "emplacement",
}
LienObjetEmplacementTable.ForeignKeys[0].RefTable = EmplacementTable
LienObjetEmplacementTable.ForeignKeys[1].RefTable = ObjetTable
LienObjetEmplacementTable.Annotation = &entsql.Annotation{
Table: "lien_objet_emplacement",
}
ObjetTable.Annotation = &entsql.Annotation{
Table: "objet",
}
PieceJointeTable.ForeignKeys[0].RefTable = ObjetTable
PieceJointeTable.Annotation = &entsql.Annotation{
Table: "piece_jointe",
}
}