@opengis/fastify-table
Version:
core-plugins
118 lines (117 loc) • 4.86 kB
JavaScript
const tableDataSchema = {
type: 'object',
properties: {
querystring: {
limit: { type: 'string', pattern: '^(\\d+)$' },
page: { type: 'string', pattern: '^(\\d+)$' },
// filter: { type: 'string', pattern: '^([\\w\\d_-]+)=([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
// search: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
order: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
desc: { type: 'string', pattern: '^(\\d+)$' },
state: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
custom: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
bbox: { type: 'string', pattern: '^([\\d\\s,.-]+)$' },
polyline: { type: 'string', pattern: '^([\\d\\w|@{}~_`]+)$' },
// key: { type: 'string', pattern: '^([\\d\\w_]+)$' },
sql: { type: 'string', pattern: '^(\\d)$' },
},
params: {
id: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
},
},
};
const tableSchema = {
type: 'object',
properties: {
querystring: {
limit: { type: 'string', pattern: '^(\\d+)$' },
page: { type: 'string', pattern: '^(\\d+)$' },
// filter: { type: 'string', pattern: '^([\\w\\d_-]+)=([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
// search: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
order: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
desc: { type: 'string', pattern: '^(\\d+)$' },
// state: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
// custom: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
bbox: { type: 'string', pattern: '^([\\d\\s,.-]+)$' },
// polyline: { type: 'string', pattern: '^([\\d\\w\\|@\\/\\{\\}~_`]+)$' },
key: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s_.-]+)$' },
uid: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
sql: { type: 'string', pattern: '^(\\d)$' },
},
params: {
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
},
},
};
const searchSchema = {
type: 'object',
properties: {
querystring: {
page: { type: 'string', pattern: '^(\\d+)$' },
limit: { type: 'string', pattern: '^(\\d+)$' },
order: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
desc: { type: 'string', pattern: '^(\\d+)$' },
key: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s_.-]+)$' },
table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
sql: { type: 'string', pattern: '^(\\d)$' },
},
},
};
const suggestSchema = {
type: 'object',
properties: {
querystring: {
lang: { type: 'string', pattern: '^([\\w]+)$' },
parent: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
sel: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
name: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
// key: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
val: { type: 'string', pattern: '([\\d\\w]+)$' },
sql: { type: 'string', pattern: '^(\\d)$' },
count: { type: 'string', pattern: '^(\\d)$' },
},
params: {
// data: { type: 'string', pattern: '^([\\d\\w]+)$' },
},
},
};
const formSchema = {
type: 'object',
properties: {
params: {
name: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
id: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
},
},
};
const filterSchema = {
type: 'object',
properties: {
params: {
table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
},
},
};
const cardTabDataSchema = {
type: 'object',
properties: {
querystring: {
sql: { type: 'string', pattern: '^(\\d)$' },
},
params: {
token: { type: 'string', pattern: '^([\\d\\w]+)$' },
},
},
};
const tableDataIdSchema = {
type: 'object',
properties: {
params: {
id: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
name: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
},
},
};
export { tableDataSchema, tableDataIdSchema, tableSchema, searchSchema, suggestSchema, formSchema, filterSchema, cardTabDataSchema, };