Skip to content

Commit

Permalink
new: return keyId with project response.
Browse files Browse the repository at this point in the history
  • Loading branch information
issa-tseng committed Jul 19, 2019
1 parent 103ae84 commit da2623a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/model/instance/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const ExtendedProject = ExtendedInstance({

module.exports = Instance.with(ActeeTrait('project'), HasExtended(ExtendedProject))('projects', {
all: [ 'id', 'name', 'archived', 'acteeId', 'keyId', 'createdAt', 'updatedAt', 'deletedAt' ],
readable: [ 'id', 'name', 'archived', 'createdAt', 'updatedAt' ],
readable: [ 'id', 'name', 'archived', 'keyId', 'createdAt', 'updatedAt' ],
writable: [ 'name', 'archived' ]
})(({ simply, fieldKeys, formDefs, projects, Key }) => class {
forCreate() { return withCreateTime(this); }
Expand Down
9 changes: 9 additions & 0 deletions test/integration/api/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,15 @@ describe('api: /projects', () => {
.send({ passphrase: 'supersecret', hint: 'it is a secret' })
.expect(409)))));

it('should return a keyId if managed encryption is active', testService((service) =>
service.login('alice', (asAlice) =>
asAlice.post('/v1/projects/1/key')
.send({ passphrase: 'supersecret', hint: 'it is a secret' })
.expect(200)
.then(() => asAlice.get('/v1/projects/1')
.expect(200)
.then(({ body }) => { body.keyId.should.be.a.Number(); })))));

it('should modify extant forms', testService((service) =>
service.login('alice', (asAlice) =>
asAlice.post('/v1/projects/1/key')
Expand Down

0 comments on commit da2623a

Please sign in to comment.