Skip to content

Commit d4be22e

Browse files
committed
New Fields for Project Templates
1 parent b0ec1d7 commit d4be22e

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

migrations/elasticsearch_sync.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,12 @@ function getRequestBody (indexName) {
359359
type: 'string',
360360
index: 'not_analyzed'
361361
},
362+
subCategory: {
363+
type: 'string'
364+
},
365+
metadata: {
366+
type: 'object'
367+
},
362368
name: {
363369
type: 'string'
364370
},

src/services/ProcessorServiceProjectTemplate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ function createSchema () {
5858
name: Joi.string().max(255).required(),
5959
key: Joi.string().max(45).required(),
6060
category: Joi.string().max(45).required(),
61+
subCategory: Joi.string().max(45).empty(null),
62+
metadata: Joi.object(),
6163
icon: Joi.string().max(255).required(),
6264
question: Joi.string().max(255).required(),
6365
info: Joi.string().max(255).required(),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"topic":"project.action.create","originator":"project-api","timestamp":"2019-06-21T02:00:27.369Z","mime-type":"application/json","payload":{"resource":"project.template","createdAt":"2019-06-21T02:00:27.263Z","updatedAt":"2019-06-21T02:00:27.264Z","disabled":false,"hidden":false,"id":1,"name":"new name","key":"new key 2","category":"app","icon":"http://example.com/icon1.ico","question":"question 1","info":"info 1","aliases":["key-1","key_1"],"scope":{"scope1":"scope 1"},"phases":{"phase1":"phase 1"},"createdBy":40051333,"updatedBy":40051333,"form":null,"planConfig":null,"priceConfig":null,"deletedAt":null,"deletedBy":null}}
1+
{"topic":"project.action.create","originator":"project-api","timestamp":"2019-06-21T02:00:27.369Z","mime-type":"application/json","payload":{"resource":"project.template","createdAt":"2019-06-21T02:00:27.263Z","updatedAt":"2019-06-21T02:00:27.264Z","disabled":false,"hidden":false,"id":1,"name":"new name","key":"new key 2","metadata":{},"subCategory":"app","category":"app","icon":"http://example.com/icon1.ico","question":"question 1","info":"info 1","aliases":["key-1","key_1"],"scope":{"scope1":"scope 1"},"phases":{"phase1":"phase 1"},"createdBy":40051333,"updatedBy":40051333,"form":null,"planConfig":null,"priceConfig":null,"deletedAt":null,"deletedBy":null}}

test/e2e/processor.metadata.index.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,16 @@ describe('TC Project Template Topic Tests', () => {
423423
_.keys(_.omit(projectTemplateCreatedMessage.payload, ['resource'])))
424424
})
425425

426+
it('create project template add subCategory and metadata correctly', async () => {
427+
await ProcessorService.create(projectTemplateCreatedMessage)
428+
const data = await testHelper.getMetadataESData(metadataId)
429+
let projectTemplate = _.find(data.projectTemplates, { id: projectTemplateId })
430+
expect(projectTemplate).to.have.property('subCategory')
431+
expect(projectTemplate).to.have.property('metadata')
432+
expect(projectTemplate.subCategory).to.eql('app')
433+
expect(projectTemplate.metadata).to.eql({})
434+
})
435+
426436
it('create project template message - already exists', async () => {
427437
await ProcessorService.create(projectTemplateCreatedMessage)
428438
const data = await testHelper.getMetadataESData(metadataId)

0 commit comments

Comments
 (0)