Skip to content

Commit

Permalink
Correct LicenceEntity changes
Browse files Browse the repository at this point in the history
In creating `LicenceEntityRole` we spotted that the ID is not automatically generated. When we checked back on `LegacyEntity` we found the same. So, this change corrects what we've just done in [Add LicenceEntityModel](#690).
  • Loading branch information
Cruikshanks committed Jan 27, 2024
1 parent fca4315 commit db868d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/migrations/legacy/20240127115605_create-crm-entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.up = function (knex) {
.withSchema('crm')
.createTable(tableName, (table) => {
// Primary Key
table.uuid('entity_id').primary().defaultTo(knex.raw('gen_random_uuid()'))
table.uuid('entity_id').primary()

// Data
table.string('entity_nm').notNullable()
Expand Down
2 changes: 1 addition & 1 deletion test/models/licence-entity.model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const LicenceEntityHelper = require('../support/helpers/licence-entity.helper.js
// Thing under test
const LicenceEntityModel = require('../../app/models/licence-entity.model.js')

describe('Licence Role model', () => {
describe('Licence Entity model', () => {
let testRecord

beforeEach(async () => {
Expand Down
3 changes: 3 additions & 0 deletions test/support/helpers/licence-entity.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
* @module LicenceEntityHelper
*/

const { generateUUID } = require('../../../app/lib/general.lib.js')
const LicenceEntityModel = require('../../../app/models/licence-entity.model.js')

/**
* Add a new licence entity
*
* If no `data` is provided, default values will be used. These are
*
* - `id` - [random UUID]
* - `name` - Grace Hopper
* - `type` - individual
*
Expand All @@ -36,6 +38,7 @@ async function add (data = {}) {
*/
function defaults (data = {}) {
const defaults = {
id: generateUUID(),
name: 'Grace Hopper',
type: 'Licence Holder'
}
Expand Down

0 comments on commit db868d4

Please sign in to comment.