|
|
@ -188,119 +188,48 @@ export class MetaService { |
|
|
|
* @returns {string} - Generated nanoid |
|
|
|
* @returns {string} - Generated nanoid |
|
|
|
* */ |
|
|
|
* */ |
|
|
|
public async genNanoid(target: string) { |
|
|
|
public async genNanoid(target: string) { |
|
|
|
let prefix; |
|
|
|
const prefixMap: { [key: string]: string } = { |
|
|
|
switch (target) { |
|
|
|
[MetaTable.PROJECT]: 'p', |
|
|
|
case MetaTable.PROJECT: |
|
|
|
[MetaTable.BASES]: 'b', |
|
|
|
prefix = 'p'; |
|
|
|
[MetaTable.MODELS]: 'm', |
|
|
|
break; |
|
|
|
[MetaTable.COLUMNS]: 'c', |
|
|
|
case MetaTable.BASES: |
|
|
|
[MetaTable.COL_RELATIONS]: 'l', |
|
|
|
prefix = 'b'; |
|
|
|
[MetaTable.COL_SELECT_OPTIONS]: 's', |
|
|
|
break; |
|
|
|
[MetaTable.COL_LOOKUP]: 'lk', |
|
|
|
case MetaTable.MODELS: |
|
|
|
[MetaTable.COL_ROLLUP]: 'rl', |
|
|
|
prefix = 'm'; |
|
|
|
[MetaTable.COL_FORMULA]: 'f', |
|
|
|
break; |
|
|
|
[MetaTable.FILTER_EXP]: 'fi', |
|
|
|
case MetaTable.COLUMNS: |
|
|
|
[MetaTable.SORT]: 'so', |
|
|
|
prefix = 'c'; |
|
|
|
[MetaTable.SHARED_VIEWS]: 'sv', |
|
|
|
break; |
|
|
|
[MetaTable.ACL]: 'ac', |
|
|
|
case MetaTable.COL_RELATIONS: |
|
|
|
[MetaTable.FORM_VIEW]: 'fv', |
|
|
|
prefix = 'l'; |
|
|
|
[MetaTable.FORM_VIEW_COLUMNS]: 'fvc', |
|
|
|
break; |
|
|
|
[MetaTable.GALLERY_VIEW]: 'gv', |
|
|
|
case MetaTable.COL_SELECT_OPTIONS: |
|
|
|
[MetaTable.GALLERY_VIEW_COLUMNS]: 'gvc', |
|
|
|
prefix = 's'; |
|
|
|
[MetaTable.KANBAN_VIEW]: 'kv', |
|
|
|
break; |
|
|
|
[MetaTable.KANBAN_VIEW_COLUMNS]: 'kvc', |
|
|
|
case MetaTable.COL_LOOKUP: |
|
|
|
[MetaTable.CALENDAR_VIEW]: 'cv', |
|
|
|
prefix = 'lk'; |
|
|
|
[MetaTable.CALENDAR_VIEW_COLUMNS]: 'cvc', |
|
|
|
break; |
|
|
|
[MetaTable.CALENDAR_VIEW_RANGE]: 'cvr', |
|
|
|
case MetaTable.COL_ROLLUP: |
|
|
|
[MetaTable.USERS]: 'us', |
|
|
|
prefix = 'rl'; |
|
|
|
[MetaTable.ORGS_OLD]: 'org', |
|
|
|
break; |
|
|
|
[MetaTable.TEAMS]: 'tm', |
|
|
|
case MetaTable.COL_FORMULA: |
|
|
|
[MetaTable.VIEWS]: 'vw', |
|
|
|
prefix = 'f'; |
|
|
|
[MetaTable.HOOKS]: 'hk', |
|
|
|
break; |
|
|
|
[MetaTable.HOOK_LOGS]: 'hkl', |
|
|
|
case MetaTable.FILTER_EXP: |
|
|
|
[MetaTable.AUDIT]: 'adt', |
|
|
|
prefix = 'fi'; |
|
|
|
[MetaTable.API_TOKENS]: 'tkn', |
|
|
|
break; |
|
|
|
[MetaTable.EXTENSIONS]: 'ext', |
|
|
|
case MetaTable.SORT: |
|
|
|
[MetaTable.COMMENTS]: 'com', |
|
|
|
prefix = 'so'; |
|
|
|
[MetaTable.COMMENTS_REACTIONS]: 'cre', |
|
|
|
break; |
|
|
|
[MetaTable.USER_COMMENTS_NOTIFICATIONS_PREFERENCE]: 'cnp', |
|
|
|
case MetaTable.SHARED_VIEWS: |
|
|
|
}; |
|
|
|
prefix = 'sv'; |
|
|
|
|
|
|
|
break; |
|
|
|
const prefix = prefixMap[target] || 'nc'; |
|
|
|
case MetaTable.ACL: |
|
|
|
|
|
|
|
prefix = 'ac'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.FORM_VIEW: |
|
|
|
|
|
|
|
prefix = 'fv'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.FORM_VIEW_COLUMNS: |
|
|
|
|
|
|
|
prefix = 'fvc'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.GALLERY_VIEW: |
|
|
|
|
|
|
|
prefix = 'gv'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.GALLERY_VIEW_COLUMNS: |
|
|
|
|
|
|
|
prefix = 'gvc'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.KANBAN_VIEW: |
|
|
|
|
|
|
|
prefix = 'kv'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.KANBAN_VIEW_COLUMNS: |
|
|
|
|
|
|
|
prefix = 'kvc'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.CALENDAR_VIEW: |
|
|
|
|
|
|
|
prefix = 'cv'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.CALENDAR_VIEW_COLUMNS: |
|
|
|
|
|
|
|
prefix = 'cvc'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.CALENDAR_VIEW_RANGE: |
|
|
|
|
|
|
|
prefix = 'cvr'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.USERS: |
|
|
|
|
|
|
|
prefix = 'us'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.ORGS_OLD: |
|
|
|
|
|
|
|
prefix = 'org'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.TEAMS: |
|
|
|
|
|
|
|
prefix = 'tm'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.VIEWS: |
|
|
|
|
|
|
|
prefix = 'vw'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.HOOKS: |
|
|
|
|
|
|
|
prefix = 'hk'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.HOOK_LOGS: |
|
|
|
|
|
|
|
prefix = 'hkl'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.AUDIT: |
|
|
|
|
|
|
|
prefix = 'adt'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.API_TOKENS: |
|
|
|
|
|
|
|
prefix = 'tkn'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.EXTENSIONS: |
|
|
|
|
|
|
|
prefix = 'ext'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.COMMENTS: |
|
|
|
|
|
|
|
prefix = 'com'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.COMMENTS_REACTIONS: |
|
|
|
|
|
|
|
prefix = 'cre'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MetaTable.USER_COMMENTS_NOTIFICATIONS_PREFERENCE: |
|
|
|
|
|
|
|
prefix = 'cnp'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
prefix = 'nc'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// using nanoid to avoid collision with existing ids when duplicating
|
|
|
|
// using nanoid to avoid collision with existing ids when duplicating
|
|
|
|
return `${prefix}${nanoidv2()}`; |
|
|
|
return `${prefix}${nanoidv2()}`; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Get paginated list of meta data |
|
|
|
* Get paginated list of meta data |
|
|
|
* @param baseId - Base id |
|
|
|
* @param baseId - Base id |
|
|
|