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

Add .editorconfig to keep project files consistent #960

Merged
merged 15 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ jobs:
- name: Install dependencies
run: npm ci

# Run linting first. No point running the tests if there is a linting issue
# Run editorconfig check first. No point running the tests if there are issues with the format of the files
- name: Run editorconfig check
uses: editorconfig-checker/action-editorconfig-checker@main

- run: editorconfig-checker

# Next run linting. No point running the tests if there is a linting issue
- name: Run lint check
run: |
npm run lint
Expand Down
18 changes: 9 additions & 9 deletions app/views/return-requirements/approved.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
{% from "govuk/components/panel/macro.njk" import govukPanel %}

{% block content %}
{{ govukPanel({
titleText: pageTitle,
classes: "govuk-!-margin-bottom-4"
}) }}
{{ govukPanel({
titleText: pageTitle,
classes: "govuk-!-margin-bottom-4"
}) }}

<h2 class="govuk-heading-m">What happens next</h2>
<p class="govuk-body">These return requirements are now active and returns will be opened for this licence in the next returns cycle.</p>
<p class="govuk-body">
<a href="/licences/{{ licenceId }}#charge" class="govuk-link">Return to licence set up</a>
</p>
<h2 class="govuk-heading-m">What happens next</h2>
<p class="govuk-body">These return requirements are now active and returns will be opened for this licence in the next returns cycle.</p>
<p class="govuk-body">
<a href="/licences/{{ licenceId }}#charge" class="govuk-link">Return to licence set up</a>
</p>
{% endblock %}
2 changes: 1 addition & 1 deletion app/views/return-requirements/check-your-answers.njk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">
<span class="govuk-caption-l">Licence {{ licenceRef }}</span>
<span class="govuk-caption-l">Licence {{ licenceRef }}</span>
{{ pageTitle }}
</h1>
</div>
Expand Down
90 changes: 45 additions & 45 deletions db/migrations/legacy/20221108002001-crm-document-header.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
'use strict'
const tableName = 'document_header'
exports.up = function (knex) {
return knex
.schema
.withSchema('crm')
.createTable(tableName, (table) => {
// Primary Key
table.uuid('document_id').primary().defaultTo(knex.raw('gen_random_uuid()'))
// Data
table.string('regime_entity_id').notNullable()
table.string('system_id').notNullable().defaultTo('permit-repo')
table.string('system_internal_id').notNullable()
table.string('system_external_id').notNullable()
table.jsonb('metadata')
table.string('company_entity_id')
table.string('verification_id')
table.string('document_name')
table.date('date_deleted')
// Legacy timestamps
table.timestamp('date_created').notNullable().defaultTo(knex.fn.now())
table.timestamp('date_updated').notNullable().defaultTo(knex.fn.now())
// Constraints
table.unique(
['system_id', 'system_internal_id', 'regime_entity_id'],
{ useConstraint: true, indexName: 'external_key' }
)
table.unique([
'document_id', 'regime_entity_id', 'system_id', 'system_internal_id',
'system_external_id', 'company_entity_id', 'verification_id'
])
})
}
exports.down = function (knex) {
return knex
.schema
.withSchema('crm')
.dropTableIfExists(tableName)
}
'use strict'

const tableName = 'document_header'

exports.up = function (knex) {
return knex
.schema
.withSchema('crm')
.createTable(tableName, (table) => {
// Primary Key
table.uuid('document_id').primary().defaultTo(knex.raw('gen_random_uuid()'))

// Data
table.string('regime_entity_id').notNullable()
table.string('system_id').notNullable().defaultTo('permit-repo')
table.string('system_internal_id').notNullable()
table.string('system_external_id').notNullable()
table.jsonb('metadata')
table.string('company_entity_id')
table.string('verification_id')
table.string('document_name')
table.date('date_deleted')

// Legacy timestamps
table.timestamp('date_created').notNullable().defaultTo(knex.fn.now())
table.timestamp('date_updated').notNullable().defaultTo(knex.fn.now())

// Constraints
table.unique(
['system_id', 'system_internal_id', 'regime_entity_id'],
{ useConstraint: true, indexName: 'external_key' }
)
table.unique([
'document_id', 'regime_entity_id', 'system_id', 'system_internal_id',
'system_external_id', 'company_entity_id', 'verification_id'
])
})
}

exports.down = function (knex) {
return knex
.schema
.withSchema('crm')
.dropTableIfExists(tableName)
}
66 changes: 33 additions & 33 deletions db/migrations/legacy/20221108002002-crm-entity.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
'use strict'
const tableName = 'entity'
exports.up = function (knex) {
return knex
.schema
.withSchema('crm')
.createTable(tableName, (table) => {
// Data
table.string('entity_id').notNullable()
table.string('entity_nm').notNullable()
table.string('entity_type').notNullable()
table.jsonb('entity_definition')
table.string('source')
// Legacy timestamps
// NOTE: They are not automatically set
table.timestamp('created_at')
table.timestamp('updated_at')
// Primary Key
// NOTE: It is not entity_id. The primary key is made up of all these columns
table.primary(['entity_id', 'entity_nm', 'entity_type'])
})
}
exports.down = function (knex) {
return knex
.schema
.withSchema('crm')
.dropTableIfExists(tableName)
}
'use strict'

const tableName = 'entity'

exports.up = function (knex) {
return knex
.schema
.withSchema('crm')
.createTable(tableName, (table) => {
// Data
table.string('entity_id').notNullable()
table.string('entity_nm').notNullable()
table.string('entity_type').notNullable()
table.jsonb('entity_definition')
table.string('source')

// Legacy timestamps
// NOTE: They are not automatically set
table.timestamp('created_at')
table.timestamp('updated_at')

// Primary Key
// NOTE: It is not entity_id. The primary key is made up of all these columns
table.primary(['entity_id', 'entity_nm', 'entity_type'])
})
}

exports.down = function (knex) {
return knex
.schema
.withSchema('crm')
.dropTableIfExists(tableName)
}
88 changes: 44 additions & 44 deletions db/migrations/legacy/20221108002003-crm-entity-roles.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
'use strict'
const tableName = 'entity_roles'
exports.up = function (knex) {
return knex
.schema
.withSchema('crm')
.createTable(tableName, (table) => {
// Primary Key
table.string('entity_role_id').primary()
// Data
table.string('entity_id')
table.string('role')
table.string('regime_entity_id')
table.string('company_entity_id')
table.string('created_by')
// Legacy timestamps
// NOTE: They are not automatically set
table.timestamp('created_at').defaultTo(knex.fn.now())
})
// If it was a simple check constraint we could have used https://knexjs.org/guide/schema-builder.html#checks
// But because of the complexity of the constraint we have had to drop to using raw() to add the constraint after
// Knex has created the table.
.raw(`
CREATE UNIQUE INDEX unique_role
ON crm.entity_roles USING btree (
entity_id,
COALESCE(regime_entity_id, '00000000-0000-0000-0000-000000000000'::character varying),
company_entity_id,
role
);
`)
}
exports.down = function (knex) {
return knex
.schema
.withSchema('crm')
.dropTableIfExists(tableName)
.drop
}
'use strict'

const tableName = 'entity_roles'

exports.up = function (knex) {
return knex
.schema
.withSchema('crm')
.createTable(tableName, (table) => {
// Primary Key
table.string('entity_role_id').primary()

// Data
table.string('entity_id')
table.string('role')
table.string('regime_entity_id')
table.string('company_entity_id')
table.string('created_by')

// Legacy timestamps
// NOTE: They are not automatically set
table.timestamp('created_at').defaultTo(knex.fn.now())
})
// If it was a simple check constraint we could have used https://knexjs.org/guide/schema-builder.html#checks
// But because of the complexity of the constraint we have had to drop to using raw() to add the constraint after
// Knex has created the table.
.raw(`
CREATE UNIQUE INDEX unique_role
ON crm.entity_roles USING btree (
entity_id,
COALESCE(regime_entity_id, '00000000-0000-0000-0000-000000000000'::character varying),
company_entity_id,
role
);
`)
}

exports.down = function (knex) {
return knex
.schema
.withSchema('crm')
.dropTableIfExists(tableName)
.drop
}
80 changes: 40 additions & 40 deletions db/migrations/legacy/20221108003001-crm-v2-addresses.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
'use strict'
const tableName = 'addresses'
exports.up = function (knex) {
return knex
.schema
.withSchema('crm_v2')
.createTable(tableName, (table) => {
// Primary Key
table.uuid('address_id').primary().defaultTo(knex.raw('gen_random_uuid()'))
// Data
table.string('address_1')
table.string('address_2')
table.string('address_3')
table.string('address_4')
table.string('town')
table.string('county')
table.string('postcode')
table.string('country')
table.string('external_id').unique()
table.boolean('is_test').notNullable().defaultTo(false)
table.string('data_source').notNullable()
table.integer('uprn').unique()
table.string('last_hash')
table.string('current_hash')
// Legacy timestamps
table.timestamp('date_created').notNullable().defaultTo(knex.fn.now())
table.timestamp('date_updated').notNullable().defaultTo(knex.fn.now())
})
}
exports.down = function (knex) {
return knex
.schema
.withSchema('crm_v2')
.dropTableIfExists(tableName)
}
'use strict'

const tableName = 'addresses'

exports.up = function (knex) {
return knex
.schema
.withSchema('crm_v2')
.createTable(tableName, (table) => {
// Primary Key
table.uuid('address_id').primary().defaultTo(knex.raw('gen_random_uuid()'))

// Data
table.string('address_1')
table.string('address_2')
table.string('address_3')
table.string('address_4')
table.string('town')
table.string('county')
table.string('postcode')
table.string('country')
table.string('external_id').unique()
table.boolean('is_test').notNullable().defaultTo(false)
table.string('data_source').notNullable()
table.integer('uprn').unique()
table.string('last_hash')
table.string('current_hash')

// Legacy timestamps
table.timestamp('date_created').notNullable().defaultTo(knex.fn.now())
table.timestamp('date_updated').notNullable().defaultTo(knex.fn.now())
})
}

exports.down = function (knex) {
return knex
.schema
.withSchema('crm_v2')
.dropTableIfExists(tableName)
}
Loading
Loading