Skip to content

Commit

Permalink
Rename notes => description
Browse files Browse the repository at this point in the history
  • Loading branch information
cressie176 committed Jan 7, 2024
1 parent cd6d613 commit c31e1ab
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ GET /api/changelog?projection=park&version=1
{
"changeSetId": 1,
"effective": "2019-01-01T00:00:00.000Z",
"notes": "Initial park data",
"description": "Initial park data",
"lastModified": "2018-12-01T16:20:34.383Z",
"eTag": "142475a5eddeec8f0786"
},
{
"changeSetId": 2,
"effective": "2020-01-01T00:00:00.000Z",
"notes": "Park Calendars - 2020",
"description": "Park Calendars - 2020",
"lastModified": "2029-12-01T14:49:34.405Z",
"eTag": "a3dc15aa8d59d26e349d"
}
Expand Down Expand Up @@ -305,7 +305,7 @@ add hooks:

# Add a change set containing one or more data frames for the previously defined entities
add change set:
- notes: Initial Data
- description: Initial Data
effective: 2019-01-01T00:00:00Z
frames:
- entity: park
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0003.initial-park-data.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add change set:
- notes: Initial Data
- description: Initial Data
effective: 2019-01-01T00:00:00Z
frames:
- entity: park
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0004.park-calendars-2020.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add change set:
- notes: Park Calendars - 2020
- description: Park Calendars - 2020
effective: 2020-01-01T00:00:00Z
frames:
- entity: park_calendar
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0005.park-calendars-2021.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add change set:
- notes: Park Calendars - 2021
- description: Park Calendars - 2021
effective: 2021-01-01T00:00:00Z
frames:
- entity: park_calendar
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0006.add-richmond.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add change set:
- notes: Add Richmond
- description: Add Richmond
effective: 2021-04-01T00:00:00Z
frames:
- entity: park
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0007.rename-richmond-to-skegness.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add change set:
- notes: Rename Richmond to Skegness
- description: Rename Richmond to Skegness
effective: 2021-06-01T00:00:00Z
frames:
- entity: park
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0008.park-calendars-2022.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add change set:
- notes: Park Calendars - 2022
- description: Park Calendars - 2022
effective: 2022-01-01T00:00:00Z
frames:
- entity: park_calendar
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0009.delete-greenacres.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"add change set": [
{
"notes": "Delete Greenacres",
"description": "Delete Greenacres",
"effective": "2022-05-01T00:00:00Z",
"frames": [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/migrations/0010.park-calendars-2023.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add change set:
- notes: Park Calendars - 2023
- description: Park Calendars - 2023
effective: 2023-01-01T00:00:00Z
frames:
- entity: park_calendar
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type RdfProjection = {
export type RdfChangeSet = {
id: number;
effective: Date;
notes: string;
description: string;
lastModified: Date;
entityTag: string;
};
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ module.exports = class Filby extends EventEmitter {

async getChangeLog(projection) {
return this.withTransaction(async (tx) => {
const { rows } = await tx.query('SELECT DISTINCT ON (change_set_id) change_set_id, effective, notes, last_modified, entity_tag FROM fby_projection_change_log_vw WHERE projection_id = $1', [projection.id]);
const { rows } = await tx.query('SELECT DISTINCT ON (change_set_id) change_set_id, effective, description, last_modified, entity_tag FROM fby_projection_change_log_vw WHERE projection_id = $1', [projection.id]);
return rows.map(toChangeSet);
});
}

async getChangeSet(changeSetId) {
return this.withTransaction(async (tx) => {
const { rows } = await tx.query('SELECT id AS change_set_id, effective, notes, last_modified, entity_tag FROM fby_change_set WHERE id = $1', [changeSetId]);
const { rows } = await tx.query('SELECT id AS change_set_id, effective, description, last_modified, entity_tag FROM fby_change_set WHERE id = $1', [changeSetId]);
return rows.map(toChangeSet)[0];
});
}
Expand Down Expand Up @@ -150,7 +150,7 @@ function toChangeSet(row) {
return {
id: row.change_set_id,
effective: new Date(row.effective),
notes: row.notes,
description: row.description,
lastModified: new Date(row.last_modified),
entityTag: row.entity_tag,
};
Expand Down
2 changes: 1 addition & 1 deletion lib/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"type": "string",
"format": "date-time"
},
"notes": {
"description": {
"type": "string"
},
"frames": {
Expand Down
4 changes: 2 additions & 2 deletions lib/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ DO $$
v_entity_id INTEGER;
v_frame_id INTEGER;
BEGIN
INSERT INTO fby_change_set (effective, notes) VALUES
('{{effective}}', '{{notes}}')
INSERT INTO fby_change_set (effective, description) VALUES
('{{effective}}', '{{description}}')
RETURNING id INTO v_change_set_id;

{{#frames}}
Expand Down
2 changes: 1 addition & 1 deletion migrations/006.create-fby-change-set-relations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CREATE EXTENSION pgcrypto;
CREATE TABLE fby_change_set (
id SERIAL PRIMARY KEY,
effective TIMESTAMP WITH TIME ZONE NOT NULL,
notes TEXT,
description TEXT,
last_modified TIMESTAMP WITH TIME ZONE NOT NULL,
entity_tag TEXT NOT NULL
);
Expand Down
2 changes: 1 addition & 1 deletion migrations/008.create-fby-projection-change-log-vw.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE VIEW fby_projection_change_log_vw AS (
p.version AS projection_version,
c.id AS change_set_id,
c.effective,
c.notes,
c.description,
c.last_modified,
c.entity_tag
FROM
Expand Down
20 changes: 10 additions & 10 deletions test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('API', () => {
(1, 2),
(2, 1),
(2, 3)`);
await tx.query(`INSERT INTO fby_change_set (id, effective, notes) VALUES
await tx.query(`INSERT INTO fby_change_set (id, effective, description) VALUES
(1, '2020-04-05T00:00:00.000Z', 'Countries'),
(2, '2020-04-05T00:00:00.000Z', '2020 VAT Rates'),
(3, '2020-04-05T00:00:00.000Z', '2020 CGT Rates'),
Expand All @@ -111,12 +111,12 @@ describe('API', () => {
});

const projection = await filby.getProjection('VAT Rates', 1);
const changelog = (await filby.getChangeLog(projection)).map(({ id, effective, notes }) => ({ id, effective: effective.toISOString(), notes }));
const changelog = (await filby.getChangeLog(projection)).map(({ id, effective, description }) => ({ id, effective: effective.toISOString(), description }));

eq(changelog.length, 3);
deq(changelog[0], { id: 1, effective: '2020-04-05T00:00:00.000Z', notes: 'Countries' });
deq(changelog[1], { id: 2, effective: '2020-04-05T00:00:00.000Z', notes: '2020 VAT Rates' });
deq(changelog[2], { id: 4, effective: '2021-04-05T00:00:00.000Z', notes: '2021 VAT Rates' });
deq(changelog[0], { id: 1, effective: '2020-04-05T00:00:00.000Z', description: 'Countries' });
deq(changelog[1], { id: 2, effective: '2020-04-05T00:00:00.000Z', description: '2020 VAT Rates' });
deq(changelog[2], { id: 4, effective: '2021-04-05T00:00:00.000Z', description: '2021 VAT Rates' });
});

it('should dedupe change sets', async () => {
Expand All @@ -130,7 +130,7 @@ describe('API', () => {
await tx.query(`INSERT INTO fby_projection_entity (projection_id, entity_id) VALUES
(1, 1),
(1, 2)`);
await tx.query(`INSERT INTO fby_change_set (id, effective, notes) VALUES
await tx.query(`INSERT INTO fby_change_set (id, effective, description) VALUES
(1, '2020-04-05T00:00:00.000Z', 'Everything')`);
await tx.query(`INSERT INTO fby_data_frame (change_set_id, entity_id, action) VALUES
(1, 1, 'POST'),
Expand All @@ -139,14 +139,14 @@ describe('API', () => {
});

const projection = await filby.getProjection('VAT Rates', 1);
const changelog = (await filby.getChangeLog(projection)).map(({ id, effective, notes }) => ({ id, effective: effective.toISOString(), notes }));
const changelog = (await filby.getChangeLog(projection)).map(({ id, effective, description }) => ({ id, effective: effective.toISOString(), description }));
eq(changelog.length, 1);
deq(changelog[0], { id: 1, effective: '2020-04-05T00:00:00.000Z', notes: 'Everything' });
deq(changelog[0], { id: 1, effective: '2020-04-05T00:00:00.000Z', description: 'Everything' });
});

it('should get change set by id', async () => {
await filby.withTransaction(async (tx) => {
await tx.query(`INSERT INTO fby_change_set (id, effective, notes) VALUES
await tx.query(`INSERT INTO fby_change_set (id, effective, description) VALUES
(1, '2020-04-05T00:00:00.000Z', 'Countries'),
(2, '2020-04-05T00:00:00.000Z', '2020 VAT Rates'),
(3, '2020-04-05T00:00:00.000Z', '2020 CGT Rates')`);
Expand All @@ -155,7 +155,7 @@ describe('API', () => {
const changeSet = await filby.getChangeSet(2);
eq(changeSet.id, 2);
eq(changeSet.effective.toISOString(), '2020-04-05T00:00:00.000Z');
eq(changeSet.notes, '2020 VAT Rates');
eq(changeSet.description, '2020 VAT Rates');
});
});
});
18 changes: 9 additions & 9 deletions test/dsl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ describe('DSL', () => {
- type
add change set:
- notes: 2020 VAT Rates
- description: 2020 VAT Rates
effective: 2020-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
Expand All @@ -516,7 +516,7 @@ describe('DSL', () => {
- type: zero
rate: 0
- notes: 2021 VAT Rates
- description: 2021 VAT Rates
effective: 2021-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
Expand All @@ -538,7 +538,7 @@ describe('DSL', () => {
- type: zero
rate: 0
- notes: 2022 VAT Rates
- description: 2022 VAT Rates
effective: 2022-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
Expand Down Expand Up @@ -600,7 +600,7 @@ describe('DSL', () => {
- type
add change set:
- notes: 2020 VAT Rates
- description: 2020 VAT Rates
effective: 2020-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
Expand All @@ -622,7 +622,7 @@ describe('DSL', () => {
- type: zero
rate: 0
- notes: 2021 VAT Rates
- description: 2021 VAT Rates
effective: 2021-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
Expand All @@ -644,7 +644,7 @@ describe('DSL', () => {
- type: zero
rate: 0
- notes: 2022 VAT Rates
- description: 2022 VAT Rates
effective: 2022-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
Expand Down Expand Up @@ -704,19 +704,19 @@ describe('DSL', () => {
- type
add change set:
- notes: 2020 VAT Rates
- description: 2020 VAT Rates
effective: 2020-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
version: 1
source: ./test/dsl/datafiles/vat-rate-v1-2020.csv
- notes: 2021 VAT Rates
- description: 2021 VAT Rates
effective: 2021-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
version: 1
source: ./test/dsl/datafiles/vat-rate-v1-2021.csv
- notes: 2021 VAT Rates
- description: 2021 VAT Rates
effective: 2022-04-05T00:00:00.000Z
frames:
- entity: VAT Rate
Expand Down
4 changes: 2 additions & 2 deletions test/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('Schema', () => {
const checkpoint = new Date();

await filby.withTransaction(async (tx) => {
await tx.query(`INSERT INTO fby_change_set (id, effective, notes) VALUES
await tx.query(`INSERT INTO fby_change_set (id, effective, description) VALUES
(1, '2020-04-05T00:00:00.000Z', 'Countries')`);
});

Expand All @@ -130,7 +130,7 @@ describe('Schema', () => {

it('should default entity tag to random hex', async () => {
await filby.withTransaction(async (tx) => {
await tx.query(`INSERT INTO fby_change_set (id, effective, notes) VALUES
await tx.query(`INSERT INTO fby_change_set (id, effective, description) VALUES
(1, '2020-04-05T00:00:00.000Z', 'Countries')`);
});

Expand Down

0 comments on commit c31e1ab

Please sign in to comment.