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

Tidy up of the Models and comments #1067

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/models/company-contact.model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

/**
* Model for company contact (crm_v2.company_contacts)
* Model for company_contacts (crm_v2.company_contacts)
* @module CompanyContactModel
*/

Expand Down
8 changes: 4 additions & 4 deletions app/models/financial-agreement.model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Model for FinancialAgreements (water.financial_agreements)
* @module FinancialAgreements
* Model for financial_agreements (water.financial_agreement_types)
* @module FinancialAgreementModel
*/

const { Model } = require('objection')

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

class FinancialAgreements extends BaseModel {
class FinancialAgreementModel extends BaseModel {
static get tableName () {
return 'financialAgreements'
}
Expand All @@ -28,4 +28,4 @@ class FinancialAgreements extends BaseModel {
}
}

module.exports = FinancialAgreements
module.exports = FinancialAgreementModel
8 changes: 4 additions & 4 deletions app/models/gauging-station.model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Model for gaugingStations (water.gauging_stations)
* @module GaugingStationsnModel
* Model for gauging_stations (water.gauging_stations)
* @module GaugingStationModel
*/

const { Model } = require('objection')

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

class GaugingStationsnModel extends BaseModel {
class GaugingStationModel extends BaseModel {
static get tableName () {
return 'gaugingStations'
}
Expand All @@ -35,4 +35,4 @@ class GaugingStationsnModel extends BaseModel {
}
}

module.exports = GaugingStationsnModel
module.exports = GaugingStationModel
8 changes: 4 additions & 4 deletions app/models/licence-agreement.model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Model for LicenceAgreements (water.licence_agreements)
* @module LicenceAgreements
* Model for licence_agreements (water.licence_agreements)
* @module LicenceAgreementModel
*/

const { Model } = require('objection')

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

class LicenceAgreements extends BaseModel {
class LicenceAgreementModel extends BaseModel {
static get tableName () {
return 'licenceAgreements'
}
Expand All @@ -28,4 +28,4 @@ class LicenceAgreements extends BaseModel {
}
}

module.exports = LicenceAgreements
module.exports = LicenceAgreementModel
8 changes: 4 additions & 4 deletions app/models/licence-gauging-station.model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Model for licenceGauginStations (water.licence_gauging_stations)
* @module GauginStationsnModel
* Model for licence_gauging_stations (water.licence_gauging_stations)
* @module LicenceGaugingStationModel
*/

const { Model } = require('objection')

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

class LicenceGauginStationsnModel extends BaseModel {
class LicenceGaugingStationModel extends BaseModel {
static get tableName () {
return 'licenceGaugingStations'
}
Expand All @@ -28,4 +28,4 @@ class LicenceGauginStationsnModel extends BaseModel {
}
}

module.exports = LicenceGauginStationsnModel
module.exports = LicenceGaugingStationModel
8 changes: 4 additions & 4 deletions app/models/licence-version-purpose-condition-type.model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Model for LicenceVersionPurposeConditionType (water.licence_version_purpose_condition_types)
* @module LicenceVersionPurposeConditionTypes
* Model for licence_version_purpose_condition_types (water.licence_version_purpose_condition_types)
* @module LicenceVersionPurposeConditionTypeModel
*/

const { Model } = require('objection')

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

class LicenceVersionPurposeConditionTypes extends BaseModel {
class LicenceVersionPurposeConditionTypeModel extends BaseModel {
static get tableName () {
return 'licenceVersionPurposeConditionTypes'
}
Expand All @@ -28,4 +28,4 @@ class LicenceVersionPurposeConditionTypes extends BaseModel {
}
}

module.exports = LicenceVersionPurposeConditionTypes
module.exports = LicenceVersionPurposeConditionTypeModel
8 changes: 4 additions & 4 deletions app/models/licence-version-purpose-condition.model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Model for LicenceVersionPurposeCondition (water.licence_version_purpose_conditions)
* @module LicenceVersionPurposeConditions
* Model for licence_version_purpose_conditions (water.licence_version_purpose_conditions)
* @module LicenceVersionPurposeConditionModel
*/

const { Model } = require('objection')

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

class LicenceVersionPurposeConditions extends BaseModel {
class LicenceVersionPurposeConditionModel extends BaseModel {
static get tableName () {
return 'licenceVersionPurposeConditions'
}
Expand All @@ -28,4 +28,4 @@ class LicenceVersionPurposeConditions extends BaseModel {
}
}

module.exports = LicenceVersionPurposeConditions
module.exports = LicenceVersionPurposeConditionModel
8 changes: 4 additions & 4 deletions app/models/licence-version-purpose.model.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Model for LicenceVersionPurposes (water.licence_version_purposes)
* @module LicenceVersionPurposes
* Model for licence_version_purposes (water.licence_version_purposes)
* @module LicenceVersionPurposeModel
*/

const { Model } = require('objection')

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

class LicenceVersionPurposes extends BaseModel {
class LicenceVersionPurposeModel extends BaseModel {
static get tableName () {
return 'licenceVersionPurposes'
}
Expand All @@ -36,4 +36,4 @@ class LicenceVersionPurposes extends BaseModel {
}
}

module.exports = LicenceVersionPurposes
module.exports = LicenceVersionPurposeModel
2 changes: 1 addition & 1 deletion app/models/licence-version.model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

/**
* Model for licenceVersions (water.licence_versions)
* Model for licence_versions (water.licence_versions)
* @module LicenceVersionModel
*/

Expand Down
2 changes: 1 addition & 1 deletion app/models/permit-licence.model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

/**
* Model for PermitLicence (permit.licence)
* Model for permit_licences (permit.licence)
* @module PermitLicenceModel
*/

Expand Down
2 changes: 1 addition & 1 deletion app/models/scheduled-notification.model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

/**
* Model for scheduled notifications (water.scheduled_notification)
* Model for scheduled_notification (water.scheduled_notification)
* @module ScheduledNotificationModel
*/

Expand Down
2 changes: 1 addition & 1 deletion app/services/bill-runs/generate-transactions.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const CalculateAuthorisedAndBillableDaysServiceService = require('./calculate-au
*
* If the `waterUndertaker` flag was false, it will then generate a second 'compensation' transaction object based on
* the first. The only differences are the charge type and description properties. This is something the Charging
* Module expects to receive when the licence is for a water undertaker.
* Module expects to receive when the licence is not for a water undertaker.
*
* They will then be returned in an array for further processing before being persisted to the DB as
* `billing_transactions`.
Expand Down
4 changes: 2 additions & 2 deletions app/services/licences/fetch-agreements.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @module FetchAgreementsService
*/

const LicenceAgreements = require('../../models/licence-agreement.model.js')
const LicenceAgreementModel = require('../../models/licence-agreement.model.js')

/**
* Fetches charge version data needed for the view '/licences/{id}/set-up` page
Expand All @@ -19,7 +19,7 @@ async function go (licenceRef) {
}

async function _fetch (licenceRef) {
return LicenceAgreements.query()
return LicenceAgreementModel.query()
.where('licenceRef', licenceRef)
.select([
'id',
Expand Down
2 changes: 1 addition & 1 deletion test/support/helpers/bill-run-volume.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const { generateUUID } = require('../../../app/lib/general.lib.js')
*
* @param {Object} [data] Any data you want to use instead of the defaults used here or in the database
*
* @returns {Promise<module:BillRunModel>} The instance of the newly created record
* @returns {Promise<module:BillRunVolumeModel>} The instance of the newly created record
*/
function add (data = {}) {
const insertData = defaults(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

const { timestampForPostgres } = require('../../../app/lib/general.lib.js')
const LicenceVersionPurposeConditionTypesModel = require('../../../app/models/licence-version-purpose-condition-type.model.js')
const LicenceVersionPurposeConditionTypeModel = require('../../../app/models/licence-version-purpose-condition-type.model.js')

/**
* Add a new licence version purpose
Expand All @@ -22,12 +22,12 @@ const LicenceVersionPurposeConditionTypesModel = require('../../../app/models/li
*
* @param {Object} [data] Any data you want to use instead of the defaults used here or in the database
*
* @returns {Promise<module:LicenceVersionPurposeConditionTypesModel>} The instance of the newly created record
* @returns {Promise<module:LicenceVersionPurposeConditionTypeModel>} The instance of the newly created record
*/
async function add (data = {}) {
const insertData = defaults(data)

return LicenceVersionPurposeConditionTypesModel.query()
return LicenceVersionPurposeConditionTypeModel.query()
.insert({ ...insertData })
.returning('*')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const { randomInteger } = require('../general.js')
*
* @param {Object} [data] Any data you want to use instead of the defaults used here or in the database
*
* @returns {Promise<module:LicenceVersionPurposeConditionsModel>} The instance of the newly created record
* @returns {Promise<module:LicenceVersionPurposeConditionModel>} The instance of the newly created record
*/
async function add (data = {}) {
const insertData = defaults(data)
Expand Down
6 changes: 3 additions & 3 deletions test/support/helpers/licence-version-purpose.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

const { generateUUID, timestampForPostgres } = require('../../../app/lib/general.lib.js')
const LicenceVersionPurposesModel = require('../../../app/models/licence-version-purpose.model.js')
const LicenceVersionPurposeModel = require('../../../app/models/licence-version-purpose.model.js')
const { randomInteger } = require('../general.js')

/**
Expand All @@ -27,12 +27,12 @@ const { randomInteger } = require('../general.js')
*
* @param {Object} [data] Any data you want to use instead of the defaults used here or in the database
*
* @returns {Promise<module:LicenceVersionPurposesModel>} The instance of the newly created record
* @returns {Promise<module:LicenceVersionPurposeModel>} The instance of the newly created record
*/
async function add (data = {}) {
const insertData = defaults(data)

return LicenceVersionPurposesModel.query()
return LicenceVersionPurposeModel.query()
.insert({ ...insertData })
.returning('*')
}
Expand Down
Loading