Skip to content

Commit

Permalink
feat: Add swrs_deadline column to reporting_year
Browse files Browse the repository at this point in the history
  • Loading branch information
kriscooke committed May 20, 2020
1 parent edd7245 commit 1b3df5c
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 14 deletions.
8 changes: 8 additions & 0 deletions app/server/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11090,6 +11090,7 @@ type ReportingYear implements Node {

"""The current reporting year"""
reportingYear: Int!
swrsDeadline: Datetime!
}

"""
Expand All @@ -11114,6 +11115,9 @@ input ReportingYearCondition {

"""Checks for equality with the object’s `reportingYear` field."""
reportingYear: Int

"""Checks for equality with the object’s `swrsDeadline` field."""
swrsDeadline: Datetime
}

"""An input for mutations affecting `ReportingYear`"""
Expand All @@ -11135,6 +11139,7 @@ input ReportingYearInput {

"""The current reporting year"""
reportingYear: Int!
swrsDeadline: Datetime!
}

"""
Expand All @@ -11158,6 +11163,7 @@ input ReportingYearPatch {

"""The current reporting year"""
reportingYear: Int
swrsDeadline: Datetime
}

"""A connection to a list of `ReportingYear` values."""
Expand Down Expand Up @@ -11203,6 +11209,8 @@ enum ReportingYearsOrderBy {
REPORTING_PERIOD_START_DESC
REPORTING_YEAR_ASC
REPORTING_YEAR_DESC
SWRS_DEADLINE_ASC
SWRS_DEADLINE_DESC
}

"""Table containing the information for a CIIP review_comment"""
Expand Down
62 changes: 62 additions & 0 deletions app/server/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12900,6 +12900,22 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "swrsDeadline",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Datetime",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -24183,6 +24199,16 @@
"ofType": null
},
"defaultValue": null
},
{
"name": "swrsDeadline",
"description": "Checks for equality with the object’s `swrsDeadline` field.",
"type": {
"kind": "SCALAR",
"name": "Datetime",
"ofType": null
},
"defaultValue": null
}
],
"interfaces": null,
Expand Down Expand Up @@ -24286,6 +24312,18 @@
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "SWRS_DEADLINE_ASC",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "SWRS_DEADLINE_DESC",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
Expand Down Expand Up @@ -34798,6 +34836,20 @@
}
},
"defaultValue": null
},
{
"name": "swrsDeadline",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Datetime",
"ofType": null
}
},
"defaultValue": null
}
],
"interfaces": null,
Expand Down Expand Up @@ -45943,6 +45995,16 @@
"ofType": null
},
"defaultValue": null
},
{
"name": "swrsDeadline",
"description": null,
"type": {
"kind": "SCALAR",
"name": "Datetime",
"ofType": null
},
"defaultValue": null
}
],
"interfaces": null,
Expand Down
12 changes: 6 additions & 6 deletions schema/data/prod/reporting_year.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
begin;

with rows as (
insert into ggircs_portal.reporting_year(reporting_year, reporting_period_start, reporting_period_end, application_open_time, application_close_time, application_response_time)
insert into ggircs_portal.reporting_year(reporting_year, reporting_period_start, reporting_period_end, swrs_deadline, application_open_time, application_close_time, application_response_time)
overriding system value
values
(2018, '2018-01-01 00:00:00.0-08', '2018-12-31 23:59:59.0-08', '2019-04-01 14:49:54.191757-07', '2019-12-30 14:49:54.191757-08', '2020-01-30 14:49:54.191757-08'),
(2019, '2019-01-01 00:00:00.0-08', '2019-12-31 23:59:59.0-08', '2020-04-01 14:49:54.191757-07', '2020-12-30 14:49:54.191757-08', '2021-01-30 14:49:54.191757-08'),
(2020, '2020-01-01 00:00:00.0-08', '2020-12-31 23:59:59.0-08', '2021-04-01 14:49:54.191757-07', '2021-12-30 14:49:54.191757-08', '2022-01-30 14:49:54.191757-08'),
(2021, '2021-01-01 00:00:00.0-08', '2021-12-31 23:59:59.0-08', '2022-04-01 14:49:54.191757-07', '2022-12-30 14:49:54.191757-08', '2023-01-30 14:49:54.191757-08'),
(2022, '2022-01-01 00:00:00.0-08', '2022-12-31 23:59:59.0-08', '2023-04-01 14:49:54.191757-07', '2023-12-30 14:49:54.191757-08', '2024-01-30 14:49:54.191757-08')
(2018, '2018-01-01 00:00:00.0-08', '2018-12-31 23:59:59.0-08', '2019-06-01 00:00:00.000000-07', '2019-04-01 14:49:54.191757-07', '2019-12-30 14:49:54.191757-08', '2020-01-30 14:49:54.191757-08'),
(2019, '2019-01-01 00:00:00.0-08', '2019-12-31 23:59:59.0-08', '2020-07-31 00:00:00.000000-07', '2020-04-01 14:49:54.191757-07', '2020-12-30 14:49:54.191757-08', '2021-01-30 14:49:54.191757-08'),
(2020, '2020-01-01 00:00:00.0-08', '2020-12-31 23:59:59.0-08', '2021-06-01 00:00:00.000000-07', '2021-04-01 14:49:54.191757-07', '2021-12-30 14:49:54.191757-08', '2022-01-30 14:49:54.191757-08'),
(2021, '2021-01-01 00:00:00.0-08', '2021-12-31 23:59:59.0-08', '2022-06-01 00:00:00.000000-07', '2022-04-01 14:49:54.191757-07', '2022-12-30 14:49:54.191757-08', '2023-01-30 14:49:54.191757-08'),
(2022, '2022-01-01 00:00:00.0-08', '2022-12-31 23:59:59.0-08', '2023-06-01 00:00:00.000000-07', '2023-04-01 14:49:54.191757-07', '2023-12-30 14:49:54.191757-08', '2024-01-30 14:49:54.191757-08')

on conflict(reporting_year) do update set
reporting_period_start=excluded.reporting_period_start,
Expand Down
1 change: 1 addition & 0 deletions schema/deploy/tables/reporting_year.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ create table ggircs_portal.reporting_year (
reporting_year integer not null primary key,
reporting_period_start timestamp with time zone not null,
reporting_period_end timestamp with time zone not null,
swrs_deadline timestamp with time zone not null,
application_open_time timestamp with time zone not null,
application_close_time timestamp with time zone not null,
application_response_time timestamp with time zone not null
Expand Down
16 changes: 8 additions & 8 deletions schema/test/unit/tables/reporting_year_test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ select results_eq(

select lives_ok(
$$
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, application_open_time, application_close_time, application_response_time) overriding system value
values (3000, now(), now(), now(), now(), now());
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, swrs_deadline, application_open_time, application_close_time, application_response_time) overriding system value
values (3000, now(), now(), now(), now(), now(), now());
$$,
'ciip_administrator can insert data in reporting_year table'
);
Expand Down Expand Up @@ -83,8 +83,8 @@ select results_eq(

select throws_like(
$$
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, application_open_time, application_close_time, application_response_time) overriding system value
values (1001, now(), now(), now(), now(), now());
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, swrs_deadline, application_open_time, application_close_time, application_response_time) overriding system value
values (1001, now(), now(), now(), now(), now(), now());
$$,
'permission denied%',
'Industry User cannot insert into table_emission_category_gas'
Expand Down Expand Up @@ -120,8 +120,8 @@ select results_eq(

select throws_like(
$$
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, application_open_time, application_close_time, application_response_time) overriding system value
values (1001, now(), now(), now(), now(), now());
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, swrs_deadline, application_open_time, application_close_time, application_response_time) overriding system value
values (1001, now(), now(), now(), now(), now(), now());
$$,
'permission denied%',
'ciip_analyst cannot insert into table_emission_category_gas'
Expand Down Expand Up @@ -157,8 +157,8 @@ select results_eq(

select throws_like(
$$
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, application_open_time, application_close_time, application_response_time) overriding system value
values (1001, now(), now(), now(), now(), now());
insert into ggircs_portal.reporting_year (reporting_year, reporting_period_start, reporting_period_end, swrs_deadline, application_open_time, application_close_time, application_response_time) overriding system value
values (1001, now(), now(), now(), now(), now(), now());
$$,
'permission denied%',
'ciip_guest cannot insert into table_emission_category_gas'
Expand Down

0 comments on commit 1b3df5c

Please sign in to comment.