Skip to content

Commit f0286e0

Browse files
committed
New Fields for Project Templates
1 parent 89b82e9 commit f0286e0

File tree

6 files changed

+34
-10
lines changed

6 files changed

+34
-10
lines changed

docs/Project API.postman_collection.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info": {
3-
"_postman_id": "dd9afefd-0b47-4483-a4e5-33ca395791a3",
3+
"_postman_id": "2e0a1b99-3cb9-4c77-a562-7e6fe4956358",
44
"name": "Project API",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
66
},
@@ -4798,7 +4798,7 @@
47984798
],
47994799
"body": {
48004800
"mode": "raw",
4801-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"scope\":{\r\n \"scope1\":\"scope 1\"\r\n },\r\n \"phases\":{\r\n \"phase1\":\"phase 1\"\r\n }\r\n }"
4801+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"scope\":{\r\n \"scope1\":\"scope 1\"\r\n },\r\n \"phases\":{\r\n \"phase1\":\"phase 1\"\r\n }\r\n }"
48024802
},
48034803
"url": {
48044804
"raw": "{{api-url}}/projects/metadata/projectTemplates",
@@ -4845,7 +4845,7 @@
48454845
],
48464846
"body": {
48474847
"mode": "raw",
4848-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1\r\n },\r\n \"priceConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1\r\n },\r\n \"planConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1\r\n }\r\n }"
4848+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1\r\n },\r\n \"priceConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1\r\n },\r\n \"planConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1\r\n }\r\n }"
48494849
},
48504850
"url": {
48514851
"raw": "{{api-url}}/projects/metadata/projectTemplates",
@@ -4892,7 +4892,7 @@
48924892
],
48934893
"body": {
48944894
"mode": "raw",
4895-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"dev\"\r\n }\r\n }"
4895+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"dev\"\r\n }\r\n }"
48964896
},
48974897
"url": {
48984898
"raw": "{{api-url}}/projects/metadata/projectTemplates",
@@ -4924,7 +4924,7 @@
49244924
],
49254925
"body": {
49264926
"mode": "raw",
4927-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"wrong-key\"\r\n }\r\n }"
4927+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"wrong-key\"\r\n }\r\n }"
49284928
},
49294929
"url": {
49304930
"raw": "{{api-url}}/projects/metadata/projectTemplates",
@@ -4956,7 +4956,7 @@
49564956
],
49574957
"body": {
49584958
"mode": "raw",
4959-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1123\r\n },\r\n \"priceConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1123\r\n },\r\n \"planConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1123\r\n }\r\n }"
4959+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n \"icon\": \"http://example.com/icon1.ico\",\r\n \"question\": \"question 1\",\r\n \"info\": \"info 1\",\r\n \"aliases\": [\"key-1\", \"key_1\"],\r\n \"form\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1123\r\n },\r\n \"priceConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1123\r\n },\r\n \"planConfig\": {\r\n \t\"key\": \"dev\",\r\n \t\"version\": 1123\r\n }\r\n }"
49604960
},
49614961
"url": {
49624962
"raw": "{{api-url}}/projects/metadata/projectTemplates",
@@ -5147,7 +5147,7 @@
51475147
],
51485148
"body": {
51495149
"mode": "raw",
5150-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"scope\":{\r\n \"scope1\":\"scope 1\",\r\n \"scope2\": [\"a\"]\r\n },\r\n \"phases\":{\r\n \"phase1\":\"phase 1\",\r\n \"phase2\": {\r\n \t\"another\": \"another\"\r\n }\r\n }\r\n }"
5150+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n \"scope\":{\r\n \"scope1\":\"scope 1\",\r\n \"scope2\": [\"a\"]\r\n },\r\n \"phases\":{\r\n \"phase1\":\"phase 1\",\r\n \"phase2\": {\r\n \t\"another\": \"another\"\r\n }\r\n }\r\n }"
51515151
},
51525152
"url": {
51535153
"raw": "{{api-url}}/projects/metadata/projectTemplates/{{projectTemplateId}}",
@@ -5180,7 +5180,7 @@
51805180
],
51815181
"body": {
51825182
"mode": "raw",
5183-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"form\": {\r\n \"key\": \"dev\",\r\n \"version\": 1\r\n },\r\n \"priceConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1\r\n },\r\n \"planConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1\r\n }\r\n }"
5183+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n \"form\": {\r\n \"key\": \"dev\",\r\n \"version\": 1\r\n },\r\n \"priceConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1\r\n },\r\n \"planConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1\r\n }\r\n }"
51845184
},
51855185
"url": {
51865186
"raw": "{{api-url}}/projects/metadata/projectTemplates/{{projectTemplateId}}",
@@ -5213,7 +5213,7 @@
52135213
],
52145214
"body": {
52155215
"mode": "raw",
5216-
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n\t\"form\": {\r\n \"key\": \"dev\",\r\n \"version\": 1123\r\n },\r\n \"priceConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1123\r\n },\r\n \"planConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1123\r\n }\r\n }"
5216+
"raw": "{\r\n \"name\":\"new name\",\r\n \"key\":\"new key\",\r\n \"category\":\"app\",\r\n \"subCategory\":\"app\",\r\n \"metadata\":{},\r\n\t\"form\": {\r\n \"key\": \"dev\",\r\n \"version\": 1123\r\n },\r\n \"priceConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1123\r\n },\r\n \"planConfig\": {\r\n \"key\": \"dev\",\r\n \"version\": 1123\r\n }\r\n }"
52175217
},
52185218
"url": {
52195219
"raw": "{{api-url}}/projects/metadata/projectTemplates/{{projectTemplateId}}",

docs/swagger.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5266,6 +5266,12 @@ definitions:
52665266
category:
52675267
type: string
52685268
description: the project template category
5269+
subCategory:
5270+
type: string
5271+
description: the project template subCategory
5272+
metadata:
5273+
type: object
5274+
description: the project template metadata
52695275
scope:
52705276
type: object
52715277
description: the project template scope
@@ -6638,4 +6644,4 @@ definitions:
66386644
type: integer
66396645
format: int64
66406646
description: READ-ONLY. User that last updated this object
6641-
readOnly: true
6647+
readOnly: true
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--
2+
-- UPDATE EXISTING TABLES:
3+
-- project_templates:
4+
-- added column `subCategory`
5+
-- added column `metadata`
6+
7+
--
8+
-- project_templates
9+
10+
11+
ALTER TABLE project_templates ADD COLUMN "subCategory" character varying(45);
12+
ALTER TABLE project_templates ADD COLUMN "metadata" json NOT NULL DEFAULT '{}'::json;

src/models/projectTemplate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module.exports = (sequelize, DataTypes) => {
1212
name: { type: DataTypes.STRING(255), allowNull: false },
1313
key: { type: DataTypes.STRING(45), allowNull: false },
1414
category: { type: DataTypes.STRING(45), allowNull: false },
15+
subCategory: { type: DataTypes.STRING(45) },
16+
metadata: { type: DataTypes.JSON, allowNull: false, defaultValue: {} },
1517
icon: { type: DataTypes.STRING(255), allowNull: false },
1618
question: { type: DataTypes.STRING(255), allowNull: false },
1719
info: { type: DataTypes.STRING(255), allowNull: false },

src/routes/projectTemplates/create.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const schema = {
1818
name: Joi.string().max(255).required(),
1919
key: Joi.string().max(45).required(),
2020
category: Joi.string().max(45).required(),
21+
subCategory: Joi.string().max(45).empty(null),
22+
metadata: Joi.object(),
2123
icon: Joi.string().max(255).required(),
2224
question: Joi.string().max(255).required(),
2325
info: Joi.string().max(255).required(),

src/routes/projectTemplates/update.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const schema = {
2121
name: Joi.string().max(255),
2222
key: Joi.string().max(45),
2323
category: Joi.string().max(45),
24+
subCategory: Joi.string().max(45).empty(null),
25+
metadata: Joi.object(),
2426
icon: Joi.string().max(255),
2527
question: Joi.string().max(255),
2628
info: Joi.string().max(255),

0 commit comments

Comments
 (0)