You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, this group is amazing. I get so many great ideas by browsing this discussion section weekly.
I am trying to just auto increment a property on a table. I would like to auto increment the appId starting at one on entity creation. Is this possible through this library? you see the below entity as an example.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First, this group is amazing. I get so many great ideas by browsing this discussion section weekly.
I am trying to just auto increment a property on a table. I would like to auto increment the appId starting at one on entity creation. Is this possible through this library? you see the below entity as an example.
export const Application = new Entity(
{
model: {
entity: 'application',
version: '1',
service: 'rva',
},
attributes: {
id: { type: 'string', default: () => ulid(), validate: Match.ulid },
tenantId: { type: 'string', label: 'tenant#', required: true, readOnly: true },
appId: { type: 'number', required: true },
dimensions: { type: 'list', items: { type: 'string' } },
entityType: { type: 'string', default: 'Application' },
name: { type: 'string', required: true, validate: Match.name },
description: { type: 'string', required: true },
status: { type: ['active', 'disabled'], required: true, default: 'active' } as const,
createdAt: { type: 'string', readOnly: true, required: true, default: () => new Date().toISOString(), set: () => new Date().toISOString() },
updatedAt: { type: 'string', watch: '*', required: true, default: () => new Date().toISOString(), set: () => new Date().toISOString() },
},
indexes: {
byTenant: {
pk: {
field: 'pk',
composite: ['tenantId'],
},
sk: {
field: 'sk',
composite: ['appId'],
},
},
byAppId: {
index: 'gs1',
pk: {
field: 'gs1pk',
composite: ['appId'],
},
sk: {
field: 'gs1sk',
composite: [],
},
},
},
},
{ table, client },
)
Beta Was this translation helpful? Give feedback.
All reactions