mirror of
https://github.com/holos-run/holos.git
synced 2026-04-05 00:54:57 +00:00
This patch refactors the API to be resource-oriented around one service per resource type. PlatformService, OrganizationService, UserService, etc... Validation is improved to use CEL rules provided by [protovalidate][1]. Place holders for FieldMask and other best practices are added, but are unimplemented as per [API Best Practices][2]. The intent is to set us up well for copying and pasting solid existing examples as we add features. With this patch the server and web app client are both updated to use the refactored API, however the following are not working: 1. Update the model. 2. Field Masks. [1]: https://buf.build/bufbuild/protovalidate [2]: https://protobuf.dev/programming-guides/api/
155 lines
5.2 KiB
Go
155 lines
5.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package migrate
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql/schema"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
var (
|
|
// OrganizationsColumns holds the columns for the "organizations" table.
|
|
OrganizationsColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime},
|
|
{Name: "name", Type: field.TypeString, Unique: true},
|
|
{Name: "display_name", Type: field.TypeString},
|
|
{Name: "created_by_id", Type: field.TypeUUID},
|
|
{Name: "updated_by_id", Type: field.TypeUUID},
|
|
}
|
|
// OrganizationsTable holds the schema information for the "organizations" table.
|
|
OrganizationsTable = &schema.Table{
|
|
Name: "organizations",
|
|
Columns: OrganizationsColumns,
|
|
PrimaryKey: []*schema.Column{OrganizationsColumns[0]},
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
{
|
|
Symbol: "organizations_users_creator",
|
|
Columns: []*schema.Column{OrganizationsColumns[5]},
|
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
|
OnDelete: schema.NoAction,
|
|
},
|
|
{
|
|
Symbol: "organizations_users_editor",
|
|
Columns: []*schema.Column{OrganizationsColumns[6]},
|
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
|
OnDelete: schema.NoAction,
|
|
},
|
|
},
|
|
}
|
|
// PlatformsColumns holds the columns for the "platforms" table.
|
|
PlatformsColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime},
|
|
{Name: "name", Type: field.TypeString},
|
|
{Name: "display_name", Type: field.TypeString},
|
|
{Name: "form", Type: field.TypeJSON, Nullable: true},
|
|
{Name: "model", Type: field.TypeJSON, Nullable: true},
|
|
{Name: "cue", Type: field.TypeBytes, Nullable: true},
|
|
{Name: "cue_definition", Type: field.TypeString, Nullable: true},
|
|
{Name: "created_by_id", Type: field.TypeUUID},
|
|
{Name: "updated_by_id", Type: field.TypeUUID},
|
|
{Name: "org_id", Type: field.TypeUUID},
|
|
}
|
|
// PlatformsTable holds the schema information for the "platforms" table.
|
|
PlatformsTable = &schema.Table{
|
|
Name: "platforms",
|
|
Columns: PlatformsColumns,
|
|
PrimaryKey: []*schema.Column{PlatformsColumns[0]},
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
{
|
|
Symbol: "platforms_users_creator",
|
|
Columns: []*schema.Column{PlatformsColumns[9]},
|
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
|
OnDelete: schema.NoAction,
|
|
},
|
|
{
|
|
Symbol: "platforms_users_editor",
|
|
Columns: []*schema.Column{PlatformsColumns[10]},
|
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
|
OnDelete: schema.NoAction,
|
|
},
|
|
{
|
|
Symbol: "platforms_organizations_organization",
|
|
Columns: []*schema.Column{PlatformsColumns[11]},
|
|
RefColumns: []*schema.Column{OrganizationsColumns[0]},
|
|
OnDelete: schema.NoAction,
|
|
},
|
|
},
|
|
Indexes: []*schema.Index{
|
|
{
|
|
Name: "platform_org_id_name",
|
|
Unique: true,
|
|
Columns: []*schema.Column{PlatformsColumns[11], PlatformsColumns[3]},
|
|
},
|
|
},
|
|
}
|
|
// UsersColumns holds the columns for the "users" table.
|
|
UsersColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime},
|
|
{Name: "email", Type: field.TypeString, Unique: true},
|
|
{Name: "iss", Type: field.TypeString},
|
|
{Name: "sub", Type: field.TypeString},
|
|
{Name: "name", Type: field.TypeString},
|
|
}
|
|
// UsersTable holds the schema information for the "users" table.
|
|
UsersTable = &schema.Table{
|
|
Name: "users",
|
|
Columns: UsersColumns,
|
|
PrimaryKey: []*schema.Column{UsersColumns[0]},
|
|
Indexes: []*schema.Index{
|
|
{
|
|
Name: "user_iss_sub",
|
|
Unique: true,
|
|
Columns: []*schema.Column{UsersColumns[4], UsersColumns[5]},
|
|
},
|
|
},
|
|
}
|
|
// OrganizationUsersColumns holds the columns for the "organization_users" table.
|
|
OrganizationUsersColumns = []*schema.Column{
|
|
{Name: "organization_id", Type: field.TypeUUID},
|
|
{Name: "user_id", Type: field.TypeUUID},
|
|
}
|
|
// OrganizationUsersTable holds the schema information for the "organization_users" table.
|
|
OrganizationUsersTable = &schema.Table{
|
|
Name: "organization_users",
|
|
Columns: OrganizationUsersColumns,
|
|
PrimaryKey: []*schema.Column{OrganizationUsersColumns[0], OrganizationUsersColumns[1]},
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
{
|
|
Symbol: "organization_users_organization_id",
|
|
Columns: []*schema.Column{OrganizationUsersColumns[0]},
|
|
RefColumns: []*schema.Column{OrganizationsColumns[0]},
|
|
OnDelete: schema.Cascade,
|
|
},
|
|
{
|
|
Symbol: "organization_users_user_id",
|
|
Columns: []*schema.Column{OrganizationUsersColumns[1]},
|
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
|
OnDelete: schema.Cascade,
|
|
},
|
|
},
|
|
}
|
|
// Tables holds all the tables in the schema.
|
|
Tables = []*schema.Table{
|
|
OrganizationsTable,
|
|
PlatformsTable,
|
|
UsersTable,
|
|
OrganizationUsersTable,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
OrganizationsTable.ForeignKeys[0].RefTable = UsersTable
|
|
OrganizationsTable.ForeignKeys[1].RefTable = UsersTable
|
|
PlatformsTable.ForeignKeys[0].RefTable = UsersTable
|
|
PlatformsTable.ForeignKeys[1].RefTable = UsersTable
|
|
PlatformsTable.ForeignKeys[2].RefTable = OrganizationsTable
|
|
OrganizationUsersTable.ForeignKeys[0].RefTable = OrganizationsTable
|
|
OrganizationUsersTable.ForeignKeys[1].RefTable = UsersTable
|
|
}
|