Service - Menu Config: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
https://bitbucket.org/izara-core-shared/izara-core-shared-menu-config | https://bitbucket.org/izara-core-shared/izara-core-shared-menu-config | ||
= ObjectSchema = | |||
== MenuConfig == | |||
<syntaxhighlight lang="JavaScript"> | |||
[ | |||
{ | |||
objectType: "menuConfig", | |||
storageResources: { | |||
"dynamodb": { | |||
storageType: "dynamoDB", // เปลี่ยนเป็น "dynamoDB" (capital B) | |||
tableName: "MenuConfigMain", | |||
// ลบ graphServerTag ออกสำหรับ dynamoDB | |||
} | |||
}, | |||
fieldNames: { | |||
menuConfigUuid: { | |||
type: "string", | |||
randomOnCreate: true, | |||
requiredOnCreate: false, | |||
optionalOnCreate: false, | |||
canUpdate: false, | |||
storageResourceTags: ['dynamodb'], | |||
}, | |||
useCase: { | |||
type: "string", | |||
randomOnCreate: false, | |||
requiredOnCreate: true, | |||
optionalOnCreate: false, | |||
canUpdate: false, | |||
storageResourceTags: ['dynamodb'], | |||
}, | |||
menuConfig: { | |||
type: "string", // เปลี่ยนจาก "object" เป็น "string" | |||
randomOnCreate: false, | |||
requiredOnCreate: true, | |||
optionalOnCreate: false, | |||
canUpdate: false, | |||
storageResourceTags: ['dynamodb'], | |||
}, | |||
menuConfigName: { | |||
type: "string", | |||
randomOnCreate: false, | |||
requiredOnCreate: true, | |||
optionalOnCreate: false, | |||
canUpdate: true, | |||
storageResourceTags: ['dynamodb'], | |||
}, | |||
userId: { // before put check with base-user-id or targetId | |||
type: "string", | |||
randomOnCreate: false, | |||
requiredOnCreate: true, | |||
optionalOnCreate: false, | |||
canUpdate: false, | |||
storageResourceTags: ['dynamodb'], | |||
}, | |||
}, | |||
identifiers: [ | |||
{ | |||
type: "partitionKey", | |||
fieldNames:[ "useCase","menuConfigUuid"], | |||
name:"menuConfigId" | |||
}, | |||
], | |||
}, | |||
]</syntaxhighlight> | |||
= DynamoDB tables = | = DynamoDB tables = | ||
Revision as of 02:04, 17 July 2025
Overview
Manages configuration for site menus created by users and used in different areas of the project.
Repository
https://bitbucket.org/izara-core-shared/izara-core-shared-menu-config
ObjectSchema
MenuConfig
[
{
objectType: "menuConfig",
storageResources: {
"dynamodb": {
storageType: "dynamoDB", // เปลี่ยนเป็น "dynamoDB" (capital B)
tableName: "MenuConfigMain",
// ลบ graphServerTag ออกสำหรับ dynamoDB
}
},
fieldNames: {
menuConfigUuid: {
type: "string",
randomOnCreate: true,
requiredOnCreate: false,
optionalOnCreate: false,
canUpdate: false,
storageResourceTags: ['dynamodb'],
},
useCase: {
type: "string",
randomOnCreate: false,
requiredOnCreate: true,
optionalOnCreate: false,
canUpdate: false,
storageResourceTags: ['dynamodb'],
},
menuConfig: {
type: "string", // เปลี่ยนจาก "object" เป็น "string"
randomOnCreate: false,
requiredOnCreate: true,
optionalOnCreate: false,
canUpdate: false,
storageResourceTags: ['dynamodb'],
},
menuConfigName: {
type: "string",
randomOnCreate: false,
requiredOnCreate: true,
optionalOnCreate: false,
canUpdate: true,
storageResourceTags: ['dynamodb'],
},
userId: { // before put check with base-user-id or targetId
type: "string",
randomOnCreate: false,
requiredOnCreate: true,
optionalOnCreate: false,
canUpdate: false,
storageResourceTags: ['dynamodb'],
},
},
identifiers: [
{
type: "partitionKey",
fieldNames:[ "useCase","menuConfigUuid"],
name:"menuConfigId"
},
],
},
]
DynamoDB tables
MenuConfigMain
{
menuConfigId: "xx", // {useCase}_{random uuid}
menuConfig: "xx", // json encoded object of configuration
menuConfigName: "yy", // user specified name of the config
userId: "xx"
}
- partition key: menuConfigId
- sort key: {none}
- save menuConfig according to useCase, not yet applied but could sub areas of the project into different use cases, handled by the same Menu Config service
UsersMenuConfigs
{
userId: "xx" // user who owns the menuConfig
menuConfigId: "xx",
}
- partition key: userId
- sort key: menuConfigId
{
menuRows:[
{
rowName: "xx", // used when configuring only as a reference
menuElements: [
{
elementType: "menu"
menuElements: [
{
elementType: "staticUrl"
url: "xxx",
},
{
elementType: "sitePage"
sitePageId: "xx",
},
{
elementType: "plainText"
plainText: "xxx",
},
],
},
{
elementType: "projectMenu", // used for the main project menu
}
// ..
]
},
// ..
]
}