Service - Table Config

From Izara Wiki
Revision as of 01:58, 17 July 2025 by Seagame (talk | contribs)
Jump to navigation Jump to search

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", // เปลี่ยนเป็น "dynamoDB" (capital B)
        tableName: "TableConfigMain",
        // ลบ graphServerTag ออกสำหรับ dynamoDB
      }
    },
    fieldNames: {
      tableConfigId: {
        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'],
      },
      tableConfig: {
        type: "string", // เปลี่ยนจาก "object" เป็น "string"
        randomOnCreate: false,
        requiredOnCreate: true,
        optionalOnCreate: false,
        canUpdate: false,
        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:[ "useCase","tableConfigId"],
        name:"tableConfigId"
      },
    ],
  }
]

TableConfigMain

{
	tableConfigId: "xx", // {useCase}_{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}
  • 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

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

Working documents

Table Config