Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist match and allocate issues and status #772

Merged
merged 75 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
93ba29b
Persist match and allocate issues and status
Jozzey Feb 29, 2024
d3706cd
Create migrations
Jozzey Feb 29, 2024
e1e3daf
Update/rename models
Jozzey Feb 29, 2024
6fd9170
Update licence model
Jozzey Feb 29, 2024
8acad8d
Update migration
Jozzey Feb 29, 2024
8c0a0a7
Update migration
Jozzey Feb 29, 2024
cce937a
Updates to fix model changes
Jozzey Feb 29, 2024
b5b9895
Merge remote-tracking branch 'origin/main' into persist-issues
Jozzey Feb 29, 2024
781b152
Updated migration to drop/recreate rather than alter
Jozzey Mar 1, 2024
e2b4fdb
Added `.notNullable()` constraints to migrations
Jozzey Mar 1, 2024
54d1597
Create `review-licence` helper
Jozzey Mar 1, 2024
cb26e75
Merge branch 'main' into persist-issues
Jozzey Mar 4, 2024
0f139cd
Rename models/helpers
Jozzey Mar 4, 2024
3baf055
Extract licence holder so it can be persisted
Jozzey Mar 4, 2024
7a3718a
WIP
Jozzey Mar 4, 2024
128c2cf
Merge branch 'main' into persist-issues
Jozzey Mar 4, 2024
06417bd
Fixed persisting the data
Jozzey Mar 4, 2024
f3ee02d
Fix aggregate
Jozzey Mar 4, 2024
8293d4c
WIP
Jozzey Mar 4, 2024
9d7c28c
Create `review-licence` model tests
Jozzey Mar 4, 2024
8b3f0c8
Update review helpers
Jozzey Mar 4, 2024
811ad07
Fix typo
Jozzey Mar 4, 2024
62bcbd5
Fix licence model tests
Jozzey Mar 4, 2024
0e09761
Fix `review-result` model and tests
Jozzey Mar 4, 2024
f82837f
Remove `id`s from helpers
Jozzey Mar 4, 2024
f7e6461
Remove review licence page services ready for refactoring
Beckyrose200 Mar 5, 2024
1e5bdc8
Update migrations
Jozzey Mar 5, 2024
202281b
Move agrgregate from element to reference in migrations
Jozzey Mar 5, 2024
4d69880
Refactor persist results service
Beckyrose200 Mar 5, 2024
ac7c914
Helpers for new tables
Beckyrose200 Mar 5, 2024
a241a24
Model WIP
Beckyrose200 Mar 5, 2024
b0536b7
Update/add models
Jozzey Mar 6, 2024
7be3913
Fix helpers
Beckyrose200 Mar 6, 2024
0505d89
Fix plural model
Beckyrose200 Mar 6, 2024
2222b22
Rename require models
Beckyrose200 Mar 6, 2024
395e39f
Fix review licence and review bill run pages
Beckyrose200 Mar 6, 2024
089c76b
remove .only
Beckyrose200 Mar 6, 2024
f7d8cb4
Add awaits for persisting data
Beckyrose200 Mar 6, 2024
b267faf
Fix bill run licence review page
Beckyrose200 Mar 6, 2024
fd9c644
Update `review-licence` model test
Jozzey Mar 6, 2024
1460d40
Fix migration
Jozzey Mar 6, 2024
7f41e96
Review Charge Version Model tests
Beckyrose200 Mar 6, 2024
d51bbe1
Review Charge Reference model test
Beckyrose200 Mar 6, 2024
4cbc64f
Fix charge reference model
Beckyrose200 Mar 6, 2024
9a4b0a7
Create/fix model tests
Jozzey Mar 6, 2024
2e3b658
Fix typo
Jozzey Mar 6, 2024
62e2dd0
`licence-version-purpose` model test renamed
Jozzey Mar 6, 2024
0b10482
Fix review licence page and tests
Beckyrose200 Mar 7, 2024
12836fe
Fix licence model and tests
Beckyrose200 Mar 7, 2024
9fbaa62
Fix persist-allocated-licence-service tests
Beckyrose200 Mar 7, 2024
dabcc4b
Remove .only
Beckyrose200 Mar 7, 2024
1b15760
Fix fetch licence service tests
Beckyrose200 Mar 7, 2024
23eb936
Fix fetch charge versions service test
Beckyrose200 Mar 7, 2024
c9dab61
Update cancel bill run service to clear new tables
Jozzey Mar 8, 2024
5783d27
Speed up cancel process a bit
Jozzey Mar 8, 2024
1ecbc19
Tidy up
Jozzey Mar 8, 2024
2a8afce
Fix cancel bill run service unit tests
Jozzey Mar 8, 2024
3a66094
Remove `review-result` model and helper
Jozzey Mar 8, 2024
604feae
Merge branch 'main' into persist-issues
Jozzey Mar 8, 2024
314aeba
Fix broken tests :unamused:
Jozzey Mar 8, 2024
77c8074
Tidy up `submit-cancel-bill-run` service
Jozzey Mar 11, 2024
c6d94e0
Merge branch 'main' into persist-issues
Jozzey Mar 11, 2024
a1a38a4
Fix sonarcloud issues
Jozzey Mar 11, 2024
00aa0f1
Fix sonarcloud issue
Jozzey Mar 11, 2024
7478b43
Tidy up
Jozzey Mar 11, 2024
fccb259
Rename service
Jozzey Mar 11, 2024
bb39d69
Fix typo
Jozzey Mar 11, 2024
6f90926
Remove unnessary `await`
Jozzey Mar 11, 2024
afc8a5d
Update comment
Jozzey Mar 11, 2024
650461e
Add comment
Jozzey Mar 11, 2024
ee76a53
Fix descibe text in test
Jozzey Mar 11, 2024
5c73873
update comment
Jozzey Mar 11, 2024
2e52985
Add DB cleaner to tests
Jozzey Mar 11, 2024
bcd47be
Merge branch 'main' into persist-issues
Jozzey Mar 11, 2024
94d633f
Merge branch 'main' into persist-issues
Jozzey Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/models/licence.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class LicenceModel extends BaseModel {
to: 'regions.id'
}
},
reviewResults: {
reviewLicences: {
relation: Model.HasManyRelation,
modelClass: 'review-result.model',
modelClass: 'review-licence.model',
join: {
from: 'licences.id',
to: 'reviewResults.licenceId'
to: 'reviewLicences.licenceId'
}
},
workflows: {
Expand Down
31 changes: 0 additions & 31 deletions app/models/review-charge-element-result.model.js

This file was deleted.

16 changes: 16 additions & 0 deletions app/models/review-charge-element-return.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict'

/**
* Model for review_charge_elements_returns
* @module ReviewChargeElementReturnModel
*/

const BaseModel = require('./base.model.js')

class ReviewChargeElementReturnModel extends BaseModel {
static get tableName () {
return 'reviewChargeElementsReturns'
}
}

module.exports = ReviewChargeElementReturnModel
43 changes: 43 additions & 0 deletions app/models/review-charge-element.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict'

/**
* Model for review_charge_elements
* @module ReviewChargeElementModel
*/

const { Model } = require('objection')

const BaseModel = require('./base.model.js')

class ReviewChargeElementModel extends BaseModel {
static get tableName () {
return 'reviewChargeElements'
}

static get relationMappings () {
return {
reviewChargeReference: {
relation: Model.BelongsToOneRelation,
modelClass: 'review-charge-reference.model',
join: {
from: 'reviewChargeElements.reviewChargeReferenceId',
to: 'reviewChargeReferences.id'
}
},
reviewReturns: {
relation: Model.ManyToManyRelation,
modelClass: 'review-return.model',
join: {
from: 'reviewChargeElements.id',
through: {
from: 'reviewChargeElementsReturns.reviewChargeElementId',
to: 'reviewChargeElementsReturns.reviewReturnId'
},
to: 'reviewReturns.id'
}
}
}
}
}

module.exports = ReviewChargeElementModel
39 changes: 39 additions & 0 deletions app/models/review-charge-reference.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict'

/**
* Model for review_charge_references
* @module ReviewChargeReferenceModel
*/

const { Model } = require('objection')

const BaseModel = require('./base.model.js')

class ReviewChargeReferenceModel extends BaseModel {
static get tableName () {
return 'reviewChargeReferences'
}

static get relationMappings () {
return {
reviewChargeVersion: {
relation: Model.BelongsToOneRelation,
modelClass: 'review-charge-version.model',
join: {
from: 'reviewChargeReferences.reviewChargeVersionId',
to: 'reviewChargeVersions.id'
}
},
reviewChargeElements: {
relation: Model.HasManyRelation,
modelClass: 'review-charge-element.model',
join: {
from: 'reviewChargeReferences.id',
to: 'reviewChargeElements.reviewChargeReferenceId'
}
}
}
}
}

module.exports = ReviewChargeReferenceModel
39 changes: 39 additions & 0 deletions app/models/review-charge-version.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict'

/**
* Model for review_charge_versions
* @module ReviewChargeVersionModel
*/

const { Model } = require('objection')

const BaseModel = require('./base.model.js')

class ReviewChargeVersionModel extends BaseModel {
static get tableName () {
return 'reviewChargeVersions'
}

static get relationMappings () {
return {
reviewLicence: {
relation: Model.BelongsToOneRelation,
modelClass: 'review-licence.model',
join: {
from: 'reviewChargeVersions.reviewLicenceId',
to: 'reviewLicences.id'
}
},
reviewChargeReferences: {
relation: Model.HasManyRelation,
modelClass: 'review-charge-reference.model',
join: {
from: 'reviewChargeVersions.id',
to: 'reviewChargeReferences.reviewChargeVersionId'
}
}
}
}
}

module.exports = ReviewChargeVersionModel
47 changes: 47 additions & 0 deletions app/models/review-licence.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use strict'

/**
* Model for review_licences
* @module ReviewLicenceModel
*/

const { Model } = require('objection')

const BaseModel = require('./base.model.js')

class ReviewLicenceModel extends BaseModel {
static get tableName () {
return 'reviewLicences'
}

static get relationMappings () {
return {
licence: {
relation: Model.BelongsToOneRelation,
modelClass: 'licence.model',
join: {
from: 'reviewLicences.licenceId',
to: 'licences.id'
}
},
reviewChargeVersions: {
relation: Model.HasManyRelation,
modelClass: 'review-charge-version.model',
join: {
from: 'reviewLicences.id',
to: 'reviewChargeVersions.reviewLicenceId'
}
},
reviewReturns: {
relation: Model.HasManyRelation,
modelClass: 'review-return.model',
join: {
from: 'reviewLicences.id',
to: 'reviewReturns.reviewLicenceId'
}
}
}
}
}

module.exports = ReviewLicenceModel
47 changes: 0 additions & 47 deletions app/models/review-result.model.js

This file was deleted.

38 changes: 0 additions & 38 deletions app/models/review-return-result.model.js

This file was deleted.

50 changes: 50 additions & 0 deletions app/models/review-return.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use strict'

/**
* Model for review_returns
* @module ReviewReturnModel
*/

const { Model } = require('objection')

const BaseModel = require('./base.model.js')

class ReviewReturnModel extends BaseModel {
static get tableName () {
return 'reviewReturns'
}

// Defining which fields contain json allows us to insert an object without needing to stringify it first
static get jsonAttributes () {
return [
'purposes'
]
}

static get relationMappings () {
return {
reviewLicence: {
relation: Model.BelongsToOneRelation,
modelClass: 'review-licence.model',
join: {
from: 'reviewReturns.reviewLicenceId',
to: 'reviewLicences.id'
}
},
reviewChargeElements: {
relation: Model.ManyToManyRelation,
modelClass: 'review-charge-element.model',
join: {
from: 'reviewReturns.id',
through: {
from: 'reviewChargeElementsReturns.reviewReturnId',
to: 'reviewChargeElementsReturns.reviewChargeElementId'
},
to: 'reviewChargeElements.id'
}
}
}
}
}

module.exports = ReviewReturnModel
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function _prepareLicences (licences) {
}

preparedLicences.push({
id: licence.id,
id: licence.licenceId,
licenceRef: licence.licenceRef,
licenceHolder: licence.licenceHolder,
status: licence.status,
Expand Down
Loading
Loading