Service - Table Config: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 17: Line 17:
     storageResources: {
     storageResources: {
       "dynamodb": {
       "dynamodb": {
         storageType: "dynamoDB", // เปลี่ยนเป็น "dynamoDB" (capital B)
         storageType: "dynamoDB",  
         tableName: "TableConfigMain",
         tableName: "TableConfigMain",
        // ลบ graphServerTag ออกสำหรับ dynamoDB
       }
       }
     },
     },
Line 27: Line 26:
         randomOnCreate: true,
         randomOnCreate: true,
         requiredOnCreate: false,
         requiredOnCreate: false,
        optionalOnCreate: false,
        canUpdate: false,
        storageResourceTags: ['dynamodb'],
      },
      useCase: {
        type: "string",
        randomOnCreate: false,
        requiredOnCreate: true,
         optionalOnCreate: false,
         optionalOnCreate: false,
         canUpdate: false,
         canUpdate: false,
Line 40: Line 31:
       },
       },
       tableConfig: {
       tableConfig: {
         type: "string", // เปลี่ยนจาก "object" เป็น "string"
         type: "object",  
         randomOnCreate: false,
         randomOnCreate: false,
         requiredOnCreate: true,
         requiredOnCreate: true,
         optionalOnCreate: false,
         optionalOnCreate: false,
         canUpdate: false,
         canUpdate: true,
         storageResourceTags: ['dynamodb'],
         storageResourceTags: ['dynamodb'],
       },
       },
Line 67: Line 58:
       {
       {
         type: "partitionKey",
         type: "partitionKey",
         fieldNames:[ "useCase","tableConfigId"],
         fieldNames: "tableConfigId"
        name:"tableConfigId"
       },
       },
     ],
     ],
   }
   },
]
]
</syntaxhighlight>
</syntaxhighlight>
Line 79: Line 69:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
tableConfigId: "xx", // {useCase}_{random uuid}
tableConfigId: "xx", // {random uuid}
tableConfig: "xx", // json encoded object of configuration
tableConfig: "xx", // json encoded object of configuration
tableConfigName: "yy", // user specified name of the config
tableConfigName: "yy", // user specified name of the config
Line 88: Line 78:
* partition key: tableConfigId
* partition key: tableConfigId
* sort key: {none}
* sort key: {none}
* save tableConfig according to useCase, not yet applied but could sub areas of the project into different use cases, handled by the same Table Config service


== UsersTableConfigs ==
== UsersTableConfigs ==

Latest revision as of 02:38, 17 July 2025

Overview

Manages configuration for presentation tables created by users and used in different areas of the project.

Repository

https://bitbucket.org/izara-core-shared/izara-core-shared-table-config

DynamoDB tables

ObjectSchema

TableConfig

[
  {
    objectType: "tableConfig",
    storageResources: {
      "dynamodb": {
        storageType: "dynamoDB", 
        tableName: "TableConfigMain",
      }
    },
    fieldNames: {
      tableConfigId: {
        type: "string",
        randomOnCreate: true,
        requiredOnCreate: false,
        optionalOnCreate: false,
        canUpdate: false,
        storageResourceTags: ['dynamodb'],
      },
      tableConfig: {
        type: "object", 
        randomOnCreate: false,
        requiredOnCreate: true,
        optionalOnCreate: false,
        canUpdate: true,
        storageResourceTags: ['dynamodb'],
      },
      tableConfigName: {
        type: "string",
        randomOnCreate: false,
        requiredOnCreate: true,
        optionalOnCreate: false,
        canUpdate: true,
        storageResourceTags: ['dynamodb'],
      },
      userId: {
        type: "string",
        randomOnCreate: false,
        requiredOnCreate: true,
        optionalOnCreate: false,
        canUpdate: false,
        storageResourceTags: ['dynamodb'],
      },
    },
    identifiers: [
      {
        type: "partitionKey",
        fieldNames: "tableConfigId"
      },
    ],
  },
]

TableConfigMain

{
	tableConfigId: "xx", // {random uuid}
	tableConfig: "xx", // json encoded object of configuration
	tableConfigName: "yy", // user specified name of the config
	userId: "xx"
}
  • partition key: tableConfigId
  • sort key: {none}

UsersTableConfigs

{
	userId: "xx" // user who owns the tableConfig
	tableConfigId: "xx",
}
  • partition key: userId
  • sort key: tableConfigId

Working documents

Table Config