oak-db/test/entities/Area.ts

56 lines
1.4 KiB
TypeScript

import { String, Geo } from 'oak-domain/lib/types/DataType';
import { EntityShape, Configuration } from 'oak-domain/lib/types/Entity';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
export interface Schema extends EntityShape {
name: String<32>;
level: 'province' | 'city' | 'district' | 'street' | 'country';
depth: 0 | 1 | 2 | 3 | 4;
parent?: Schema;
code: String<12>;
center: Geo;
};
const entityDesc: EntityDesc<Schema, '', '', {
level: Schema['level'];
}> = {
locales: {
zh_CN: {
name: '地区',
attr: {
level: '层级',
depth: '深度',
parent: '上级地区',
name: '名称',
code: '地区编码',
center: '中心坐标',
},
v: {
level: {
country: '国家',
province: '省',
city: '市',
district: '区',
street: '街道',
}
}
},
},
configuration: {
actionType: 'readOnly',
static: true,
},
style: {
color: {
level: {
province: '#00FF7F',
city: '#1E90FF',
district: '#4682B4',
street: '#808080',
country: '#2F4F4F',
}
}
}
};