From 89eefa5bc26d94ad46a565bbd6d5a4b10239ffbe Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Mon, 1 Aug 2022 19:01:19 +0200 Subject: [PATCH] Use model/attribute terminology in CUE files --- app/resources.cue | 18 +++++++++--------- automation/session.cue | 4 ++-- automation/trigger.cue | 4 ++-- automation/workflow.cue | 4 ++-- codegen/schema/{struct.cue => model.cue} | 18 +++++++++--------- codegen/schema/resource.cue | 6 +++--- codegen/server.store.cue | 24 ++++++++++++------------ compose/attachment.cue | 4 ++-- compose/chart.cue | 4 ++-- compose/module.cue | 4 ++-- compose/module_field.cue | 4 ++-- compose/namespace.cue | 4 ++-- compose/page.cue | 4 ++-- compose/record.cue | 4 ++-- federation/module_exposed.cue | 4 ++-- federation/module_mapping.cue | 4 ++-- federation/node.cue | 4 ++-- federation/node_sync.cue | 4 ++-- federation/shared_module.cue | 4 ++-- system/apigw_filter.cue | 4 ++-- system/apigw_route.cue | 4 ++-- system/application.cue | 4 ++-- system/attachment.cue | 4 ++-- system/auth_client.cue | 4 ++-- system/auth_confirmed_client.cue | 4 ++-- system/auth_oa2token.cue | 4 ++-- system/auth_session.cue | 4 ++-- system/credential.cue | 4 ++-- system/dal_connection.cue | 4 ++-- system/dal_sensitivity_level.cue | 4 ++-- system/data_privacy_request.cue | 4 ++-- system/data_privacy_request_comment.cue | 4 ++-- system/queue.cue | 4 ++-- system/queue_message.cue | 4 ++-- system/reminder.cue | 4 ++-- system/report.cue | 4 ++-- system/resource_translation.cue | 4 ++-- system/role.cue | 4 ++-- system/role_member.cue | 4 ++-- system/settings.cue | 4 ++-- system/template.cue | 4 ++-- system/user.cue | 4 ++-- 42 files changed, 109 insertions(+), 109 deletions(-) rename codegen/schema/{struct.cue => model.cue} (86%) diff --git a/app/resources.cue b/app/resources.cue index 3e9884fef..d24a88d07 100644 --- a/app/resources.cue +++ b/app/resources.cue @@ -24,7 +24,7 @@ resources: { features: _allFeaturesDisabled - struct: { + model: { role_id: { primaryKey: true, goType: "uint64", ident: "roleID", storeIdent: "rel_role" } resource: { primaryKey: true } operation: { primaryKey: true } @@ -67,7 +67,7 @@ resources: { features: _allFeaturesDisabled - struct: { + model: { kind: { primaryKey: true } resource_id: { primaryKey: true, goType: "uint64", ident: "resourceID", storeIdent: "rel_resource" } name: { primaryKey: true, ignoreCase: true } @@ -76,7 +76,7 @@ resources: { filter: { expIdent: "LabelFilter" - struct: { + model: { kind: {} rel_resource: { goType: "[]uint64", ident: "resourceID" } limit: { goType: "uint" } @@ -123,7 +123,7 @@ resources: { features: _allFeaturesDisabled - struct: { + model: { kind: { primaryKey: true } resource_id: { primaryKey: true, goType: "uint64", ident: "resourceID", storeIdent: "rel_resource" } owned_by: { primaryKey: true, goType: "uint64" } @@ -133,7 +133,7 @@ resources: { filter: { expIdent: "FlagFilter" - struct: { + model: { kind: {} resource_id: { goType: "[]uint64", ident: "resourceID", storeIdent: "rel_resource" } owned_by: { goType: "[]uint64", ident: "ownedBy" } @@ -173,7 +173,7 @@ resources: { checkFn: false } - struct: { + model: { id: schema.IdField timestamp: schema.SortableTimestampField & { storeIdent: "ts" } request_origin: {} @@ -190,7 +190,7 @@ resources: { filter: { expIdent: "Filter" - struct: { + model: { from_timestamp: { goType: "*time.Time" } to_timestamp: { goType: "*time.Time" } before_action_id: { goType: "uint64", ident: "beforeActionID" } @@ -240,7 +240,7 @@ resources: { features: _allFeaturesDisabled - struct: { + model: { id: schema.IdField timestamp: schema.SortableTimestampField & { storeIdent: "ts" } resource_type: {} @@ -251,7 +251,7 @@ resources: { filter: { expIdent: "ResourceActivityFilter" - struct: { + model: { from_timestamp: { goType: "*time.Time" } to_timestamp: { goType: "*time.Time" } } diff --git a/automation/session.cue b/automation/session.cue index c2bb7e7c2..9e67f0ee2 100644 --- a/automation/session.cue +++ b/automation/session.cue @@ -9,7 +9,7 @@ session: { labels: false } - struct: { + model: { id: schema.IdField workflow_id: { sortable: true, ident: "workflowID", goType: "uint64", storeIdent: "rel_workflow" } event_type: { sortable: true, goType: "string" } @@ -28,7 +28,7 @@ session: { } filter: { - struct: { + model: { session_id: { goType: "[]uint64", storeIdent: "id", ident: "sessionID" } completed: { schema.SortableTimestampNilField, storeIdent: "completed_at" } created_by: { goType: "[]uint64" } diff --git a/automation/trigger.cue b/automation/trigger.cue index 627857044..48f5b1122 100644 --- a/automation/trigger.cue +++ b/automation/trigger.cue @@ -5,7 +5,7 @@ import ( ) trigger: { - struct: { + model: { id: schema.IdField workflow_id: { sortable: true, ident: "workflowID", goType: "uint64", storeIdent: "rel_workflow" } step_id: { ident: "stepID", goType: "uint64", storeIdent: "rel_step" } @@ -26,7 +26,7 @@ trigger: { } filter: { - struct: { + model: { deleted: { goType: "filter.State", storeIdent: "deleted_at" } disabled: { goType: "filter.State", storeIdent: "enabled" } trigger_id: { goType: "[]uint64", ident: "triggerID", storeIdent: "id" } diff --git a/automation/workflow.cue b/automation/workflow.cue index cc7d232e7..c57feb277 100644 --- a/automation/workflow.cue +++ b/automation/workflow.cue @@ -5,7 +5,7 @@ import ( ) workflow: { - struct: { + model: { id: schema.IdField handle: schema.HandleField meta: { goType: "*types.WorkflowMeta" } @@ -28,7 +28,7 @@ workflow: { } filter: { - struct: { + model: { deleted: { goType: "filter.State", storeIdent: "deleted_at" } disabled: { goType: "filter.State", storeIdent: "enabled" } } diff --git a/codegen/schema/struct.cue b/codegen/schema/model.cue similarity index 86% rename from codegen/schema/struct.cue rename to codegen/schema/model.cue index 3f4be5ccb..4a6f2155d 100644 --- a/codegen/schema/struct.cue +++ b/codegen/schema/model.cue @@ -4,13 +4,13 @@ import ( "strings" ) -#Struct: { +#Model: { // Each field can be - [name=_]: {"name": name} & #StructField + [name=_]: {"name": name} & #ModelAttribute } // logic in struct fields is a bit different -#StructField: { +#ModelAttribute: { name: #ident _words: strings.Replace(strings.Replace(name, "_", " ", -1), ".", " ", -1) @@ -35,10 +35,10 @@ import ( primaryKey: bool | *false ignoreCase: bool | *false - #StructJsonTag + #ModelAttributeJsonTag } -IdField: #StructField & { +IdField: #ModelAttribute & { // Expecting ID field to always have name ID name: "id" expIdent: "ID" @@ -49,7 +49,7 @@ IdField: #StructField & { goType: "uint64" } -HandleField: #StructField & { +HandleField: #ModelAttribute & { // Expecting ID field to always have name handle name: "handle" unique: true @@ -58,17 +58,17 @@ HandleField: #StructField & { goType: "string" } -SortableTimestampField: #StructField & { +SortableTimestampField: #ModelAttribute & { sortable: true goType: "time.Time" } -SortableTimestampNilField: #StructField & { +SortableTimestampNilField: #ModelAttribute & { sortable: true goType: "*time.Time" } -#StructJsonTag: { +#ModelAttributeJsonTag: { name: string _specs: {field: string | *name, omitEmpty: bool | *false, "string": bool | *false} diff --git a/codegen/schema/resource.cue b/codegen/schema/resource.cue index 50a210f15..6e1624f31 100644 --- a/codegen/schema/resource.cue +++ b/codegen/schema/resource.cue @@ -18,11 +18,11 @@ import ( // Fully qualified resource name fqrn: string | *(platform + "::" + component + ":" + handle) - struct: #Struct + model: #Model filter: { "expIdent": #expIdent | *"\(expIdent)Filter" - struct: #Struct + model: #Model // generate filtering by-nil-state for the specified fields "byNilState": [...string] @@ -86,7 +86,7 @@ import ( api?: { lookups: [...{ - _expFields: [ for f in fields {strings.ToTitle(struct[f].expIdent)}] + _expFields: [ for f in fields {strings.ToTitle(model[f].expIdent)}] "expIdent": "Lookup\(store.expIdent)By" + strings.Join(_expFields, "") description: string | *"" diff --git a/codegen/server.store.cue b/codegen/server.store.cue index 44c008f3b..a7007551b 100644 --- a/codegen/server.store.cue +++ b/codegen/server.store.cue @@ -20,7 +20,7 @@ _StoreResource: { goSetType: "\(typePkg).\(res.expIdent)Set" goFilterType: "\(typePkg).\(res.filter.expIdent)" - struct: [ for f in res.struct if f.store { + struct: [ for f in res.model if f.store { "ident": f.ident "expIdent": f.expIdent "storeIdent": f.storeIdent @@ -32,17 +32,17 @@ _StoreResource: { filter: { // query fields as defined in struct - "query": [ for name in res.filter.query {res.struct[name]}], + "query": [ for name in res.filter.query {res.model[name]}], // filter by nil state as defined in filter - "byNilState": [ for name in res.filter.byNilState {res.filter.struct[name]}] + "byNilState": [ for name in res.filter.byNilState {res.filter.model[name]}] // filter by false as defined in filter - "byFalseState": [ for name in res.filter.byFalseState {res.filter.struct[name]}] + "byFalseState": [ for name in res.filter.byFalseState {res.filter.model[name]}] // filter by value as defined in filter // @todo this should be pulled from the struct - "byValue": [ for name in res.filter.byValue {res.filter.struct[name]}] + "byValue": [ for name in res.filter.byValue {res.filter.model[name]}] "byLabel": res.features.labels "byFlag": res.features.flags } @@ -67,7 +67,7 @@ _StoreResource: { } deleteByPK: { - primaryKeys: [ for f in res.struct if f.primaryKey {f} ] + primaryKeys: [ for f in res.model if f.primaryKey {f} ] _pkExpNames: strings.Join([ for f in primaryKeys { f.expIdent } ], "") "expFnIdent": "Delete\(res.store.expIdent)By\(_pkExpNames)" } @@ -85,7 +85,7 @@ _StoreResource: { // Copy all relevant fields from the struct "args": [ for name in l.fields { - let f = res.struct[name] + let f = res.model[name] "ident": f.ident "storeIdent": f.storeIdent @@ -126,7 +126,7 @@ _StoreResource: { "fnIdent": "sortable\(expIdent)Fields" fields: { - for f in res.struct if f.sortable || f.unique || f.primaryKey { + for f in res.model if f.sortable || f.unique || f.primaryKey { { "\(strings.ToLower(f.name))": f.name "\(strings.ToLower(f.ident))": f.name @@ -140,8 +140,8 @@ _StoreResource: { "fnIdent": "collect\(expIdent)CursorValues" - fields: [ for f in res.struct if f.sortable || f.unique || f.primaryKey {f} ] - primaryKeys: [ for f in res.struct if f.primaryKey {f} ] + fields: [ for f in res.model if f.sortable || f.unique || f.primaryKey {f} ] + primaryKeys: [ for f in res.model if f.primaryKey {f} ] } checkConstraints: { @@ -152,9 +152,9 @@ _StoreResource: { checks: [ for lookup in res.store.api.lookups if lookup.constraintCheck { lookupFnIdent: lookup.expIdent - fields: [ for name in lookup.fields {res.struct[name]}] + fields: [ for name in lookup.fields {res.model[name]}] nullConstraint: [ - for f in res.struct if list.Contains(lookup.nullConstraint, f.name) { + for f in res.model if list.Contains(lookup.nullConstraint, f.name) { "expIdent": f.expIdent }, ] diff --git a/compose/attachment.cue b/compose/attachment.cue index c1f07d7cd..0d3db9836 100644 --- a/compose/attachment.cue +++ b/compose/attachment.cue @@ -9,7 +9,7 @@ attachment: { labels: false } - struct: { + model: { 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" } @@ -24,7 +24,7 @@ attachment: { } filter: { - struct: { + model: { kind: {} namespace_id: { goType: "uint64", ident: "namespaceID" } page_id: { goType: "uint64", ident: "pageID" } diff --git a/compose/chart.cue b/compose/chart.cue index 68b22fd7f..79b44c8d0 100644 --- a/compose/chart.cue +++ b/compose/chart.cue @@ -9,7 +9,7 @@ chart: { {handle: "namespace"}, ] - struct: { + model: { id: schema.IdField handle: schema.HandleField name: {sortable: true} @@ -22,7 +22,7 @@ chart: { } filter: { - struct: { + model: { chart_id: { goType: "[]uint64", ident: "chartID", storeIdent: "id" } namespace_id: { goType: "uint64", ident: "namespaceID", storeIdent: "rel_namespace" } handle: { goType: "string" } diff --git a/compose/module.cue b/compose/module.cue index df577c9ba..c5071c883 100644 --- a/compose/module.cue +++ b/compose/module.cue @@ -10,7 +10,7 @@ module: { {handle: "namespace"}, ] - struct: { + model: { id: schema.IdField handle: schema.HandleField meta: { goType: "rawJson" } @@ -25,7 +25,7 @@ module: { } filter: { - struct: { + model: { module_id: { goType: "[]uint64", ident: "moduleID", storeIdent: "id" } namespace_id: { goType: "uint64", ident: "namespaceID", storeIdent: "rel_namespace" } handle: { goType: "string" } diff --git a/compose/module_field.cue b/compose/module_field.cue index f78d1193f..da38e863c 100644 --- a/compose/module_field.cue +++ b/compose/module_field.cue @@ -10,7 +10,7 @@ moduleField: { {handle: "module"}, ] - struct: { + model: { id: schema.IdField namespace_id: { ident: "namespaceID", goType: "uint64", store: false } module_id: { sortable: true, ident: "moduleID", goType: "uint64", storeIdent: "rel_module" } @@ -30,7 +30,7 @@ moduleField: { } filter: { - struct: { + model: { module_id: { goType: "[]uint64", ident: "moduleID", storeIdent: "rel_module" } deleted: { goType: "filter.State", storeIdent: "deleted_at" } } diff --git a/compose/namespace.cue b/compose/namespace.cue index de8d1ba9e..3f69ecba0 100644 --- a/compose/namespace.cue +++ b/compose/namespace.cue @@ -5,7 +5,7 @@ import ( ) namespace: { - struct: { + model: { id: schema.IdField slug: { sortable: true, goType: "string" } enabled: { goType: "bool" } @@ -18,7 +18,7 @@ namespace: { } filter: { - struct: { + model: { namespace_id: { goType: "[]uint64", ident: "namespaceID" } slug: { goType: "string" } name: { goType: "string" } diff --git a/compose/page.cue b/compose/page.cue index 10d8f4982..39e5c4fdf 100644 --- a/compose/page.cue +++ b/compose/page.cue @@ -9,7 +9,7 @@ page: { {handle: "namespace"}, ] - struct: { + model: { id: schema.IdField self_id: { sortable: true, ident: "selfID", goType: "uint64" } module_id: { sortable: true, ident: "moduleID", goType: "uint64", storeIdent: "rel_module" } @@ -29,7 +29,7 @@ page: { } filter: { - struct: { + model: { namespace_id: { goType: "uint64", ident: "namespaceID", storeIdent: "rel_namespace" } parent_id: { goType: "uint64", ident: "parentID" } module_id: { goType: "uint64", ident: "moduleID", storeIdent: "rel_module" } diff --git a/compose/record.cue b/compose/record.cue index 9ae9208f4..8737b0929 100644 --- a/compose/record.cue +++ b/compose/record.cue @@ -10,7 +10,7 @@ record: { {handle: "module"}, ] - struct: { + model: { id: schema.IdField module_id: { ident: "moduleID", goType: "uint64" } module: { goType: "*types.Module", store: false } @@ -27,7 +27,7 @@ record: { } filter: { - struct: { + model: { module_id: { goType: "uint64" } namespace_id: { goType: "uint64" } query: { goType: "string" } diff --git a/federation/module_exposed.cue b/federation/module_exposed.cue index 215aad812..a30d54111 100644 --- a/federation/module_exposed.cue +++ b/federation/module_exposed.cue @@ -13,7 +13,7 @@ exposedModule: { labels: false } - struct: { + model: { id: schema.IdField handle: schema.HandleField name: { sortable: true } @@ -31,7 +31,7 @@ exposedModule: { } filter: { - struct: { + model: { node_id: { goType: "uint64", ident: "nodeID", storeIdent: "rel_node" } compose_module_id: { goType: "uint64", ident: "composeModuleID", storeIdent: "rel_compose_module" } compose_namespace_id: { goType: "uint64", ident: "composeNamespaceID", storeIdent: "rel_compose_namespace" } diff --git a/federation/module_mapping.cue b/federation/module_mapping.cue index 02ae7b336..e0ec28a5d 100644 --- a/federation/module_mapping.cue +++ b/federation/module_mapping.cue @@ -9,7 +9,7 @@ moduleMapping: { labels: false } - struct: { + model: { node_id: { ident: "nodeID", goType: "uint64", primaryKey: true, unique: true } federation_module_id: { sortable: true, ident: "federationModuleID", goType: "uint64" } compose_module_id: { sortable: true, ident: "composeModuleID", goType: "uint64" } @@ -18,7 +18,7 @@ moduleMapping: { } filter: { - struct: { + model: { compose_module_id: { goType: "uint64", ident: "composeModuleID", storeIdent: "rel_compose_module" } compose_namespace_id: { goType: "uint64", ident: "composeNamespaceID", storeIdent: "rel_compose_namespace" } federation_module_id: { goType: "uint64", ident: "federationModuleID", storeIdent: "rel_federation_module" } diff --git a/federation/node.cue b/federation/node.cue index 8a6d73efa..ca03ff332 100644 --- a/federation/node.cue +++ b/federation/node.cue @@ -11,7 +11,7 @@ node: { sorting: false } - struct: { + model: { id: schema.IdField name: {sortable: true} shared_node_id: { sortable: true, ident: "sharedNodeID", goType: "uint64" } @@ -30,7 +30,7 @@ node: { } filter: { - struct: { + model: { name: { goType: "string" } base_url: { goType: "string", ident: "baseURL" } status: { goType: "string" } diff --git a/federation/node_sync.cue b/federation/node_sync.cue index 1ed58e7f7..0c2c0a564 100644 --- a/federation/node_sync.cue +++ b/federation/node_sync.cue @@ -9,7 +9,7 @@ nodeSync: { labels: false } - struct: { + model: { node_id: { sortable: true, ident: "nodeID", goType: "uint64", primaryKey: true } module_id: { sortable: true, ident: "moduleID", goType: "uint64" } sync_type: { sortable: true, goType: "string" } @@ -19,7 +19,7 @@ nodeSync: { } filter: { - struct: { + model: { node_id: { goType: "uint64", storeIdent: "rel_node", ident: "nodeID" } module_id: { goType: "uint64", storeIdent: "rel_module", ident: "moduleID" } sync_status: { goType: "string", storeIdent: "sync_status" } diff --git a/federation/shared_module.cue b/federation/shared_module.cue index 15b326125..223eb2996 100644 --- a/federation/shared_module.cue +++ b/federation/shared_module.cue @@ -13,7 +13,7 @@ sharedModule: { {handle: "node"}, ] - struct: { + model: { id: schema.IdField handle: schema.HandleField node_id: { sortable: true, ident: "nodeID", goType: "uint64", storeIdent: "rel_node" } @@ -30,7 +30,7 @@ sharedModule: { } filter: { - struct: { + model: { node_id: { goType: "uint64", ident: "nodeID", storeIdent: "rel_node" } handle: { goType: "string" } name: { goType: "string" } diff --git a/system/apigw_filter.cue b/system/apigw_filter.cue index d6e627914..ae1a4beb2 100644 --- a/system/apigw_filter.cue +++ b/system/apigw_filter.cue @@ -9,7 +9,7 @@ apigw_filter: { labels: false } - struct: { + model: { id: schema.IdField route: { sortable: true, goType: "uint64", storeIdent: "rel_route" } weight: { sortable: true, goType: "uint64" } @@ -27,7 +27,7 @@ apigw_filter: { } filter: { - struct: { + model: { route_id: {goType: "uint64", ident: "routeID", storeIdent: "rel_route"} deleted: {goType: "filter.State", storeIdent: "deleted_at"} disabled: {goType: "filter.State", storeIdent: "enabled"} diff --git a/system/apigw_route.cue b/system/apigw_route.cue index a0dfb9662..46a853989 100644 --- a/system/apigw_route.cue +++ b/system/apigw_route.cue @@ -9,7 +9,7 @@ apigw_route: { labels: false } - struct: { + model: { id: schema.IdField endpoint: {sortable: true} method: {sortable: true} @@ -26,7 +26,7 @@ apigw_route: { } filter: { - struct: { + model: { route: {} query: {goType: "string"} diff --git a/system/application.cue b/system/application.cue index 5d9ce27c1..0fd84681e 100644 --- a/system/application.cue +++ b/system/application.cue @@ -5,7 +5,7 @@ import ( ) application: { - struct: { + model: { id: schema.IdField name: {sortable: true} owner_id: { ident: "ownerID", goType: "uint64", storeIdent: "rel_owner", sortable: true } @@ -18,7 +18,7 @@ application: { } filter: { - struct: { + model: { name: {goType: "string"} // not sure about the type of flagged_ids flagged_ids: {goType: "[]uint64"} diff --git a/system/attachment.cue b/system/attachment.cue index 5fb05b8d8..e3e0c8ba6 100644 --- a/system/attachment.cue +++ b/system/attachment.cue @@ -9,7 +9,7 @@ attachment: { labels: false } - struct: { + model: { id: schema.IdField owner_id: { sortable: true, goType: "uint64", storeIdent: "rel_owner", ident: "ownerID"} kind: {sortable: true} @@ -23,7 +23,7 @@ attachment: { } filter: { - struct: { + model: { kind: {} } diff --git a/system/auth_client.cue b/system/auth_client.cue index 7aaded9c4..1006b8677 100644 --- a/system/auth_client.cue +++ b/system/auth_client.cue @@ -5,7 +5,7 @@ import ( ) auth_client: { - struct: { + model: { id: schema.IdField handle: schema.HandleField meta: {goType: "*types.AuthClientMeta"} @@ -29,7 +29,7 @@ auth_client: { } filter: { - struct: { + model: { client_id: {goType: "[]uint64"} handle: {goType: "string"} deleted: {goType: "filter.State", storeIdent: "deleted_at"} diff --git a/system/auth_confirmed_client.cue b/system/auth_confirmed_client.cue index c1cdfb7b0..cffa4dcdc 100644 --- a/system/auth_confirmed_client.cue +++ b/system/auth_confirmed_client.cue @@ -12,14 +12,14 @@ auth_confirmed_client: { checkFn: false } - struct: { + model: { user_id: { goType: "uint64", primaryKey: true, ident: "userID", storeIdent: "rel_user" } client_id: { goType: "uint64", primaryKey: true, ident: "clientID", storeIdent: "rel_client" } confirmed_at: schema.SortableTimestampField } filter: { - struct: { + model: { user_id: { goType: "uint64", ident: "userID", storeIdent: "rel_client" } } diff --git a/system/auth_oa2token.cue b/system/auth_oa2token.cue index 89e294619..1585c0f20 100644 --- a/system/auth_oa2token.cue +++ b/system/auth_oa2token.cue @@ -12,7 +12,7 @@ auth_oa2token: { checkFn: false } - struct: { + model: { id: schema.IdField code: {} access: {} @@ -27,7 +27,7 @@ auth_oa2token: { } filter: { - struct: { + model: { user_id: { goType: "uint64", ident: "userID" } } diff --git a/system/auth_session.cue b/system/auth_session.cue index 3898507c7..b784be4b6 100644 --- a/system/auth_session.cue +++ b/system/auth_session.cue @@ -12,7 +12,7 @@ auth_session: { checkFn: false } - struct: { + model: { id: { primaryKey: true, expIdent: "ID" } data: { goType: "[]byte" } user_id: { goType: "uint64", storeIdent: "rel_user", ident: "userID"} @@ -23,7 +23,7 @@ auth_session: { } filter: { - struct: { + model: { user_id: { goType: "uint64", ident: "userID" } } diff --git a/system/credential.cue b/system/credential.cue index 21a3a268e..4d8309343 100644 --- a/system/credential.cue +++ b/system/credential.cue @@ -5,7 +5,7 @@ import ( ) credential: { - struct: { + model: { id: schema.IdField owner_id: { goType: "uint64", ident: "ownerID", storeIdent: "rel_owner" } kind: {} @@ -21,7 +21,7 @@ credential: { } filter: { - struct: { + model: { owner_id: {goType: "uint64", ident: "ownerID", storeIdent: "rel_owner"} kind: {goType: "string"} credentials: {goType: "string"} diff --git a/system/dal_connection.cue b/system/dal_connection.cue index 8462e8200..4ab1023b7 100644 --- a/system/dal_connection.cue +++ b/system/dal_connection.cue @@ -5,7 +5,7 @@ import ( ) dal_connection: { - struct: { + model: { id: schema.IdField name: { sortable: true, goType: "string" } handle: schema.HandleField @@ -29,7 +29,7 @@ dal_connection: { } filter: { - struct: { + model: { connection_id: {goType: "[]uint64", ident: "connectionID", storeIdent: "id"} handle: {goType: "string"} type: {goType: "string"} diff --git a/system/dal_sensitivity_level.cue b/system/dal_sensitivity_level.cue index 83bb2b0ef..3ef66c6db 100644 --- a/system/dal_sensitivity_level.cue +++ b/system/dal_sensitivity_level.cue @@ -5,7 +5,7 @@ import ( ) dal_sensitivity_level: { - struct: { + model: { id: schema.IdField handle: schema.HandleField level: { sortable: true, goType: "int" } @@ -20,7 +20,7 @@ dal_sensitivity_level: { } filter: { - struct: { + model: { sensitivity_level_id: {goType: "[]uint64", ident: "sensitivityLevelID", storeIdent: "id"} deleted: {goType: "filter.State", storeIdent: "deleted_at"} diff --git a/system/data_privacy_request.cue b/system/data_privacy_request.cue index b3626fcfb..ab45a7fed 100644 --- a/system/data_privacy_request.cue +++ b/system/data_privacy_request.cue @@ -9,7 +9,7 @@ data_privacy_request: { labels: false } - struct: { + model: { id: schema.IdField kind: { goType: "types.RequestKind", sortable: true } status: { goType: "types.RequestStatus", sortable: true } @@ -29,7 +29,7 @@ data_privacy_request: { } filter: { - struct: { + model: { request_id: {goType: "[]uint64", ident: "requestID", storeIdent: "id" } requested_by: {goType: "[]uint64", ident: "requestedBy" } kind: {goType: "[]types.RequestKind"} diff --git a/system/data_privacy_request_comment.cue b/system/data_privacy_request_comment.cue index 7fe66de7d..e758d6ef4 100644 --- a/system/data_privacy_request_comment.cue +++ b/system/data_privacy_request_comment.cue @@ -9,7 +9,7 @@ data_privacy_request_comment: { labels: false } - struct: { + model: { id: schema.IdField request_id: { ident: "requestID", goType: "uint64", storeIdent: "rel_request" } comment: { goType: "string" } @@ -23,7 +23,7 @@ data_privacy_request_comment: { } filter: { - struct: { + model: { request_id: {goType: "[]uint64", ident: "requestID", storeIdent: "rel_request" } } diff --git a/system/queue.cue b/system/queue.cue index e69ee9d8e..b856376e2 100644 --- a/system/queue.cue +++ b/system/queue.cue @@ -9,7 +9,7 @@ queue: { labels: false } - struct: { + model: { id: schema.IdField consumer: {sortable: true, goType: "string"} queue: {sortable: true, goType: "string"} @@ -24,7 +24,7 @@ queue: { } filter: { - struct: { + model: { query: {goType: "string"} deleted: {goType: "filter.State", storeIdent: "deleted_at"} } diff --git a/system/queue_message.cue b/system/queue_message.cue index ea260ff66..4a8825642 100644 --- a/system/queue_message.cue +++ b/system/queue_message.cue @@ -10,7 +10,7 @@ queue_message: { checkFn: false } - struct: { + model: { id: schema.IdField queue: { sortable: true } payload: { goType: "[]byte" } @@ -19,7 +19,7 @@ queue_message: { } filter: { - struct: { + model: { queue: {} processed: {goType: "filter.State", storeIdent: "processed"} } diff --git a/system/reminder.cue b/system/reminder.cue index 254edd4a1..32161db0f 100644 --- a/system/reminder.cue +++ b/system/reminder.cue @@ -9,7 +9,7 @@ reminder: { labels: false } - struct: { + model: { id: schema.IdField resource: { sortable: true } payload: { goType: "rawJson" } @@ -26,7 +26,7 @@ reminder: { } filter: { - struct: { + model: { reminder_id: {goType: "[]uint64", ident: "reminderID", storeIdent: "id"} resource: {} assigned_to: {goType: "uint64"} diff --git a/system/report.cue b/system/report.cue index 2ad2b873a..e3968a4c6 100644 --- a/system/report.cue +++ b/system/report.cue @@ -5,7 +5,7 @@ import ( ) report: { - struct: { + model: { id: schema.IdField handle: schema.HandleField meta: {goType: "*types.ReportMeta"} @@ -24,7 +24,7 @@ report: { } filter: { - struct: { + model: { report_id: {goType: "[]uint64", storeIdent: "id", ident: "reportID" } handle: {goType: "string"} deleted: {goType: "filter.State", storeIdent: "deleted_at"} diff --git a/system/resource_translation.cue b/system/resource_translation.cue index 72812072c..fc1333f4f 100644 --- a/system/resource_translation.cue +++ b/system/resource_translation.cue @@ -10,7 +10,7 @@ resource_translation: { checkFn: false } - struct: { + model: { id: schema.IdField lang: { goType: "types.Lang" } resource: {} @@ -27,7 +27,7 @@ resource_translation: { } filter: { - struct: { + model: { translation_id: {goType: "[]uint64", ident: "translationID" } lang: {} resource: {} diff --git a/system/role.cue b/system/role.cue index 8a60855b4..552310882 100644 --- a/system/role.cue +++ b/system/role.cue @@ -5,7 +5,7 @@ import ( ) role: { - struct: { + model: { id: schema.IdField name: {sortable: true} handle: schema.HandleField @@ -18,7 +18,7 @@ role: { } filter: { - struct: { + model: { role_id: {goType: "[]uint64", ident: "roleID", storeIdent: "id" } member_id: {goType: "uint64" } handle: {goType: "string"} diff --git a/system/role_member.cue b/system/role_member.cue index fb380af1c..418f1417d 100644 --- a/system/role_member.cue +++ b/system/role_member.cue @@ -8,13 +8,13 @@ role_member: { checkFn: false } - struct: { + model: { user_id: { goType: "uint64", primaryKey: true, storeIdent: "rel_user", ident: "userID" } role_id: { goType: "uint64", primaryKey: true, storeIdent: "rel_role", ident: "roleID" } } filter: { - struct: { + model: { user_id: {goType: "uint64", ident: "userID", storeIdent: "rel_user" } role_id: {goType: "uint64", ident: "roleID", storeIdent: "rel_role" } } diff --git a/system/settings.cue b/system/settings.cue index 5cdb6422c..7796c522d 100644 --- a/system/settings.cue +++ b/system/settings.cue @@ -15,7 +15,7 @@ settings: { checkFn: false } - struct: { + model: { name: { primaryKey: true, ignoreCase: true } owned_by: { primaryKey: true, goType: "uint64", storeIdent: "rel_owner" } value: { goType: "rawJson" } @@ -26,7 +26,7 @@ settings: { filter: { expIdent: "SettingsFilter" - struct: { + model: { prefix: {} owned_by: { goType: "uint64", storeIdent: "rel_owner" } } diff --git a/system/template.cue b/system/template.cue index 7e17c920e..051723378 100644 --- a/system/template.cue +++ b/system/template.cue @@ -5,7 +5,7 @@ import ( ) template: { - struct: { + model: { id: schema.IdField handle: schema.HandleField language: {sortable: true, goType: "string"} @@ -22,7 +22,7 @@ template: { } filter: { - struct: { + model: { template_id: {goType: "[]uint64", ident: "templateID", storeIdent: "id"} handle: {goType: "string"} type: {goType: "string"} diff --git a/system/user.cue b/system/user.cue index 6413870ca..3e36253bd 100644 --- a/system/user.cue +++ b/system/user.cue @@ -5,7 +5,7 @@ import ( ) user: { - struct: { + model: { id: schema.IdField handle: schema.HandleField email: {sortable: true, unique: true, ignoreCase: true} @@ -21,7 +21,7 @@ user: { } filter: { - struct: { + model: { user_id: {goType: "[]uint64", ident: "userID", storeIdent: "id"} role_id: {goType: "[]uint64", ident: "roleID"} email: {goType: "string"}