2022-03-25 10:12:39 +00:00
|
|
|
import { KnexColumnType } from './database/types';
|
|
|
|
|
|
|
|
export const sqliteTypeMap: Record<string, KnexColumnType> = {
|
2022-03-23 06:16:13 +00:00
|
|
|
AutoComplete: 'text',
|
|
|
|
Currency: 'text',
|
|
|
|
Int: 'integer',
|
|
|
|
Float: 'float',
|
|
|
|
Percent: 'float',
|
2022-03-25 10:12:39 +00:00
|
|
|
Check: 'boolean',
|
2022-03-23 06:16:13 +00:00
|
|
|
Code: 'text',
|
2022-03-25 10:12:39 +00:00
|
|
|
Date: 'date',
|
|
|
|
Datetime: 'datetime',
|
|
|
|
Time: 'time',
|
2022-03-23 06:16:13 +00:00
|
|
|
Text: 'text',
|
|
|
|
Data: 'text',
|
|
|
|
Link: 'text',
|
|
|
|
DynamicLink: 'text',
|
|
|
|
Password: 'text',
|
|
|
|
Select: 'text',
|
2022-03-25 10:12:39 +00:00
|
|
|
File: 'binary',
|
2022-03-23 06:16:13 +00:00
|
|
|
Attach: 'text',
|
|
|
|
AttachImage: 'text',
|
|
|
|
Color: 'text',
|
|
|
|
};
|
|
|
|
|
2022-03-29 08:18:39 +00:00
|
|
|
export const SYSTEM = '__SYSTEM__';
|
2022-03-23 06:16:13 +00:00
|
|
|
export const validTypes = Object.keys(sqliteTypeMap);
|
2022-03-24 13:13:59 +00:00
|
|
|
export function getDefaultMetaFieldValueMap() {
|
2022-03-29 08:18:39 +00:00
|
|
|
const now = new Date().toISOString();
|
2022-03-24 13:13:59 +00:00
|
|
|
return {
|
2022-03-29 08:18:39 +00:00
|
|
|
createdBy: SYSTEM,
|
|
|
|
modifiedBy: SYSTEM,
|
|
|
|
created: now,
|
|
|
|
modified: now,
|
2022-03-24 13:13:59 +00:00
|
|
|
};
|
2022-03-24 09:50:40 +00:00
|
|
|
}
|