first commit
This commit is contained in:
12
server/api/forms/[type]/[data].get.ts
Normal file
12
server/api/forms/[type]/[data].get.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// import dataJson from './basic/data.json'
|
||||
import fs from 'fs'
|
||||
|
||||
export default eventHandler(async (event) => {
|
||||
const token = event.context.auth.token
|
||||
if (!token) return {status: 'unauthenticated'}
|
||||
|
||||
const type = getRouterParam(event, 'type')
|
||||
const data = getRouterParam(event, 'data')
|
||||
const jsonString = fs.readFileSync('/home/kanzi/node/nuxt/vitify-nuxt/server/api/forms/json/'+type+'/'+data+'.json', 'utf-8');
|
||||
return jsonString
|
||||
})
|
||||
9
server/api/forms/json/basic/data.json
Normal file
9
server/api/forms/json/basic/data.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "John Doe",
|
||||
"vegetarian": false,
|
||||
"birthDate": "1985-06-02",
|
||||
"personalData": {
|
||||
"age": 34
|
||||
},
|
||||
"postalCode": "12345"
|
||||
}
|
||||
126
server/api/forms/json/basic/i18n.json
Normal file
126
server/api/forms/json/basic/i18n.json
Normal file
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"en": {
|
||||
"name": {
|
||||
"label": "Name",
|
||||
"description": "The name of the person"
|
||||
},
|
||||
"vegetarian": {
|
||||
"label": "Vegetarian",
|
||||
"description": "Whether the person is a vegetarian"
|
||||
},
|
||||
"birth": {
|
||||
"label": "Birth Date",
|
||||
"description": ""
|
||||
},
|
||||
"nationality": {
|
||||
"label": "Nationality",
|
||||
"description": ""
|
||||
},
|
||||
"personal-data": {
|
||||
"age": {
|
||||
"label": "Age"
|
||||
},
|
||||
"driving": {
|
||||
"label": "Driving Skill",
|
||||
"description": "Indicating experience level"
|
||||
}
|
||||
},
|
||||
"height": {
|
||||
"label": "Height"
|
||||
},
|
||||
"occupation": {
|
||||
"label": "Occupation",
|
||||
"description": ""
|
||||
},
|
||||
"postal-code": {
|
||||
"label": "Postal Code"
|
||||
},
|
||||
"error": {
|
||||
"required": "field is required"
|
||||
}
|
||||
},
|
||||
"de": {
|
||||
"name": {
|
||||
"label": "Name",
|
||||
"description": "Der Name der Person"
|
||||
},
|
||||
"vegetarian": {
|
||||
"label": "Vegetarier",
|
||||
"description": "Isst die Person vegetarisch?"
|
||||
},
|
||||
"birth": {
|
||||
"label": "Geburtsdatum",
|
||||
"description": ""
|
||||
},
|
||||
"nationality": {
|
||||
"label": "Nationalität",
|
||||
"description": "",
|
||||
"Other": "Andere"
|
||||
},
|
||||
"personal-data": {
|
||||
"age": {
|
||||
"label": "Alter"
|
||||
},
|
||||
"driving": {
|
||||
"label": "Fahrkenntnisse",
|
||||
"description": "Fahrerfahrung der Person"
|
||||
}
|
||||
},
|
||||
"height": {
|
||||
"label": "Größe"
|
||||
},
|
||||
"occupation": {
|
||||
"label": "Beruf",
|
||||
"description": ""
|
||||
},
|
||||
"postal-code": {
|
||||
"label": "Postleitzahl"
|
||||
},
|
||||
"error": {
|
||||
"required": "Pflichtfeld"
|
||||
},
|
||||
"Additional Information": "Zusätzliche Informationen"
|
||||
},
|
||||
"bg": {
|
||||
"name": {
|
||||
"label": "Име",
|
||||
"description": "Името на лицето"
|
||||
},
|
||||
"vegetarian": {
|
||||
"label": "Вегетарианец",
|
||||
"description": "Дали човекът е вегетарианец"
|
||||
},
|
||||
"birth": {
|
||||
"label": "Рождена дата",
|
||||
"description": ""
|
||||
},
|
||||
"nationality": {
|
||||
"label": "Националност",
|
||||
"description": ""
|
||||
},
|
||||
"personal-data": {
|
||||
"age": {
|
||||
"label": "Възраст",
|
||||
"description": "Моля, въведете вашата възраст."
|
||||
},
|
||||
"driving": {
|
||||
"label": "Шофьорски умения",
|
||||
"description": "Показва ниво на опит"
|
||||
}
|
||||
},
|
||||
"height": {
|
||||
"label": "Височина"
|
||||
},
|
||||
"occupation": {
|
||||
"label": "Професия",
|
||||
"description": ""
|
||||
},
|
||||
"postal-code": {
|
||||
"label": "Пощенски код"
|
||||
},
|
||||
"error": {
|
||||
"required": "полето е задължително"
|
||||
},
|
||||
"Additional Information": "Допълнителна информация"
|
||||
}
|
||||
}
|
||||
57
server/api/forms/json/basic/schema.json
Normal file
57
server/api/forms/json/basic/schema.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"minLength": 3,
|
||||
"description": "Please enter your name",
|
||||
"i18n": "name"
|
||||
},
|
||||
"vegetarian": {
|
||||
"type": "boolean",
|
||||
"i18n": "vegetarian"
|
||||
},
|
||||
"birthDate": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"i18n": "birth"
|
||||
},
|
||||
"nationality": {
|
||||
"type": "string",
|
||||
"enum": ["DE", "IT", "JP", "US", "RU", "Other"],
|
||||
"i18n": "nationality"
|
||||
},
|
||||
"personalData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"description": "Please enter your age.",
|
||||
"i18n": "personal-data.age"
|
||||
},
|
||||
"height": {
|
||||
"type": "number",
|
||||
"i18n": "height"
|
||||
},
|
||||
"drivingSkill": {
|
||||
"type": "number",
|
||||
"maximum": 10,
|
||||
"minimum": 1,
|
||||
"default": 7,
|
||||
"i18n": "personal-data.driving"
|
||||
}
|
||||
},
|
||||
"required": ["age", "height"]
|
||||
},
|
||||
"occupation": {
|
||||
"type": "string",
|
||||
"i18n": "occupation"
|
||||
},
|
||||
"postalCode": {
|
||||
"type": "string",
|
||||
"maxLength": 5,
|
||||
"i18n": "postal-code"
|
||||
}
|
||||
},
|
||||
"required": ["occupation", "nationality"]
|
||||
}
|
||||
55
server/api/forms/json/basic/uischema.json
Normal file
55
server/api/forms/json/basic/uischema.json
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"type": "VerticalLayout",
|
||||
"elements": [
|
||||
{
|
||||
"type": "HorizontalLayout",
|
||||
"elements": [
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/name"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/personalData/properties/age"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/birthDate"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Label",
|
||||
"text": "Additional Information"
|
||||
},
|
||||
{
|
||||
"type": "HorizontalLayout",
|
||||
"elements": [
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/personalData/properties/height"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/nationality"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/occupation",
|
||||
"options": {
|
||||
"suggestion": [
|
||||
"Accountant",
|
||||
"Engineer",
|
||||
"Freelancer",
|
||||
"Journalism",
|
||||
"Physician",
|
||||
"Student",
|
||||
"Teacher",
|
||||
"Other"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
33
server/api/forms/json/example/schema.json
Normal file
33
server/api/forms/json/example/schema.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"description": "The task's name"
|
||||
},
|
||||
"description": {
|
||||
"title": "Long Description",
|
||||
"type": "string"
|
||||
},
|
||||
"done": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"dueDate": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"description": "The task's due date"
|
||||
},
|
||||
"rating": {
|
||||
"type": "integer",
|
||||
"maximum": 5
|
||||
},
|
||||
"recurrence": {
|
||||
"type": "string",
|
||||
"enum": ["Never", "Daily", "Weekly", "Monthly"]
|
||||
},
|
||||
"recurrenceInterval": {
|
||||
"type": "integer",
|
||||
"description": "Days until recurrence"
|
||||
}
|
||||
}
|
||||
}
|
||||
46
server/api/forms/json/example/uischema.json
Normal file
46
server/api/forms/json/example/uischema.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"type": "HorizontalLayout",
|
||||
"elements": [
|
||||
{
|
||||
"type": "VerticalLayout",
|
||||
"elements": [
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/name"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/description",
|
||||
"options": {
|
||||
"multi": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/done"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "VerticalLayout",
|
||||
"elements": [
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/dueDate"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/rating"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/recurrence"
|
||||
},
|
||||
{
|
||||
"type": "Control",
|
||||
"scope": "#/properties/recurrenceInterval"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user