Skip to content

Commit

Permalink
fix: fix mishaped seed data
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Jan 29, 2022
1 parent e5f07a4 commit d57a90b
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 546 deletions.
5 changes: 1 addition & 4 deletions seeders/20211209204301-add-projects.cjs
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
'use strict';

/* TODO: Fix seeddata for latest models
const ProjectStub = require('../src/models/projects/projects.stub.json');
const CoBenifetStub = require('../src/models/co-benefits/co-benefits.stub.json');
const RelatedProjectStub = require('../src/models/related-projects/related-projects.stub.json');
const LabelStub = require('../src/models/labels/labels.stub.json');
const RatingsStub = require('../src/models/ratings/ratings.stub.json');
const IssuanceStub = require('../src/models/issuances/issuances.stub.json');
const LocationsStub = require('../src/models/locations/locations.stub.json');
*/

module.exports = {
// eslint-disable-next-line no-unused-vars
up: async (queryInterface) => {
/* TODO: Fix seeddata for latest models
await queryInterface.bulkInsert('projects', ProjectStub, {});
await queryInterface.bulkInsert('coBenefits', CoBenifetStub, {});
await queryInterface.bulkInsert('relatedProjects', RelatedProjectStub, {});
await queryInterface.bulkInsert('labels', LabelStub, {});
await queryInterface.bulkInsert('projectRatings', RatingsStub, {});
await queryInterface.bulkInsert('issuances', IssuanceStub, {});
await queryInterface.bulkInsert('projectLocations', LocationsStub, {});
*/
},

down: async (queryInterface) => {
Expand Down
5 changes: 4 additions & 1 deletion src/models/co-benefits/co-benefits.modeltypes.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ module.exports = {
onDelete: 'CASCADE',
required: true,
},
// Cobenefits are not required. Not sure how that affects the 'id' field above, but users may not have any cobenefits to add. 'Cobenefit' field should be optional.
orgUid: {
type: Sequelize.STRING,
required: true,
},
cobenefit: {
type: Sequelize.STRING,
required: true,
Expand Down
25 changes: 3 additions & 22 deletions src/models/co-benefits/co-benefits.stub.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
[
{
"id": "9506cf84-6f9e-437a-a099-9672e4737668",
"benefit": "TEST_COBENEFIT_1",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd"
},
{
"id": "f124ebef-6436-4cd4-abdd-c55e10f4d1a0",
"benefit": "TEST_COBENEFIT_2",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd"
},
{
"id": "729c71bf-cc6e-4424-842f-54c2a490952a",
"benefit": "TEST_COBENEFIT_3",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd"
},
{
"id": "2995a129-1fad-4251-9942-7c6db2fbff74",
"benefit": "TEST_COBENEFIT_4",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd"
},
{
"id": "83913f9e-9876-4c4d-ac4c-10dd992d7d7f",
"benefit": "TEST_COBENEFIT_5",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd"
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"cobenefit": "TEST_COBENEFIT_1",
"warehouseProjectId": "11954678-f7a5-47d2-94f8-f4f3138a529c"
}
]
49 changes: 3 additions & 46 deletions src/models/issuances/issuances.stub.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,12 @@
{
"id": "a6745831-5d5e-45ed-b9fe-fd6aa129df25",
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"warehouseProjectId": "11954678-f7a5-47d2-94f8-f4f3138a529c",
"startDate": "2019-02-03 00:05:45.701 +00:00",
"endDate": "2029-03-12 00:05:45.701 +00:00",
"verificationDate": "2022-01-18 00:05:45.701 +00:00",
"verificationApproach": "TEST",
"verificationReportDate": "2022-01-18 00:05:45.701 +00:00",
"verificationBody": "This is verified",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "3d5a8ed2-e5a7-4275-a36e-3456812e39b7",
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"startDate": "2004-03-21 00:05:45.701 +00:00",
"endDate": "2005-08-11 00:05:45.701 +00:00",
"verificationDate": "2022-01-18 00:05:45.701 +00:00",
"verificationBody": "This is verified",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "57c1859d-6aa4-4c57-9dfb-6438e0d4653e",
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"startDate": "2012-01-18 00:05:45.701 +00:00",
"endDate": "2013-06-22 00:05:45.701 +00:00",
"verificationDate": "2022-01-18 00:05:45.701 +00:00",
"verificationBody": "This is verified",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "74887b22-da3b-4c2b-b945-670319193cdd",
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"startDate": "2014-02-18 00:05:45.701 +00:00",
"endDate": "2016-04-18 00:05:45.701 +00:00",
"verificationDate": "2022-01-18 00:05:45.701 +00:00",
"verificationBody": "This is verified",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-02-18 00:05:45.701 +00:00",
"updatedAt": "2022-08-18 00:05:45.701 +00:00"
},
{
"id": "7f7f23a5-3e1a-43b4-82d8-b4156b158f88",
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"startDate": "2020-05-18 00:05:45.701 +00:00",
"endDate": "2021-03-22 00:05:45.701 +00:00",
"verificationDate": "2022-01-18 00:05:45.701 +00:00",
"verificationBody": "This is verified",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
}
Expand Down
7 changes: 6 additions & 1 deletion src/models/labels/labels.modeltypes.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ module.exports = {
type: Sequelize.STRING,
required: true,
},
// The orgUid is the singeltonId of the
// organizations tables on the datalayer
orgUid: {
type: Sequelize.STRING,
required: true,
},
label: {
type: Sequelize.STRING,
require: true,
// Need to include another field 'labelType' which will be required and is STRING type.
},
creditingPeriodStartDate: {
type: Sequelize.DATE,
Expand Down
48 changes: 5 additions & 43 deletions src/models/labels/labels.stub.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,15 @@
[
{
"id": "702cafbb-c624-4273-9cdc-c617ad5675df",
"type": "basic type",
"label": "label 1",
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"warehouseProjectId": "11954678-f7a5-47d2-94f8-f4f3138a529c",
"creditingPeriodStartDate": "2011-10-05T14:48:00.000Z",
"creditingPeriodEndDate": "2022-10-05T14:48:00.000Z",
"validityStartDate": "2022-01-18 00:05:45.701 +00:00",
"validityPeriodEndDate": "2022-01-18 00:05:45.701 +00:00",
"unitQuantity": 5,
"labelLink": "https://label.link/1",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "76903895-840e-406c-b2a0-f90244acf02d",
"type": "basic type",
"label": "label 2",
"creditingPeriodStartDate": "2011-10-05T14:48:00.000Z",
"creditingPeriodEndDate": "2022-10-05T14:48:00.000Z",
"labelLink": "https://label.link/2",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "2c9d41fc-1f58-427d-b028-fc83bf45c74f",
"type": "basic type",
"label": "label 3",
"creditingPeriodStartDate": "2010-10-05T14:48:00.000Z",
"creditingPeriodEndDate": "2022-10-05T14:48:00.000Z",
"labelLink": "https://label.link/3",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "2421e951-0a68-4f9f-b760-01528c605237",
"type": "basic type",
"label": "label 4",
"creditingPeriodStartDate": "2011-10-05T14:48:00.000Z",
"creditingPeriodEndDate": "2022-10-05T14:48:00.000Z",
"labelLink": "https://label.link/4",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "df7c1ff8-f669-4028-bcbd-3abedf7b1a49",
"type": "basic type",
"label": "label 5",
"creditingPeriodStartDate": "2010-10-05T14:48:00.000Z",
"creditingPeriodEndDate": "2021-10-05T14:48:00.000Z",
"labelLink": "https://label.link/5",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
}
Expand Down
5 changes: 4 additions & 1 deletion src/models/locations/locations.modeltypes.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ module.exports = {
required: true,
onDelete: 'CASCADE',
},
orgUid: {
type: Sequelize.STRING,
required: true,
},
country: {
type: Sequelize.STRING,
required: true,
},
// Need to make 'inCountryRegion' field optional. Some countries may have use regions while others do not and that is ok.
inCountryRegion: {
type: Sequelize.STRING,
required: true,
Expand Down
35 changes: 5 additions & 30 deletions src/models/locations/locations.stub.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,11 @@
[
{
"id": "89adcb9a-dc10-41aa-8606-c1ce1545dcbd",
"countryRegion": "United States",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "b41d0f89-2f71-4bde-b6d0-5cf77802c3fc",
"countryRegion": "United States",
"warehouseProjectId": "897891e2-cc66-4867-8da2-c17d69d018cb",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "8f23fd77-d19f-4083-b7be-949288e88a36",
"countryRegion": "China",
"warehouseProjectId": "8a02a620-8be8-44f9-ba90-eff00ccc3a70",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "f28965c3-96b8-40ef-809e-894975d16c4d",
"countryRegion": "Russia",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
},
{
"id": "40ae83b1-b497-4f63-9b7d-874505b67662",
"countryRegion": "United States",
"warehouseProjectId": "81e05bfa-e93f-458f-b907-96bf170e52cd",
"country": "United States",
"inCountryRegion": "United States",
"geographicIdentifier": "TEST",
"warehouseProjectId": "11954678-f7a5-47d2-94f8-f4f3138a529c",
"orgUid": "f1c54511-865e-4611-976c-7c3c1f704662",
"createdAt": "2022-01-18 00:05:45.701 +00:00",
"updatedAt": "2022-01-18 00:05:45.701 +00:00"
}
Expand Down
Loading

0 comments on commit d57a90b

Please sign in to comment.