From 818f0ccb9b35eba89cfa2ae53ab6de1cfd0b3148 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Sat, 20 Aug 2022 19:45:23 +0200 Subject: [PATCH] Generate models for all resources Some refactoring of CUE files --- app/boot_dal.go | 16 + automation/model/models.gen.go | 551 ++++ automation/trigger.cue | 8 +- automation/workflow.cue | 8 +- .../gocode/dal/$component_model.go.tpl | 62 + codegen/schema/component.cue | 2 +- codegen/schema/model.cue | 70 + codegen/schema/resource.cue | 7 +- codegen/schema/shared.cue | 3 +- codegen/server.dal_models.cue | 38 + codegen/server.rbac_types.cue | 4 +- codegen/server.types.cue | 4 +- compose/attachment.cue | 15 +- compose/chart.cue | 22 +- compose/model/models.gen.go | 911 ++++++ compose/module.cue | 7 +- compose/module_field.cue | 42 +- compose/namespace.cue | 16 +- compose/page.cue | 22 +- compose/record.cue | 8 +- compose/service/module.go | 13 +- federation/model/models.gen.go | 587 ++++ federation/module_exposed.cue | 26 +- federation/shared_module.cue | 24 +- pkg/dal/attribute_types.go | 8 +- store/adapters/rdbms/aux_types.gen.go | 16 +- store/adapters/rdbms/queries.gen.go | 16 +- store/adapters/rdbms/rdbms.gen.go | 94 +- system/apigw_filter.cue | 26 +- system/apigw_route.cue | 24 +- system/auth_client.cue | 9 +- system/dal_connection.cue | 22 +- system/dal_sensitivity_level.cue | 20 +- system/data_privacy_request.cue | 28 +- system/data_privacy_request_comment.cue | 18 +- system/model/all.gen.go | 1976 ------------ system/model/models.gen.go | 2695 +++++++++++++++++ system/queue.cue | 20 +- system/report.cue | 8 +- system/resource_translation.cue | 24 +- 40 files changed, 5225 insertions(+), 2245 deletions(-) create mode 100644 automation/model/models.gen.go create mode 100644 codegen/assets/templates/gocode/dal/$component_model.go.tpl create mode 100644 codegen/server.dal_models.cue create mode 100644 compose/model/models.gen.go create mode 100644 federation/model/models.gen.go delete mode 100644 system/model/all.gen.go create mode 100644 system/model/models.gen.go diff --git a/app/boot_dal.go b/app/boot_dal.go index e512882a2..538f9864d 100644 --- a/app/boot_dal.go +++ b/app/boot_dal.go @@ -22,5 +22,21 @@ func (app *CortezaApp) initDAL(ctx context.Context, log *zap.Logger) (err error) // Init DAL and prepare default connection dal.SetGlobal(dal.New(log.Named("dal"), app.Opt.Environment.IsDevelopment())) + // disabled for now until we have a real need (RDBMS table gen for example) for it + // + //// Register all models + //if err = atmModels.Register(ctx, dal.Service()); err != nil { + // return + //} + //if err = sysModels.Register(ctx, dal.Service()); err != nil { + // return + //} + //if err = cmpModels.Register(ctx, dal.Service()); err != nil { + // return + //} + //if err = fdrModels.Register(ctx, dal.Service()); err != nil { + // return + //} + return } diff --git a/automation/model/models.gen.go b/automation/model/models.gen.go new file mode 100644 index 000000000..456a14477 --- /dev/null +++ b/automation/model/models.gen.go @@ -0,0 +1,551 @@ +package model + +// This file is auto-generated. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +import ( + "context" + "github.com/cortezaproject/corteza-server/automation/types" + "github.com/cortezaproject/corteza-server/pkg/dal" +) + +type ( + modelReplacer interface { + ReplaceModel(ctx context.Context, model *dal.Model) (err error) + } +) + +var ( + Workflow = &dal.Model{ + Ident: "automation_workflows", + ResourceType: types.WorkflowResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Enabled", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "enabled"}, + }, + + &dal.Attribute{ + Ident: "Trace", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "trace"}, + }, + + &dal.Attribute{ + Ident: "KeepSessions", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "keep_sessions"}, + }, + + &dal.Attribute{ + Ident: "Scope", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "scope"}, + }, + + &dal.Attribute{ + Ident: "Steps", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "steps"}, + }, + + &dal.Attribute{ + Ident: "Paths", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "paths"}, + }, + + &dal.Attribute{ + Ident: "Issues", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "issues"}, + }, + + &dal.Attribute{ + Ident: "RunAs", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "run_as"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "OwnedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "owned_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + Session = &dal.Model{ + Ident: "automation_sessions", + ResourceType: types.SessionResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "WorkflowID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_workflow"}, + }, + + &dal.Attribute{ + Ident: "EventType", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "event_type"}, + }, + + &dal.Attribute{ + Ident: "ResourceType", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "resource_type"}, + }, + + &dal.Attribute{ + Ident: "Status", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "status"}, + }, + + &dal.Attribute{ + Ident: "Input", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "input"}, + }, + + &dal.Attribute{ + Ident: "Output", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "output"}, + }, + + &dal.Attribute{ + Ident: "Stacktrace", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "stacktrace"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "PurgeAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "purge_at"}, + }, + + &dal.Attribute{ + Ident: "CompletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "completed_at"}, + }, + + &dal.Attribute{ + Ident: "SuspendedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "suspended_at"}, + }, + + &dal.Attribute{ + Ident: "Error", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "error"}, + }, + }, + } + + Trigger = &dal.Model{ + Ident: "automation_triggers", + ResourceType: types.TriggerResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "WorkflowID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_workflow"}, + }, + + &dal.Attribute{ + Ident: "StepID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_step"}, + }, + + &dal.Attribute{ + Ident: "Enabled", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "enabled"}, + }, + + &dal.Attribute{ + Ident: "ResourceType", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "resource_type"}, + }, + + &dal.Attribute{ + Ident: "EventType", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "event_type"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Constraints", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "constraints"}, + }, + + &dal.Attribute{ + Ident: "Input", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "input"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "OwnedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "owned_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } +) + +func Register(ctx context.Context, mr modelReplacer) (err error) { + if err = mr.ReplaceModel(ctx, Workflow); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Session); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Trigger); err != nil { + return + } + + return +} diff --git a/automation/trigger.cue b/automation/trigger.cue index ac8112cd3..ac247e900 100644 --- a/automation/trigger.cue +++ b/automation/trigger.cue @@ -18,13 +18,13 @@ trigger: { constraints: { goType: "types.TriggerConstraintSet" } input: { goType: "*expr.Vars" } - owned_by: { goType: "uint64" } created_at: schema.SortableTimestampField updated_at: schema.SortableTimestampNilField deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + owned_by: schema.AttributeUserRef + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/automation/workflow.cue b/automation/workflow.cue index a63c2a507..ddf308aec 100644 --- a/automation/workflow.cue +++ b/automation/workflow.cue @@ -20,13 +20,13 @@ workflow: { issues: { goType: "types.WorkflowIssueSet" } run_as: { goType: "uint64" } - owned_by: { goType: "uint64" } created_at: schema.SortableTimestampField updated_at: schema.SortableTimestampNilField deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + owned_by: schema.AttributeUserRef + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/codegen/assets/templates/gocode/dal/$component_model.go.tpl b/codegen/assets/templates/gocode/dal/$component_model.go.tpl new file mode 100644 index 000000000..ee57ccb49 --- /dev/null +++ b/codegen/assets/templates/gocode/dal/$component_model.go.tpl @@ -0,0 +1,62 @@ +package {{ .package }} + +{{ template "gocode/header-gentext.tpl" }} + +import ( + "context" + "github.com/cortezaproject/corteza-server/pkg/dal" +{{- range .imports }} + {{ . }} +{{- end }} +) + +type ( + modelReplacer interface { + ReplaceModel(ctx context.Context, model *dal.Model) (err error) + } +) + +var ( +{{ range .models }} + {{ .var }} = &dal.Model{ + Ident: {{ printf "%q" .ident }}, + ResourceType: {{ .resType }}, + + Attributes: dal.AttributeSet{ + {{ range .attributes }} + &dal.Attribute{ + Ident: {{ printf "%q" .expIdent }}, + + {{ if .primaryKey }}PrimaryKey: true, {{ end -}} + {{ if .sortable }}Sortable: true, {{ end -}} + {{ if .filterable }}Filterable: true, {{ end }} + + Type: {{ .dal.fqType }}{ + {{ if .dal.nullable }}Nullable: true,{{ end -}} + {{ if eq .dal.type "Ref" }} + RefAttribute: {{ printf "%q" .dal.attribute }}, + RefModel: &dal.ModelRef{ + ResourceType: {{ printf "%q" .dal.refModelResType }}, + }, + {{ end }} + }, + + {{ if .store }} + Store: &dal.CodecAlias{Ident: {{ printf "%q" .storeIdent }}}, + {{ end }} + }, + {{ end -}} + }, + } +{{ end }} +) + +func Register(ctx context.Context, mr modelReplacer) (err error) { +{{- range .models }} + if err = mr.ReplaceModel(ctx, {{ .var }}); err != nil { + return + } +{{ end }} + + return +} diff --git a/codegen/schema/component.cue b/codegen/schema/component.cue index c16562698..8f0e9aae3 100644 --- a/codegen/schema/component.cue +++ b/codegen/schema/component.cue @@ -15,7 +15,7 @@ import ( [key=_]: {"handle": key, "component": handle, "platform": platform} & #Resource } - fqrn: platform + "::" + handle + fqrt: platform + "::" + handle // All known RBAC operations for this component rbac: #rbacComponent & { diff --git a/codegen/schema/model.cue b/codegen/schema/model.cue index 49b0d4818..4b29d3edd 100644 --- a/codegen/schema/model.cue +++ b/codegen/schema/model.cue @@ -11,6 +11,18 @@ import ( } } +#ModelAttributeDalType: + "ID" | "Ref" | + "Timestamp" | "Time" | "Date" | + "Number" | + "Text" | + "Boolean" | + "Enum" | + "Geometry" | + "JSON" | + "Blob" | + "UUID" + // logic in struct fields is a bit different #ModelAttribute: { name: #ident @@ -40,6 +52,55 @@ import ( // currently disabled since not used by anything // it adds more than 4x overhead to the time it takes to generate the store code! // #ModelAttributeJsonTag + + dal: { + type: #ModelAttributeDalType | * "Text" + + fqType: "dal.Type\(type)" + + nullable: bool | *false + + if type == "ID" { + generatedByStore: bool | *false + } + + if type == "Ref" { + refModelResType: #FQRT + attribute: #handle | *"id" + } + + if type == "Timestamp" { + timezone: bool | *false + precision: number | *0 + } + + if type == "Time" { + timezone: bool | *false + precision: number | *0 + } + + if type == "Date" {} + + if type == "Number" { + precision: number | *0 + scale: number | *0 + } + + if type == "Text" { + length: number | *0 + } + + if type == "Boolean" {} + + if type == "Enum" { + values: [] + } + + if type == "Geometry" {} + if type == "JSON" {} + if type == "Blob" {} + if type == "UUID" {} + } } IdField: { @@ -51,6 +112,7 @@ IdField: { // @todo someday we'll replace this with the "ID" type goType: "uint64" + dal: { type: "ID" } } HandleField: { @@ -60,16 +122,24 @@ HandleField: { ignoreCase: true goType: "string" + dal: { type: "Text", length: 255 } +} + +AttributeUserRef: { + goType: "uint64" + dal: { type: "Ref", refModelResType: "corteza::system:user" } } SortableTimestampField: { sortable: true goType: "time.Time" + dal: { type: "Timestamp", precision: 0, timezone: true, nullable: false } } SortableTimestampNilField: { sortable: true goType: "*time.Time" + dal: { type: "Timestamp", precision: 0, timezone: true, nullable: true } } #ModelAttributeJsonTag: { diff --git a/codegen/schema/resource.cue b/codegen/schema/resource.cue index 097133dda..a0789554a 100644 --- a/codegen/schema/resource.cue +++ b/codegen/schema/resource.cue @@ -4,9 +4,14 @@ import ( "strings" ) +// fully qualified resource type +#FQRT: =~ "^corteza::(compose|system|federation|automation):[a-z][a-z0-9-]*$" + #Resource: { #_base + // type: #resourceType | *"" + imports: [...{ import: string }] // copy field values from #_base @@ -16,7 +21,7 @@ import ( platform: #baseHandle | *"corteza" // Fully qualified resource name - fqrn: string | *(platform + "::" + component + ":" + handle) + fqrt: #FQRT | *(platform + "::" + component + ":" + handle) model: #Model & { // use resource handle (plural) as model ident as default diff --git a/codegen/schema/shared.cue b/codegen/schema/shared.cue index a366b54da..78f6817ca 100644 --- a/codegen/schema/shared.cue +++ b/codegen/schema/shared.cue @@ -4,6 +4,7 @@ import ( "strings" ) + // Identifier #ident: =~"^[a-z][a-zA-Z0-9_]*$" @@ -19,7 +20,7 @@ import ( #_base: { // lowercase dash-separated words // used to build ident and exported identifiers - handle: #baseHandle | *"base" + handle: #baseHandle _words: strings.Replace(strings.Replace(strings.Replace(handle, "-", " ", -1), "_", " ", -1), ".", " ", -1) // lowercase (unexported, golang) identifier diff --git a/codegen/server.dal_models.cue b/codegen/server.dal_models.cue new file mode 100644 index 000000000..4122103c2 --- /dev/null +++ b/codegen/server.dal_models.cue @@ -0,0 +1,38 @@ +package codegen + +import ( + "github.com/cortezaproject/corteza-server/app" + "github.com/cortezaproject/corteza-server/codegen/schema" +) + + +[...schema.#codegen] & +[ + for cmp in app.corteza.components { + template: "gocode/dal/$component_model.go.tpl" + output: "\(cmp.ident)/model/models.gen.go" + payload: { + package: "model" + + imports: [ + "\"github.com/cortezaproject/corteza-server/\(cmp.ident)/types\"", + ] + + cmpIdent: cmp.ident + // Operation/resource validators, grouped by resource + models: [ + for res in cmp.resources if res.model.attributes != _|_ { + var: "\(res.expIdent)" + resType: "types.\(res.expIdent)ResourceType" + + ident: res.model.ident + attributes: [ + for attr in res.model.attributes { + attr + } + ] + }, + ] + } + }, +] diff --git a/codegen/server.rbac_types.cue b/codegen/server.rbac_types.cue index 34da2951e..f4b83d4fb 100644 --- a/codegen/server.rbac_types.cue +++ b/codegen/server.rbac_types.cue @@ -18,7 +18,7 @@ import ( types: [ for res in cmp.resources if res.rbac != _|_ { const: "\(res.expIdent)ResourceType" - type: res.fqrn + type: res.fqrt resFunc: "\(res.expIdent)RbacResource" tplFunc: "\(res.expIdent)RbacResourceTpl" attFunc: "\(res.expIdent)RbacAttributes" @@ -28,7 +28,7 @@ import ( }, { const: "ComponentResourceType" - type: cmp.fqrn + type: cmp.fqrt resFunc: "ComponentRbacResource" tplFunc: "ComponentRbacResourceTpl" attFunc: "ComponentRbacAttributes" diff --git a/codegen/server.types.cue b/codegen/server.types.cue index 003eac024..0dd25e41a 100644 --- a/codegen/server.types.cue +++ b/codegen/server.types.cue @@ -18,11 +18,11 @@ import ( types: [ for res in cmp.resources { const: "\(res.expIdent)ResourceType" - type: res.fqrn + type: res.fqrt }, { const: "ComponentResourceType" - type: cmp.fqrn + type: cmp.fqrt }, ] } diff --git a/compose/attachment.cue b/compose/attachment.cue index 266abac33..b4ac36cc2 100644 --- a/compose/attachment.cue +++ b/compose/attachment.cue @@ -13,8 +13,19 @@ attachment: { ident: "compose_attachment" attributes: { id: schema.IdField - owner_id: { sortable: true, goType: "uint64", storeIdent: "rel_owner", ident: "ownerID" } - namespace_id: { sortable: true, goType: "uint64", storeIdent: "rel_namespace", ident: "namespaceID" } + owner_id: { + sortable: true, + goType: "uint64", + storeIdent: "rel_owner", + ident: "ownerID" + dal: { type: "Ref", refModelResType: "corteza::system:user" } + } + namespace_id: { + ident: "namespaceID", + goType: "uint64", + storeIdent: "rel_namespace" + dal: { type: "Ref", refModelResType: "corteza::compose:namespace" } + } kind: {sortable: true} url: {} preview_url: {} diff --git a/compose/chart.cue b/compose/chart.cue index 3de8d469a..1d14f7a98 100644 --- a/compose/chart.cue +++ b/compose/chart.cue @@ -12,15 +12,19 @@ chart: { model: { ident: "compose_chart" attributes: { - id: schema.IdField - handle: schema.HandleField - name: {sortable: true} - config: { goType: "types.ChartConfig" } - namespace_id: { sortable: true, ident: "namespaceID", goType: "uint64", storeIdent: "rel_namespace" } - - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField + id: schema.IdField + handle: schema.HandleField + name: {sortable: true} + config: { goType: "types.ChartConfig" } + namespace_id: { + ident: "namespaceID", + goType: "uint64", + storeIdent: "rel_namespace" + dal: { type: "Ref", refModelResType: "corteza::compose:namespace" } + } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField } } diff --git a/compose/model/models.gen.go b/compose/model/models.gen.go new file mode 100644 index 000000000..4ed41e1f8 --- /dev/null +++ b/compose/model/models.gen.go @@ -0,0 +1,911 @@ +package model + +// This file is auto-generated. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +import ( + "context" + "github.com/cortezaproject/corteza-server/compose/types" + "github.com/cortezaproject/corteza-server/pkg/dal" +) + +type ( + modelReplacer interface { + ReplaceModel(ctx context.Context, model *dal.Model) (err error) + } +) + +var ( + Attachment = &dal.Model{ + Ident: "compose_attachment", + ResourceType: types.AttachmentResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "OwnerID", + + Sortable: true, + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "rel_owner"}, + }, + + &dal.Attribute{ + Ident: "NamespaceID", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::compose:namespace", + }, + }, + + Store: &dal.CodecAlias{Ident: "rel_namespace"}, + }, + + &dal.Attribute{ + Ident: "Kind", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "kind"}, + }, + + &dal.Attribute{ + Ident: "Url", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "url"}, + }, + + &dal.Attribute{ + Ident: "PreviewUrl", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "preview_url"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + Chart = &dal.Model{ + Ident: "compose_chart", + ResourceType: types.ChartResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "Config", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "config"}, + }, + + &dal.Attribute{ + Ident: "NamespaceID", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::compose:namespace", + }, + }, + + Store: &dal.CodecAlias{Ident: "rel_namespace"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + Module = &dal.Model{ + Ident: "compose_module", + ResourceType: types.ModuleResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Config", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "config"}, + }, + + &dal.Attribute{ + Ident: "Fields", + + Type: dal.TypeText{}, + }, + + &dal.Attribute{ + Ident: "NamespaceID", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::compose:namespace", + }, + }, + + Store: &dal.CodecAlias{Ident: "rel_namespace"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + ModuleField = &dal.Model{ + Ident: "compose_module_field", + ResourceType: types.ModuleFieldResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "ModuleID", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::compose:module", + }, + }, + + Store: &dal.CodecAlias{Ident: "rel_module"}, + }, + + &dal.Attribute{ + Ident: "NamespaceID", + + Type: dal.TypeText{}, + }, + + &dal.Attribute{ + Ident: "Place", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "place"}, + }, + + &dal.Attribute{ + Ident: "Kind", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "kind"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "Label", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "label"}, + }, + + &dal.Attribute{ + Ident: "Options", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "options"}, + }, + + &dal.Attribute{ + Ident: "Config", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "config"}, + }, + + &dal.Attribute{ + Ident: "Required", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "is_required"}, + }, + + &dal.Attribute{ + Ident: "Multi", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "is_multi"}, + }, + + &dal.Attribute{ + Ident: "DefaultValue", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "default_value"}, + }, + + &dal.Attribute{ + Ident: "Expressions", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "expressions"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + Namespace = &dal.Model{ + Ident: "compose_namespace", + ResourceType: types.NamespaceResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Slug", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "slug"}, + }, + + &dal.Attribute{ + Ident: "Enabled", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "enabled"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + Page = &dal.Model{ + Ident: "compose_page", + ResourceType: types.PageResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "SelfID", + + Sortable: true, + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::compose:page", + }, + }, + + Store: &dal.CodecAlias{Ident: "self_id"}, + }, + + &dal.Attribute{ + Ident: "ModuleID", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::compose:module", + }, + }, + + Store: &dal.CodecAlias{Ident: "rel_module"}, + }, + + &dal.Attribute{ + Ident: "NamespaceID", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::compose:namespace", + }, + }, + + Store: &dal.CodecAlias{Ident: "rel_namespace"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Config", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "config"}, + }, + + &dal.Attribute{ + Ident: "Blocks", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "blocks"}, + }, + + &dal.Attribute{ + Ident: "Children", + + Type: dal.TypeText{}, + }, + + &dal.Attribute{ + Ident: "Visible", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "visible"}, + }, + + &dal.Attribute{ + Ident: "Weight", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "weight"}, + }, + + &dal.Attribute{ + Ident: "Title", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "title"}, + }, + + &dal.Attribute{ + Ident: "Description", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "description"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + Record = &dal.Model{ + Ident: "records", + ResourceType: types.RecordResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "ModuleID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_module"}, + }, + + &dal.Attribute{ + Ident: "Module", + + Type: dal.TypeText{}, + }, + + &dal.Attribute{ + Ident: "Values", + + Type: dal.TypeText{}, + }, + + &dal.Attribute{ + Ident: "NamespaceID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_namespace"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "OwnedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "owned_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } +) + +func Register(ctx context.Context, mr modelReplacer) (err error) { + if err = mr.ReplaceModel(ctx, Attachment); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Chart); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Module); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, ModuleField); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Namespace); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Page); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Record); err != nil { + return + } + + return +} diff --git a/compose/module.cue b/compose/module.cue index a90f5fa74..9500d00b0 100644 --- a/compose/module.cue +++ b/compose/module.cue @@ -18,7 +18,12 @@ module: { meta: { goType: "rawJson" } config: { goType: "types.ModuleConfig" } fields: { goType: "types.ModuleFieldSet", store: false } - namespace_id: { ident: "namespaceID", goType: "uint64", storeIdent: "rel_namespace" } + namespace_id: { + ident: "namespaceID", + goType: "uint64", + storeIdent: "rel_namespace" + dal: { type: "Ref", refModelResType: "corteza::compose:namespace" } + } name: {sortable: true} created_at: schema.SortableTimestampField diff --git a/compose/module_field.cue b/compose/module_field.cue index a1b5eed01..bb542dc1a 100644 --- a/compose/module_field.cue +++ b/compose/module_field.cue @@ -13,22 +13,32 @@ moduleField: { model: { ident: "compose_module_field" attributes: { - id: schema.IdField - namespace_id: { ident: "namespaceID", goType: "uint64", store: false } - module_id: { sortable: true, ident: "moduleID", goType: "uint64", storeIdent: "rel_module" } - place: { sortable: true, goType: "int" } - kind: { sortable: true, goType: "string" } - name: {sortable: true} - label: {sortable: true} - options: { goType: "types.ModuleFieldOptions" } - config: { goType: "types.ModuleFieldConfig" } - required: { goType: "bool", storeIdent: "is_required" } - multi: { goType: "bool", storeIdent: "is_multi" } - default_value: { goType: "types.RecordValueSet" } - expressions: { goType: "types.ModuleFieldExpr" } - created_at: { goType: "time.Time" } - updated_at: { goType: "*time.Time" } - deleted_at: { goType: "*time.Time" } + id: schema.IdField + module_id: { + ident: "moduleID", + goType: "uint64", + storeIdent: "rel_module" + dal: { type: "Ref", refModelResType: "corteza::compose:module" } + } + namespace_id: { + ident: "namespaceID", + goType: "uint64", + storeIdent: "rel_namespace" + store: false + } + place: { sortable: true, goType: "int" } + kind: { sortable: true, goType: "string" } + name: {sortable: true} + label: {sortable: true} + options: { goType: "types.ModuleFieldOptions" } + config: { goType: "types.ModuleFieldConfig" } + required: { goType: "bool", storeIdent: "is_required" } + multi: { goType: "bool", storeIdent: "is_multi" } + default_value: { goType: "types.RecordValueSet" } + expressions: { goType: "types.ModuleFieldExpr" } + created_at: { goType: "time.Time" } + updated_at: { goType: "*time.Time" } + deleted_at: { goType: "*time.Time" } } } diff --git a/compose/namespace.cue b/compose/namespace.cue index 98f3215d8..a336e004a 100644 --- a/compose/namespace.cue +++ b/compose/namespace.cue @@ -8,15 +8,15 @@ namespace: { model: { ident: "compose_namespace" attributes: { - id: schema.IdField - slug: { sortable: true, goType: "string" } - enabled: { goType: "bool" } - meta: { goType: "types.NamespaceMeta" } - name: {} + id: schema.IdField + slug: { sortable: true, goType: "string" } + enabled: { goType: "bool" } + meta: { goType: "types.NamespaceMeta" } + name: {} - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField } } diff --git a/compose/page.cue b/compose/page.cue index d84cf7897..6bc7ca75a 100644 --- a/compose/page.cue +++ b/compose/page.cue @@ -13,9 +13,25 @@ page: { ident: "compose_page" attributes: { id: schema.IdField - self_id: { sortable: true, ident: "selfID", goType: "uint64" } - module_id: { sortable: true, ident: "moduleID", goType: "uint64", storeIdent: "rel_module" } - namespace_id: { sortable: true, ident: "namespaceID", goType: "uint64", storeIdent: "rel_namespace" } + self_id: { + ident: "selfID", + goType: "uint64", + dal: { type: "Ref", refModelResType: "corteza::compose:page" } + sortable: true + } + module_id: { + ident: "moduleID", + goType: "uint64", + storeIdent: "rel_module" + dal: { type: "Ref", refModelResType: "corteza::compose:module" } + } + namespace_id: { + ident: "namespaceID", + goType: "uint64", + storeIdent: "rel_namespace" + dal: { type: "Ref", refModelResType: "corteza::compose:namespace" } + } + handle: schema.HandleField config: { goType: "types.PageConfig" } blocks: { goType: "types.PageBlocks" } diff --git a/compose/record.cue b/compose/record.cue index e21c0f5f9..484cff035 100644 --- a/compose/record.cue +++ b/compose/record.cue @@ -18,13 +18,13 @@ record: { values: { goType: "types.RecordValueSet", store: false } namespace_id: { ident: "namespaceID", goType: "uint64", storeIdent: "rel_namespace" } - owned_by: { goType: "uint64" } created_at: schema.SortableTimestampField updated_at: schema.SortableTimestampNilField deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + owned_by: schema.AttributeUserRef + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/compose/service/module.go b/compose/service/module.go index bb0146d6d..7334a7cb0 100644 --- a/compose/service/module.go +++ b/compose/service/module.go @@ -1405,8 +1405,7 @@ func moduleFieldToAttribute(f *types.ModuleField, conn *dal.ConnectionWrap) (out out = dal.FullAttribute(f.Name, at, mfc(f)) case "file": at := &dal.TypeRef{ - RefModel: &dal.Model{Resource: "corteza::system:attachment"}, - RefAttribute: &dal.Attribute{Ident: "id"}, + RefModel: &dal.ModelRef{Resource: "corteza::system:attachment"}, } out = dal.FullAttribute(f.Name, at, mfc(f)) case "number": @@ -1416,13 +1415,10 @@ func moduleFieldToAttribute(f *types.ModuleField, conn *dal.ConnectionWrap) (out out = dal.FullAttribute(f.Name, at, mfc(f)) case "record": at := &dal.TypeRef{ - RefModel: &dal.Model{ + RefModel: &dal.ModelRef{ ResourceID: f.Options.UInt64("moduleID"), ResourceType: types.ModuleResourceType, }, - RefAttribute: &dal.Attribute{ - Ident: "id", - }, } out = dal.FullAttribute(f.Name, at, mfc(f)) case "select": @@ -1437,12 +1433,9 @@ func moduleFieldToAttribute(f *types.ModuleField, conn *dal.ConnectionWrap) (out out = dal.FullAttribute(f.Name, at, mfc(f)) case "user": at := &dal.TypeRef{ - RefModel: &dal.Model{ + RefModel: &dal.ModelRef{ ResourceType: systemTypes.UserResourceType, }, - RefAttribute: &dal.Attribute{ - Ident: "id", - }, } out = dal.FullAttribute(f.Name, at, mfc(f)) diff --git a/federation/model/models.gen.go b/federation/model/models.gen.go new file mode 100644 index 000000000..3f183fada --- /dev/null +++ b/federation/model/models.gen.go @@ -0,0 +1,587 @@ +package model + +// This file is auto-generated. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +import ( + "context" + "github.com/cortezaproject/corteza-server/federation/types" + "github.com/cortezaproject/corteza-server/pkg/dal" +) + +type ( + modelReplacer interface { + ReplaceModel(ctx context.Context, model *dal.Model) (err error) + } +) + +var ( + Node = &dal.Model{ + Ident: "federation_nodes", + ResourceType: types.NodeResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "SharedNodeID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "shared_node_id"}, + }, + + &dal.Attribute{ + Ident: "BaseURL", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "base_url"}, + }, + + &dal.Attribute{ + Ident: "Status", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "status"}, + }, + + &dal.Attribute{ + Ident: "Contact", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "contact"}, + }, + + &dal.Attribute{ + Ident: "PairToken", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "pair_token"}, + }, + + &dal.Attribute{ + Ident: "AuthToken", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "auth_token"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + NodeSync = &dal.Model{ + Ident: "federation_nodes_sync", + ResourceType: types.NodeSyncResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "NodeID", + + PrimaryKey: true, Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "node_id"}, + }, + + &dal.Attribute{ + Ident: "ModuleID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "module_id"}, + }, + + &dal.Attribute{ + Ident: "SyncType", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "sync_type"}, + }, + + &dal.Attribute{ + Ident: "SyncStatus", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "sync_status"}, + }, + + &dal.Attribute{ + Ident: "TimeOfAction", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "time_of_action"}, + }, + }, + } + + ExposedModule = &dal.Model{ + Ident: "federation_module_exposed", + ResourceType: types.ExposedModuleResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "NodeID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_node"}, + }, + + &dal.Attribute{ + Ident: "ComposeModuleID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_compose_module"}, + }, + + &dal.Attribute{ + Ident: "ComposeNamespaceID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_compose_namespace"}, + }, + + &dal.Attribute{ + Ident: "Fields", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "fields"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + SharedModule = &dal.Model{ + Ident: "federation_module_shared", + ResourceType: types.SharedModuleResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "NodeID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_node"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "ExternalFederationModuleID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "xref_module"}, + }, + + &dal.Attribute{ + Ident: "Fields", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "fields"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + ModuleMapping = &dal.Model{ + Ident: "federation_module_mapping", + ResourceType: types.ModuleMappingResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "NodeID", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "node_id"}, + }, + + &dal.Attribute{ + Ident: "FederationModuleID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "federation_module_id"}, + }, + + &dal.Attribute{ + Ident: "ComposeModuleID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "compose_module_id"}, + }, + + &dal.Attribute{ + Ident: "ComposeNamespaceID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "compose_namespace_id"}, + }, + + &dal.Attribute{ + Ident: "FieldMapping", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "field_mapping"}, + }, + }, + } +) + +func Register(ctx context.Context, mr modelReplacer) (err error) { + if err = mr.ReplaceModel(ctx, Node); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, NodeSync); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, ExposedModule); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, SharedModule); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, ModuleMapping); err != nil { + return + } + + return +} diff --git a/federation/module_exposed.cue b/federation/module_exposed.cue index e742e860f..af8328ab9 100644 --- a/federation/module_exposed.cue +++ b/federation/module_exposed.cue @@ -16,20 +16,20 @@ exposedModule: { model: { ident: "federation_module_exposed" attributes: { - id: schema.IdField - handle: schema.HandleField - name: { sortable: true } - node_id: { sortable: true, ident: "nodeID", goType: "uint64", storeIdent: "rel_node" } - compose_module_id: { ident: "composeModuleID", goType: "uint64", storeIdent: "rel_compose_module" } - compose_namespace_id: { ident: "composeNamespaceID", goType: "uint64", storeIdent: "rel_compose_namespace" } - fields: { goType: "types.ModuleFieldSet" } + id: schema.IdField + handle: schema.HandleField + name: { sortable: true } + node_id: { sortable: true, ident: "nodeID", goType: "uint64", storeIdent: "rel_node" } + compose_module_id: { ident: "composeModuleID", goType: "uint64", storeIdent: "rel_compose_module" } + compose_namespace_id: { ident: "composeNamespaceID", goType: "uint64", storeIdent: "rel_compose_namespace" } + fields: { goType: "types.ModuleFieldSet" } - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/federation/shared_module.cue b/federation/shared_module.cue index afe4809dc..e6675b5ee 100644 --- a/federation/shared_module.cue +++ b/federation/shared_module.cue @@ -16,19 +16,19 @@ sharedModule: { model: { ident: "federation_module_shared" attributes: { - id: schema.IdField - handle: schema.HandleField - node_id: { sortable: true, ident: "nodeID", goType: "uint64", storeIdent: "rel_node" } - name: {sortable: true} - external_federation_module_id: { sortable: true, ident: "externalFederationModuleID", goType: "uint64", storeIdent: "xref_module", } - fields: { goType: "types.ModuleFieldSet" } + id: schema.IdField + handle: schema.HandleField + node_id: { sortable: true, ident: "nodeID", goType: "uint64", storeIdent: "rel_node" } + name: {sortable: true} + external_federation_module_id: { sortable: true, ident: "externalFederationModuleID", goType: "uint64", storeIdent: "xref_module", } + fields: { goType: "types.ModuleFieldSet" } - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/pkg/dal/attribute_types.go b/pkg/dal/attribute_types.go index 5d7dc3056..53ea352a7 100644 --- a/pkg/dal/attribute_types.go +++ b/pkg/dal/attribute_types.go @@ -27,9 +27,11 @@ type ( // 1) underlying store (and dialect) // 2) value codec (raw, json ...) TypeRef struct { - RefModel *Model - RefAttribute *Attribute - Nullable bool + // defaults to ID + RefAttribute string + RefModel *ModelRef + + Nullable bool } // TypeTimestamp handles timestamp coding diff --git a/store/adapters/rdbms/aux_types.gen.go b/store/adapters/rdbms/aux_types.gen.go index 89b593b2a..dd6edc015 100644 --- a/store/adapters/rdbms/aux_types.gen.go +++ b/store/adapters/rdbms/aux_types.gen.go @@ -183,10 +183,10 @@ type ( Meta *automationType.TriggerMeta `db:"meta"` Constraints automationType.TriggerConstraintSet `db:"constraints"` Input *expr.Vars `db:"input"` - OwnedBy uint64 `db:"owned_by"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` DeletedAt *time.Time `db:"deleted_at"` + OwnedBy uint64 `db:"owned_by"` CreatedBy uint64 `db:"created_by"` UpdatedBy uint64 `db:"updated_by"` DeletedBy uint64 `db:"deleted_by"` @@ -205,10 +205,10 @@ type ( Paths automationType.WorkflowPathSet `db:"paths"` Issues automationType.WorkflowIssueSet `db:"issues"` RunAs uint64 `db:"run_as"` - OwnedBy uint64 `db:"owned_by"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` DeletedAt *time.Time `db:"deleted_at"` + OwnedBy uint64 `db:"owned_by"` CreatedBy uint64 `db:"created_by"` UpdatedBy uint64 `db:"updated_by"` DeletedBy uint64 `db:"deleted_by"` @@ -1188,10 +1188,10 @@ func (aux *auxAutomationTrigger) encode(res *automationType.Trigger) (_ error) { aux.Meta = res.Meta aux.Constraints = res.Constraints aux.Input = res.Input - aux.OwnedBy = res.OwnedBy aux.CreatedAt = res.CreatedAt aux.UpdatedAt = res.UpdatedAt aux.DeletedAt = res.DeletedAt + aux.OwnedBy = res.OwnedBy aux.CreatedBy = res.CreatedBy aux.UpdatedBy = res.UpdatedBy aux.DeletedBy = res.DeletedBy @@ -1212,10 +1212,10 @@ func (aux auxAutomationTrigger) decode() (res *automationType.Trigger, _ error) res.Meta = aux.Meta res.Constraints = aux.Constraints res.Input = aux.Input - res.OwnedBy = aux.OwnedBy res.CreatedAt = aux.CreatedAt res.UpdatedAt = aux.UpdatedAt res.DeletedAt = aux.DeletedAt + res.OwnedBy = aux.OwnedBy res.CreatedBy = aux.CreatedBy res.UpdatedBy = aux.UpdatedBy res.DeletedBy = aux.DeletedBy @@ -1236,10 +1236,10 @@ func (aux *auxAutomationTrigger) scan(row scanner) error { &aux.Meta, &aux.Constraints, &aux.Input, - &aux.OwnedBy, &aux.CreatedAt, &aux.UpdatedAt, &aux.DeletedAt, + &aux.OwnedBy, &aux.CreatedBy, &aux.UpdatedBy, &aux.DeletedBy, @@ -1261,10 +1261,10 @@ func (aux *auxAutomationWorkflow) encode(res *automationType.Workflow) (_ error) aux.Paths = res.Paths aux.Issues = res.Issues aux.RunAs = res.RunAs - aux.OwnedBy = res.OwnedBy aux.CreatedAt = res.CreatedAt aux.UpdatedAt = res.UpdatedAt aux.DeletedAt = res.DeletedAt + aux.OwnedBy = res.OwnedBy aux.CreatedBy = res.CreatedBy aux.UpdatedBy = res.UpdatedBy aux.DeletedBy = res.DeletedBy @@ -1287,10 +1287,10 @@ func (aux auxAutomationWorkflow) decode() (res *automationType.Workflow, _ error res.Paths = aux.Paths res.Issues = aux.Issues res.RunAs = aux.RunAs - res.OwnedBy = aux.OwnedBy res.CreatedAt = aux.CreatedAt res.UpdatedAt = aux.UpdatedAt res.DeletedAt = aux.DeletedAt + res.OwnedBy = aux.OwnedBy res.CreatedBy = aux.CreatedBy res.UpdatedBy = aux.UpdatedBy res.DeletedBy = aux.DeletedBy @@ -1313,10 +1313,10 @@ func (aux *auxAutomationWorkflow) scan(row scanner) error { &aux.Paths, &aux.Issues, &aux.RunAs, - &aux.OwnedBy, &aux.CreatedAt, &aux.UpdatedAt, &aux.DeletedAt, + &aux.OwnedBy, &aux.CreatedBy, &aux.UpdatedBy, &aux.DeletedBy, diff --git a/store/adapters/rdbms/queries.gen.go b/store/adapters/rdbms/queries.gen.go index a56208bdb..22569375e 100644 --- a/store/adapters/rdbms/queries.gen.go +++ b/store/adapters/rdbms/queries.gen.go @@ -1158,10 +1158,10 @@ var ( "meta", "constraints", "input", - "owned_by", "created_at", "updated_at", "deleted_at", + "owned_by", "created_by", "updated_by", "deleted_by", @@ -1183,10 +1183,10 @@ var ( "meta": res.Meta, "constraints": res.Constraints, "input": res.Input, - "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, + "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1211,10 +1211,10 @@ var ( "meta": res.Meta, "constraints": res.Constraints, "input": res.Input, - "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, + "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1237,10 +1237,10 @@ var ( "meta": res.Meta, "constraints": res.Constraints, "input": res.Input, - "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, + "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1292,10 +1292,10 @@ var ( "paths", "issues", "run_as", - "owned_by", "created_at", "updated_at", "deleted_at", + "owned_by", "created_by", "updated_by", "deleted_by", @@ -1319,10 +1319,10 @@ var ( "paths": res.Paths, "issues": res.Issues, "run_as": res.RunAs, - "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, + "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1349,10 +1349,10 @@ var ( "paths": res.Paths, "issues": res.Issues, "run_as": res.RunAs, - "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, + "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, @@ -1377,10 +1377,10 @@ var ( "paths": res.Paths, "issues": res.Issues, "run_as": res.RunAs, - "owned_by": res.OwnedBy, "created_at": res.CreatedAt, "updated_at": res.UpdatedAt, "deleted_at": res.DeletedAt, + "owned_by": res.OwnedBy, "created_by": res.CreatedBy, "updated_by": res.UpdatedBy, "deleted_by": res.DeletedBy, diff --git a/store/adapters/rdbms/rdbms.gen.go b/store/adapters/rdbms/rdbms.gen.go index 96277de8c..d600161b4 100644 --- a/store/adapters/rdbms/rdbms.gen.go +++ b/store/adapters/rdbms/rdbms.gen.go @@ -5952,19 +5952,17 @@ func (s *Store) LookupComposeAttachmentByID(ctx context.Context, id uint64) (_ * // This function is auto-generated func (Store) sortableComposeAttachmentFields() map[string]string { return map[string]string{ - "created_at": "created_at", - "createdat": "created_at", - "deleted_at": "deleted_at", - "deletedat": "deleted_at", - "id": "id", - "kind": "kind", - "name": "name", - "namespace_id": "namespace_id", - "namespaceid": "namespace_id", - "owner_id": "owner_id", - "ownerid": "owner_id", - "updated_at": "updated_at", - "updatedat": "updated_at", + "created_at": "created_at", + "createdat": "created_at", + "deleted_at": "deleted_at", + "deletedat": "deleted_at", + "id": "id", + "kind": "kind", + "name": "name", + "owner_id": "owner_id", + "ownerid": "owner_id", + "updated_at": "updated_at", + "updatedat": "updated_at", } } @@ -5995,8 +5993,6 @@ func (s *Store) collectComposeAttachmentCursorValues(res *composeType.Attachment pkID = true case "ownerID": cur.Set(c.Column, res.OwnerID, c.Descending) - case "namespaceID": - cur.Set(c.Column, res.NamespaceID, c.Descending) case "kind": cur.Set(c.Column, res.Kind, c.Descending) case "name": @@ -6492,17 +6488,15 @@ func (s *Store) LookupComposeChartByNamespaceIDHandle(ctx context.Context, names // This function is auto-generated func (Store) sortableComposeChartFields() map[string]string { return map[string]string{ - "created_at": "created_at", - "createdat": "created_at", - "deleted_at": "deleted_at", - "deletedat": "deleted_at", - "handle": "handle", - "id": "id", - "name": "name", - "namespace_id": "namespace_id", - "namespaceid": "namespace_id", - "updated_at": "updated_at", - "updatedat": "updated_at", + "created_at": "created_at", + "createdat": "created_at", + "deleted_at": "deleted_at", + "deletedat": "deleted_at", + "handle": "handle", + "id": "id", + "name": "name", + "updated_at": "updated_at", + "updatedat": "updated_at", } } @@ -6536,8 +6530,6 @@ func (s *Store) collectComposeChartCursorValues(res *composeType.Chart, cc ...*f hasUnique = true case "name": cur.Set(c.Column, res.Name, c.Descending) - case "namespaceID": - cur.Set(c.Column, res.NamespaceID, c.Descending) case "createdAt": cur.Set(c.Column, res.CreatedAt, c.Descending) case "updatedAt": @@ -7440,13 +7432,11 @@ func (s *Store) LookupComposeModuleFieldByID(ctx context.Context, id uint64) (_ // This function is auto-generated func (Store) sortableComposeModuleFieldFields() map[string]string { return map[string]string{ - "id": "id", - "kind": "kind", - "label": "label", - "module_id": "module_id", - "moduleid": "module_id", - "name": "name", - "place": "place", + "id": "id", + "kind": "kind", + "label": "label", + "name": "name", + "place": "place", } } @@ -7475,8 +7465,6 @@ func (s *Store) collectComposeModuleFieldCursorValues(res *composeType.ModuleFie case "id": cur.Set(c.Column, res.ID, c.Descending) pkID = true - case "moduleID": - cur.Set(c.Column, res.ModuleID, c.Descending) case "place": cur.Set(c.Column, res.Place, c.Descending) case "kind": @@ -8599,22 +8587,18 @@ func (s *Store) LookupComposePageByID(ctx context.Context, id uint64) (_ *compos // This function is auto-generated func (Store) sortableComposePageFields() map[string]string { return map[string]string{ - "created_at": "created_at", - "createdat": "created_at", - "deleted_at": "deleted_at", - "deletedat": "deleted_at", - "handle": "handle", - "id": "id", - "module_id": "module_id", - "moduleid": "module_id", - "namespace_id": "namespace_id", - "namespaceid": "namespace_id", - "self_id": "self_id", - "selfid": "self_id", - "title": "title", - "updated_at": "updated_at", - "updatedat": "updated_at", - "weight": "weight", + "created_at": "created_at", + "createdat": "created_at", + "deleted_at": "deleted_at", + "deletedat": "deleted_at", + "handle": "handle", + "id": "id", + "self_id": "self_id", + "selfid": "self_id", + "title": "title", + "updated_at": "updated_at", + "updatedat": "updated_at", + "weight": "weight", } } @@ -8645,10 +8629,6 @@ func (s *Store) collectComposePageCursorValues(res *composeType.Page, cc ...*fil pkID = true case "selfID": cur.Set(c.Column, res.SelfID, c.Descending) - case "moduleID": - cur.Set(c.Column, res.ModuleID, c.Descending) - case "namespaceID": - cur.Set(c.Column, res.NamespaceID, c.Descending) case "handle": cur.Set(c.Column, res.Handle, c.Descending) hasUnique = true diff --git a/system/apigw_filter.cue b/system/apigw_filter.cue index be94d2987..1dc24d2d2 100644 --- a/system/apigw_filter.cue +++ b/system/apigw_filter.cue @@ -11,20 +11,20 @@ apigw_filter: { model: { attributes: { - id: schema.IdField - route: { sortable: true, goType: "uint64", storeIdent: "rel_route" } - weight: { sortable: true, goType: "uint64" } - ref: {} - kind: {sortable: true} - enabled: {sortable: true, goType: "bool"} - params: {goType: "types.ApigwFilterParams"} + id: schema.IdField + route: { sortable: true, goType: "uint64", storeIdent: "rel_route" } + weight: { sortable: true, goType: "uint64" } + ref: {} + kind: {sortable: true} + enabled: {sortable: true, goType: "bool"} + params: {goType: "types.ApigwFilterParams"} - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/apigw_route.cue b/system/apigw_route.cue index b359bea46..adbc4593e 100644 --- a/system/apigw_route.cue +++ b/system/apigw_route.cue @@ -11,19 +11,19 @@ apigw_route: { model: { attributes: { - id: schema.IdField - endpoint: {sortable: true} - method: {sortable: true} - enabled: {sortable: true, goType: "bool"} - group: {sortable: true, goType: "uint64", storeIdent: "rel_group"} - meta: {goType: "types.ApigwRouteMeta"} + id: schema.IdField + endpoint: {sortable: true} + method: {sortable: true} + enabled: {sortable: true, goType: "bool"} + group: {sortable: true, goType: "uint64", storeIdent: "rel_group"} + meta: {goType: "types.ApigwRouteMeta"} - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/auth_client.cue b/system/auth_client.cue index 492aacac5..999a4449f 100644 --- a/system/auth_client.cue +++ b/system/auth_client.cue @@ -23,11 +23,10 @@ auth_client: { created_at: schema.SortableTimestampField updated_at: schema.SortableTimestampNilField deleted_at: schema.SortableTimestampNilField - owned_by: { goType: "uint64" } - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } - + owned_by: schema.AttributeUserRef + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/dal_connection.cue b/system/dal_connection.cue index f18acdd81..ed472f6cd 100644 --- a/system/dal_connection.cue +++ b/system/dal_connection.cue @@ -7,19 +7,19 @@ import ( dal_connection: { model: { attributes: { - id: schema.IdField - handle: schema.HandleField - type: { sortable: true } + id: schema.IdField + handle: schema.HandleField + type: { sortable: true } - meta: { goType: "types.ConnectionMeta" } - config: { goType: "types.ConnectionConfig" } + meta: { goType: "types.ConnectionMeta" } + config: { goType: "types.ConnectionConfig" } - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/dal_sensitivity_level.cue b/system/dal_sensitivity_level.cue index 036e71446..486c59c72 100644 --- a/system/dal_sensitivity_level.cue +++ b/system/dal_sensitivity_level.cue @@ -7,17 +7,17 @@ import ( dal_sensitivity_level: { model: { attributes: { - id: schema.IdField - handle: schema.HandleField - level: { sortable: true, goType: "int" } - meta: {goType: "types.DalSensitivityLevelMeta"} + id: schema.IdField + handle: schema.HandleField + level: { sortable: true, goType: "int" } + meta: {goType: "types.DalSensitivityLevelMeta"} - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/data_privacy_request.cue b/system/data_privacy_request.cue index af2b991fd..780c5f59a 100644 --- a/system/data_privacy_request.cue +++ b/system/data_privacy_request.cue @@ -11,22 +11,22 @@ data_privacy_request: { model: { attributes: { - id: schema.IdField - kind: { goType: "types.RequestKind", sortable: true } - status: { goType: "types.RequestStatus", sortable: true } - payload: { goType: "types.DataPrivacyRequestPayloadSet" } + id: schema.IdField + kind: { goType: "types.RequestKind", sortable: true } + status: { goType: "types.RequestStatus", sortable: true } + payload: { goType: "types.DataPrivacyRequestPayloadSet" } - requested_at: schema.SortableTimestampField - requested_by: { goType: "uint64" } - completed_at: schema.SortableTimestampNilField - completed_by: { goType: "uint64" } + requested_at: schema.SortableTimestampField + requested_by: { goType: "uint64" } + completed_at: schema.SortableTimestampNilField + completed_by: { goType: "uint64" } - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/data_privacy_request_comment.cue b/system/data_privacy_request_comment.cue index f148a798f..8a83da655 100644 --- a/system/data_privacy_request_comment.cue +++ b/system/data_privacy_request_comment.cue @@ -11,16 +11,16 @@ data_privacy_request_comment: { model: { attributes: { - id: schema.IdField - request_id: { ident: "requestID", goType: "uint64", storeIdent: "rel_request" } - comment: { goType: "string" } + id: schema.IdField + request_id: { ident: "requestID", goType: "uint64", storeIdent: "rel_request" } + comment: { goType: "string" } - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/model/all.gen.go b/system/model/all.gen.go deleted file mode 100644 index 4726f52e7..000000000 --- a/system/model/all.gen.go +++ /dev/null @@ -1,1976 +0,0 @@ -package model - -// This file is auto-generated. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// - -import ( - "github.com/cortezaproject/corteza-server/pkg/dal" - "github.com/cortezaproject/corteza-server/system/types" -) - -var ( - attachmentModel = &dal.Model{ - Ident: "attachmentModel", - - ResourceType: types.AttachmentResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "kind", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "name", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownerID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "previewUrl", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "url", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - applicationModel = &dal.Model{ - Ident: "applicationModel", - - ResourceType: types.ApplicationResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "enabled", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "name", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownerID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "unify", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "weight", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - apigwRouteModel = &dal.Model{ - Ident: "apigwRouteModel", - - ResourceType: types.ApigwRouteResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "enabled", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "endpoint", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "group", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "method", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - apigwFilterModel = &dal.Model{ - Ident: "apigwFilterModel", - - ResourceType: types.ApigwFilterResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "enabled", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "kind", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "params", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ref", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "route", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "weight", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - authClientModel = &dal.Model{ - Ident: "authClientModel", - - ResourceType: types.AuthClientResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "enabled", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "expiresAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "handle", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "redirectURI", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "scope", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "secret", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "security", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "trusted", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "validFrom", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "validGrant", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - authConfirmedClientModel = &dal.Model{ - Ident: "authConfirmedClientModel", - - ResourceType: types.AuthConfirmedClientResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "clientID", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "confirmedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "userID", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - authSessionModel = &dal.Model{ - Ident: "authSessionModel", - - ResourceType: types.AuthSessionResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "data", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "expiresAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "remoteAddr", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "userAgent", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "userID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - authOa2tokenModel = &dal.Model{ - Ident: "authOa2tokenModel", - - ResourceType: types.AuthOa2tokenResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "access", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "clientID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "code", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "data", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "expiresAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "refresh", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "remoteAddr", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "userAgent", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "userID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - credentialModel = &dal.Model{ - Ident: "credentialModel", - - ResourceType: types.CredentialResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "credentials", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "expiresAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "kind", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "label", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "lastUsedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownerID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - dataPrivacyRequestModel = &dal.Model{ - Ident: "dataPrivacyRequestModel", - - ResourceType: types.DataPrivacyRequestResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "completedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "completedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "kind", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "payload", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "requestedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "requestedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "status", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - dataPrivacyRequestCommentModel = &dal.Model{ - Ident: "dataPrivacyRequestCommentModel", - - ResourceType: types.DataPrivacyRequestCommentResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "comment", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "requestID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - queueModel = &dal.Model{ - Ident: "queueModel", - - ResourceType: types.QueueResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "consumer", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "queue", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - queueMessageModel = &dal.Model{ - Ident: "queueMessageModel", - - ResourceType: types.QueueMessageResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "created", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "payload", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "processed", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "queue", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - reminderModel = &dal.Model{ - Ident: "reminderModel", - - ResourceType: types.ReminderResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "assignedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "assignedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "assignedTo", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "dismissedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "dismissedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "payload", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "remindAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "resource", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "snoozeCount", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - reportModel = &dal.Model{ - Ident: "reportModel", - - ResourceType: types.ReportResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "blocks", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "handle", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "scenarios", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "sources", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - resourceTranslationModel = &dal.Model{ - Ident: "resourceTranslationModel", - - ResourceType: types.ResourceTranslationResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "k", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "lang", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "message", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "resource", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - roleModel = &dal.Model{ - Ident: "roleModel", - - ResourceType: types.RoleResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "archivedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "handle", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "name", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - roleMemberModel = &dal.Model{ - Ident: "roleMemberModel", - - ResourceType: types.RoleMemberResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "roleID", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "userID", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - settingValueModel = &dal.Model{ - Ident: "settingValueModel", - - ResourceType: types.SettingValueResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "name", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownedBy", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "value", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - templateModel = &dal.Model{ - Ident: "templateModel", - - ResourceType: types.TemplateResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "handle", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "language", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "lastUsedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "ownerID", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "partial", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "template", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "type", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - userModel = &dal.Model{ - Ident: "userModel", - - ResourceType: types.UserResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "email", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "emailConfirmed", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "handle", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "kind", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "name", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "suspendedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "username", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - dalConnectionModel = &dal.Model{ - Ident: "dalConnectionModel", - - ResourceType: types.DalConnectionResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "config", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "handle", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "type", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } - - dalSensitivityLevelModel = &dal.Model{ - Ident: "dalSensitivityLevelModel", - - ResourceType: types.DalSensitivityLevelResourceType, - Attributes: dal.AttributeSet{ - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "createdBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "deletedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "handle", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "id", PrimaryKey: true, - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "level", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "meta", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedAt", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - - // &dal.Attribute{Ident: "id", PrimaryKey: true, Store: &dal.CodecPlain{}, Type: &dal.TypeID{}}, - &dal.Attribute{ - Ident: "updatedBy", - Store: &dal.CodecPlain{}, - Type: &dal.TypeID{}, - }, - }, - } -) - -// Attachment returns attachmentModel -// -// This function is auto-generated -func Attachment() *dal.Model { - return attachmentModel -} - -// Application returns applicationModel -// -// This function is auto-generated -func Application() *dal.Model { - return applicationModel -} - -// ApigwRoute returns apigwRouteModel -// -// This function is auto-generated -func ApigwRoute() *dal.Model { - return apigwRouteModel -} - -// ApigwFilter returns apigwFilterModel -// -// This function is auto-generated -func ApigwFilter() *dal.Model { - return apigwFilterModel -} - -// AuthClient returns authClientModel -// -// This function is auto-generated -func AuthClient() *dal.Model { - return authClientModel -} - -// AuthConfirmedClient returns authConfirmedClientModel -// -// This function is auto-generated -func AuthConfirmedClient() *dal.Model { - return authConfirmedClientModel -} - -// AuthSession returns authSessionModel -// -// This function is auto-generated -func AuthSession() *dal.Model { - return authSessionModel -} - -// AuthOa2token returns authOa2tokenModel -// -// This function is auto-generated -func AuthOa2token() *dal.Model { - return authOa2tokenModel -} - -// Credential returns credentialModel -// -// This function is auto-generated -func Credential() *dal.Model { - return credentialModel -} - -// DataPrivacyRequest returns dataPrivacyRequestModel -// -// This function is auto-generated -func DataPrivacyRequest() *dal.Model { - return dataPrivacyRequestModel -} - -// DataPrivacyRequestComment returns dataPrivacyRequestCommentModel -// -// This function is auto-generated -func DataPrivacyRequestComment() *dal.Model { - return dataPrivacyRequestCommentModel -} - -// Queue returns queueModel -// -// This function is auto-generated -func Queue() *dal.Model { - return queueModel -} - -// QueueMessage returns queueMessageModel -// -// This function is auto-generated -func QueueMessage() *dal.Model { - return queueMessageModel -} - -// Reminder returns reminderModel -// -// This function is auto-generated -func Reminder() *dal.Model { - return reminderModel -} - -// Report returns reportModel -// -// This function is auto-generated -func Report() *dal.Model { - return reportModel -} - -// ResourceTranslation returns resourceTranslationModel -// -// This function is auto-generated -func ResourceTranslation() *dal.Model { - return resourceTranslationModel -} - -// Role returns roleModel -// -// This function is auto-generated -func Role() *dal.Model { - return roleModel -} - -// RoleMember returns roleMemberModel -// -// This function is auto-generated -func RoleMember() *dal.Model { - return roleMemberModel -} - -// SettingValue returns settingValueModel -// -// This function is auto-generated -func SettingValue() *dal.Model { - return settingValueModel -} - -// Template returns templateModel -// -// This function is auto-generated -func Template() *dal.Model { - return templateModel -} - -// User returns userModel -// -// This function is auto-generated -func User() *dal.Model { - return userModel -} - -// DalConnection returns dalConnectionModel -// -// This function is auto-generated -func DalConnection() *dal.Model { - return dalConnectionModel -} - -// DalSensitivityLevel returns dalSensitivityLevelModel -// -// This function is auto-generated -func DalSensitivityLevel() *dal.Model { - return dalSensitivityLevelModel -} diff --git a/system/model/models.gen.go b/system/model/models.gen.go new file mode 100644 index 000000000..1c0ca77e5 --- /dev/null +++ b/system/model/models.gen.go @@ -0,0 +1,2695 @@ +package model + +// This file is auto-generated. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +import ( + "context" + "github.com/cortezaproject/corteza-server/pkg/dal" + "github.com/cortezaproject/corteza-server/system/types" +) + +type ( + modelReplacer interface { + ReplaceModel(ctx context.Context, model *dal.Model) (err error) + } +) + +var ( + Attachment = &dal.Model{ + Ident: "attachments", + ResourceType: types.AttachmentResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "OwnerID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_owner"}, + }, + + &dal.Attribute{ + Ident: "Kind", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "kind"}, + }, + + &dal.Attribute{ + Ident: "Url", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "url"}, + }, + + &dal.Attribute{ + Ident: "PreviewUrl", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "preview_url"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + Application = &dal.Model{ + Ident: "applications", + ResourceType: types.ApplicationResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "OwnerID", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_owner"}, + }, + + &dal.Attribute{ + Ident: "Enabled", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "enabled"}, + }, + + &dal.Attribute{ + Ident: "Weight", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "weight"}, + }, + + &dal.Attribute{ + Ident: "Unify", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "unify"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + ApigwRoute = &dal.Model{ + Ident: "apigw_routes", + ResourceType: types.ApigwRouteResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Endpoint", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "endpoint"}, + }, + + &dal.Attribute{ + Ident: "Method", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "method"}, + }, + + &dal.Attribute{ + Ident: "Enabled", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "enabled"}, + }, + + &dal.Attribute{ + Ident: "Group", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_group"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + ApigwFilter = &dal.Model{ + Ident: "apigw_filters", + ResourceType: types.ApigwFilterResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Route", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_route"}, + }, + + &dal.Attribute{ + Ident: "Weight", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "weight"}, + }, + + &dal.Attribute{ + Ident: "Ref", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "ref"}, + }, + + &dal.Attribute{ + Ident: "Kind", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "kind"}, + }, + + &dal.Attribute{ + Ident: "Enabled", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "enabled"}, + }, + + &dal.Attribute{ + Ident: "Params", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "params"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + AuthClient = &dal.Model{ + Ident: "auth_clients", + ResourceType: types.AuthClientResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Secret", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "secret"}, + }, + + &dal.Attribute{ + Ident: "Scope", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "scope"}, + }, + + &dal.Attribute{ + Ident: "ValidGrant", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "valid_grant"}, + }, + + &dal.Attribute{ + Ident: "RedirectURI", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "redirect_uri"}, + }, + + &dal.Attribute{ + Ident: "Enabled", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "enabled"}, + }, + + &dal.Attribute{ + Ident: "Trusted", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "trusted"}, + }, + + &dal.Attribute{ + Ident: "ValidFrom", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "valid_from"}, + }, + + &dal.Attribute{ + Ident: "ExpiresAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "expires_at"}, + }, + + &dal.Attribute{ + Ident: "Security", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "security"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "OwnedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "owned_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + AuthConfirmedClient = &dal.Model{ + Ident: "auth_confirmed_clients", + ResourceType: types.AuthConfirmedClientResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "UserID", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_user"}, + }, + + &dal.Attribute{ + Ident: "ClientID", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_client"}, + }, + + &dal.Attribute{ + Ident: "ConfirmedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "confirmed_at"}, + }, + }, + } + + AuthSession = &dal.Model{ + Ident: "auth_sessions", + ResourceType: types.AuthSessionResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Data", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "data"}, + }, + + &dal.Attribute{ + Ident: "UserID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_user"}, + }, + + &dal.Attribute{ + Ident: "ExpiresAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "expires_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "RemoteAddr", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "remote_addr"}, + }, + + &dal.Attribute{ + Ident: "UserAgent", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "user_agent"}, + }, + }, + } + + AuthOa2token = &dal.Model{ + Ident: "auth_oa2tokens", + ResourceType: types.AuthOa2tokenResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Code", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "code"}, + }, + + &dal.Attribute{ + Ident: "Access", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "access"}, + }, + + &dal.Attribute{ + Ident: "Refresh", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "refresh"}, + }, + + &dal.Attribute{ + Ident: "ExpiresAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "expires_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "Data", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "data"}, + }, + + &dal.Attribute{ + Ident: "ClientID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_client"}, + }, + + &dal.Attribute{ + Ident: "UserID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_user"}, + }, + + &dal.Attribute{ + Ident: "RemoteAddr", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "remote_addr"}, + }, + + &dal.Attribute{ + Ident: "UserAgent", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "user_agent"}, + }, + }, + } + + Credential = &dal.Model{ + Ident: "credentials", + ResourceType: types.CredentialResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "OwnerID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_owner"}, + }, + + &dal.Attribute{ + Ident: "Kind", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "kind"}, + }, + + &dal.Attribute{ + Ident: "Label", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "label"}, + }, + + &dal.Attribute{ + Ident: "Credentials", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "credentials"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "LastUsedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "last_used_at"}, + }, + + &dal.Attribute{ + Ident: "ExpiresAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "expires_at"}, + }, + }, + } + + DataPrivacyRequest = &dal.Model{ + Ident: "data_privacy_requests", + ResourceType: types.DataPrivacyRequestResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Kind", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "kind"}, + }, + + &dal.Attribute{ + Ident: "Status", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "status"}, + }, + + &dal.Attribute{ + Ident: "Payload", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "payload"}, + }, + + &dal.Attribute{ + Ident: "RequestedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "requested_at"}, + }, + + &dal.Attribute{ + Ident: "RequestedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "requested_by"}, + }, + + &dal.Attribute{ + Ident: "CompletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "completed_at"}, + }, + + &dal.Attribute{ + Ident: "CompletedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "completed_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + DataPrivacyRequestComment = &dal.Model{ + Ident: "data_privacy_request_comments", + ResourceType: types.DataPrivacyRequestCommentResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "RequestID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_request"}, + }, + + &dal.Attribute{ + Ident: "Comment", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "comment"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + Queue = &dal.Model{ + Ident: "queue_settings", + ResourceType: types.QueueResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Consumer", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "consumer"}, + }, + + &dal.Attribute{ + Ident: "Queue", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "queue"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + QueueMessage = &dal.Model{ + Ident: "queue_messages", + ResourceType: types.QueueMessageResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Queue", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "queue"}, + }, + + &dal.Attribute{ + Ident: "Payload", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "payload"}, + }, + + &dal.Attribute{ + Ident: "Processed", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "processed"}, + }, + + &dal.Attribute{ + Ident: "Created", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "created"}, + }, + }, + } + + Reminder = &dal.Model{ + Ident: "reminders", + ResourceType: types.ReminderResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Resource", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "resource"}, + }, + + &dal.Attribute{ + Ident: "Payload", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "payload"}, + }, + + &dal.Attribute{ + Ident: "SnoozeCount", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "snooze_count"}, + }, + + &dal.Attribute{ + Ident: "AssignedTo", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "assigned_to"}, + }, + + &dal.Attribute{ + Ident: "AssignedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "assigned_by"}, + }, + + &dal.Attribute{ + Ident: "AssignedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "assigned_at"}, + }, + + &dal.Attribute{ + Ident: "DismissedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "dismissed_by"}, + }, + + &dal.Attribute{ + Ident: "DismissedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "dismissed_at"}, + }, + + &dal.Attribute{ + Ident: "RemindAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "remind_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + }, + } + + Report = &dal.Model{ + Ident: "reports", + ResourceType: types.ReportResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Scenarios", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "scenarios"}, + }, + + &dal.Attribute{ + Ident: "Sources", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "sources"}, + }, + + &dal.Attribute{ + Ident: "Blocks", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "blocks"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "OwnedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "owned_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + ResourceTranslation = &dal.Model{ + Ident: "resource_translations", + ResourceType: types.ResourceTranslationResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Lang", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "lang"}, + }, + + &dal.Attribute{ + Ident: "Resource", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "resource"}, + }, + + &dal.Attribute{ + Ident: "K", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "k"}, + }, + + &dal.Attribute{ + Ident: "Message", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "message"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "OwnedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "owned_by"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + Role = &dal.Model{ + Ident: "roles", + ResourceType: types.RoleResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "ArchivedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "archived_at"}, + }, + }, + } + + RoleMember = &dal.Model{ + Ident: "role_members", + ResourceType: types.RoleMemberResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "UserID", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_user"}, + }, + + &dal.Attribute{ + Ident: "RoleID", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_role"}, + }, + }, + } + + SettingValue = &dal.Model{ + Ident: "settings", + ResourceType: types.SettingValueResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "Name", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "OwnedBy", + + PrimaryKey: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_owner"}, + }, + + &dal.Attribute{ + Ident: "Value", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "value"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + }, + } + + Template = &dal.Model{ + Ident: "templates", + ResourceType: types.TemplateResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Language", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "language"}, + }, + + &dal.Attribute{ + Ident: "Type", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "type"}, + }, + + &dal.Attribute{ + Ident: "Partial", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "partial"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Template", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "template"}, + }, + + &dal.Attribute{ + Ident: "OwnerID", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "rel_owner"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "LastUsedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "last_used_at"}, + }, + }, + } + + User = &dal.Model{ + Ident: "users", + ResourceType: types.UserResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Email", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "email"}, + }, + + &dal.Attribute{ + Ident: "EmailConfirmed", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "email_confirmed"}, + }, + + &dal.Attribute{ + Ident: "Username", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "username"}, + }, + + &dal.Attribute{ + Ident: "Name", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "name"}, + }, + + &dal.Attribute{ + Ident: "Kind", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "kind"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "SuspendedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "suspended_at"}, + }, + }, + } + + DalConnection = &dal.Model{ + Ident: "dal_connections", + ResourceType: types.DalConnectionResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Type", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "type"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "Config", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "config"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } + + DalSensitivityLevel = &dal.Model{ + Ident: "dal_sensitivity_levels", + ResourceType: types.DalSensitivityLevelResourceType, + + Attributes: dal.AttributeSet{ + + &dal.Attribute{ + Ident: "ID", + + PrimaryKey: true, + + Type: dal.TypeID{}, + + Store: &dal.CodecAlias{Ident: "id"}, + }, + + &dal.Attribute{ + Ident: "Handle", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "handle"}, + }, + + &dal.Attribute{ + Ident: "Level", + + Sortable: true, + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "level"}, + }, + + &dal.Attribute{ + Ident: "Meta", + + Type: dal.TypeText{}, + + Store: &dal.CodecAlias{Ident: "meta"}, + }, + + &dal.Attribute{ + Ident: "CreatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{}, + + Store: &dal.CodecAlias{Ident: "created_at"}, + }, + + &dal.Attribute{ + Ident: "UpdatedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "updated_at"}, + }, + + &dal.Attribute{ + Ident: "DeletedAt", + + Sortable: true, + + Type: dal.TypeTimestamp{ + Nullable: true, + }, + + Store: &dal.CodecAlias{Ident: "deleted_at"}, + }, + + &dal.Attribute{ + Ident: "CreatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "created_by"}, + }, + + &dal.Attribute{ + Ident: "UpdatedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "updated_by"}, + }, + + &dal.Attribute{ + Ident: "DeletedBy", + + Type: dal.TypeRef{ + + RefAttribute: "id", + RefModel: &dal.ModelRef{ + ResourceType: "corteza::system:user", + }, + }, + + Store: &dal.CodecAlias{Ident: "deleted_by"}, + }, + }, + } +) + +func Register(ctx context.Context, mr modelReplacer) (err error) { + if err = mr.ReplaceModel(ctx, Attachment); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Application); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, ApigwRoute); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, ApigwFilter); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, AuthClient); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, AuthConfirmedClient); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, AuthSession); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, AuthOa2token); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Credential); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, DataPrivacyRequest); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, DataPrivacyRequestComment); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Queue); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, QueueMessage); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Reminder); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Report); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, ResourceTranslation); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Role); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, RoleMember); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, SettingValue); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, Template); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, User); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, DalConnection); err != nil { + return + } + + if err = mr.ReplaceModel(ctx, DalSensitivityLevel); err != nil { + return + } + + return +} diff --git a/system/queue.cue b/system/queue.cue index 04da864c2..063b16be4 100644 --- a/system/queue.cue +++ b/system/queue.cue @@ -12,17 +12,17 @@ queue: { model: { ident: "queue_settings" attributes: { - id: schema.IdField - consumer: {sortable: true, goType: "string"} - queue: {sortable: true, goType: "string"} - meta: {goType: "types.QueueMeta"} + id: schema.IdField + consumer: {sortable: true, goType: "string"} + queue: {sortable: true, goType: "string"} + meta: {goType: "types.QueueMeta"} - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/report.cue b/system/report.cue index 875c6e2eb..417976d30 100644 --- a/system/report.cue +++ b/system/report.cue @@ -18,10 +18,10 @@ report: { created_at: schema.SortableTimestampField updated_at: schema.SortableTimestampNilField deleted_at: schema.SortableTimestampNilField - owned_by: { goType: "uint64" } - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + owned_by: schema.AttributeUserRef + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } } diff --git a/system/resource_translation.cue b/system/resource_translation.cue index b836d5631..4c164f419 100644 --- a/system/resource_translation.cue +++ b/system/resource_translation.cue @@ -12,19 +12,19 @@ resource_translation: { model: { attributes: { - id: schema.IdField - lang: { goType: "types.Lang" } - resource: {} - k: {} - message: {} + id: schema.IdField + lang: { goType: "types.Lang" } + resource: {} + k: {} + message: {} - created_at: schema.SortableTimestampField - updated_at: schema.SortableTimestampNilField - deleted_at: schema.SortableTimestampNilField - owned_by: { goType: "uint64" } - created_by: { goType: "uint64" } - updated_by: { goType: "uint64" } - deleted_by: { goType: "uint64" } + created_at: schema.SortableTimestampField + updated_at: schema.SortableTimestampNilField + deleted_at: schema.SortableTimestampNilField + owned_by: schema.AttributeUserRef + created_by: schema.AttributeUserRef + updated_by: schema.AttributeUserRef + deleted_by: schema.AttributeUserRef } }