backend/source/api/transformations/datetime.ts

120 lines
1.7 KiB
TypeScript
Raw Normal View History

namespace _zeitbild.api
{
/**
*/
export function date_type(
options : {
nullable ?: boolean;
} = {}
) : lib_plankton.rest.type_oas_schema
{
options = Object.assign(
{
"nullable": false,
},
options
);
return {
"nullable": options.nullable,
"type": "object",
"properties": {
"year": {
"nullable": false,
"type": "integer"
},
"month": {
"nullable": false,
"type": "integer"
},
"day": {
"nullable": false,
"type": "integer"
},
},
"required": [
"year",
"month",
"day"
],
"additionalProperties": false
};
}
/**
*/
export function time_type(
options : {
nullable ?: boolean;
} = {}
) : lib_plankton.rest.type_oas_schema
{
options = Object.assign(
{
"nullable": false,
},
options
);
return {
"nullable": options.nullable,
"type": "object",
"properties": {
"hour": {
"nullable": false,
"type": "integer"
},
"minute": {
"nullable": false,
"type": "integer"
},
"second": {
"nullable": false,
"type": "integer"
},
},
"required": [
"hour",
"minute",
"second"
],
"additionalProperties": false
};
}
/**
*/
export function datetime_type(
options : {
nullable ?: boolean;
} = {}
) : lib_plankton.rest.type_oas_schema
{
options = Object.assign(
{
"nullable": false,
},
options
);
return {
"nullable": options.nullable,
"type": "object",
"properties": {
"timezone_shift": {
"nullable": false,
"type": "integer"
},
"date": date_type({"nullable": false}),
"time": time_type({"nullable": true}),
},
"required": [
],
"additionalProperties": false
};
}
}