Skip to content

Commit

Permalink
Merge pull request #215 from Chia-Network/feature/refactor3
Browse files Browse the repository at this point in the history
feat: rename vintage model to insuance model
  • Loading branch information
MichaelTaylor3D authored Jan 26, 2022
2 parents 324534c + 8f87109 commit 28bb917
Show file tree
Hide file tree
Showing 34 changed files with 144 additions and 123 deletions.
2 changes: 1 addition & 1 deletion docs/postman/Projects API.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"originProjectId\": \"c5067a60-e329-4510-991c-b302fd00ec8d\",\r\n \"projectId\": \"c9d147e2-bc07-4e68-a76d-43424fa8cd4e\",\r\n \"program\": \"Eimbee\",\r\n \"projectName\": \"Zoomcast\",\r\n \"projectLink\": \"http://dailymotion.com/ligula/suspendisse/ornare/consequat/lectus/in.jpg?aliquam=consequat&lacus=nulla&morbi=nisl&quis=nunc&tortor=nisl&id=duis&nulla=bibendum&ultrices=felis&aliquet=sed&maecenas=interdum&leo=venenatis&odio=turpis&condimentum=enim&id=blandit&luctus=mi&nec=in&molestie=porttitor&sed=pede&justo=justo&pellentesque=eu&viverra=massa&pede=donec&ac=dapibus&diam=duis&cras=at&pellentesque=velit&volutpat=eu&dui=est&maecenas=congue&tristique=elementum&est=in&et=hac&tempus=habitasse&semper=platea&est=dictumst&quam=morbi&pharetra=vestibulum&magna=velit&ac=id&consequat=pretium&metus=iaculis&sapien=diam&ut=erat&nunc=fermentum&vestibulum=justo&ante=nec&ipsum=condimentum\",\r\n \"projectDeveloper\": \"Cogibox\",\r\n \"sector\": \"Viva\",\r\n \"projectType\": \"Topicshots\",\r\n \"coveredByNDC\": 0,\r\n \"NDCLinkage\": \"Shuffletag\",\r\n \"projectStatus\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\",\r\n \"projectStatusDate\": \"2022-01-19\",\r\n \"unitMetric\": \"Fuscia\",\r\n \"methodology\": \"Quatz\",\r\n \"methodologyVersion\": 43,\r\n \"validationApproach\": \"Praesent in consequat urna\",\r\n \"validationDate\": \"2022-01-19\",\r\n \"projectTag\": \"Neque\",\r\n \"estimatedAnnualAverageEmissionReduction\": \"223\",\r\n \"projectLocations\": [\r\n {\r\n \"id\": \"40ae83b1-b497-4f63-9b7d-874505b67662\",\r\n \"countryRegion\": \"United States\",\r\n \"country\": null,\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ],\r\n \"qualifications\": [\r\n {\r\n \"id\": \"702cafbb-c624-4273-9cdc-c617ad5675df\",\r\n \"qualificationId\": null,\r\n \"qualificationLink\": \"https://qualification.link/1\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"type\": \"basic type\",\r\n \"label\": \"qualification 1\",\r\n \"creditingPeriodStartDate\": null,\r\n \"creditingPeriodEndDate\": null,\r\n \"warehouseUnitId\": null,\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ],\r\n \"vintages\": [\r\n {\r\n \"id\": \"3d5a8ed2-e5a7-4275-a36e-3456812e39b7\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"57c1859d-6aa4-4c57-9dfb-6438e0d4653e\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"74887b22-da3b-4c2b-b945-670319193cdd\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"7f7f23a5-3e1a-43b4-82d8-b4156b158f88\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"a6745831-5d5e-45ed-b9fe-fd6aa129df25\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ],\r\n \"coBenefits\": [\r\n {\r\n \"id\": \"2995a129-1fad-4251-9942-7c6db2fbff74\",\r\n \"benefit\": \"TEST_COBENEFIT_4\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"729c71bf-cc6e-4424-842f-54c2a490952a\",\r\n \"benefit\": \"TEST_COBENEFIT_3\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"83913f9e-9876-4c4d-ac4c-10dd992d7d7f\",\r\n \"benefit\": \"TEST_COBENEFIT_5\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"9506cf84-6f9e-437a-a099-9672e4737668\",\r\n \"benefit\": \"TEST_COBENEFIT_1\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"f124ebef-6436-4cd4-abdd-c55e10f4d1a0\",\r\n \"benefit\": \"TEST_COBENEFIT_2\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n }\r\n ],\r\n \"relatedProjects\": [\r\n {\r\n \"id\": \"394e319e-a4d2-4ad8-a4b3-0d5b660dd8ec\",\r\n \"type\": \"Greenlam\",\r\n \"registry\": \"Ventosanzap\",\r\n \"note\": \"Donec dapibus.\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"39b80025-1a2c-4cda-92aa-541e8e059258\",\r\n \"type\": \"Matsoft\",\r\n \"registry\": \"Sub-Ex\",\r\n \"note\": \"Cras pellentesque volutpat dui. Maecenas tristique, est et tempus semper, est quam pharetra magna, ac consequat metus sapien ut nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris viverra diam vitae quam. Suspendisse potenti.\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ]\r\n}",
"raw": "{\r\n \"originProjectId\": \"c5067a60-e329-4510-991c-b302fd00ec8d\",\r\n \"projectId\": \"c9d147e2-bc07-4e68-a76d-43424fa8cd4e\",\r\n \"program\": \"Eimbee\",\r\n \"projectName\": \"Zoomcast\",\r\n \"projectLink\": \"http://dailymotion.com/ligula/suspendisse/ornare/consequat/lectus/in.jpg?aliquam=consequat&lacus=nulla&morbi=nisl&quis=nunc&tortor=nisl&id=duis&nulla=bibendum&ultrices=felis&aliquet=sed&maecenas=interdum&leo=venenatis&odio=turpis&condimentum=enim&id=blandit&luctus=mi&nec=in&molestie=porttitor&sed=pede&justo=justo&pellentesque=eu&viverra=massa&pede=donec&ac=dapibus&diam=duis&cras=at&pellentesque=velit&volutpat=eu&dui=est&maecenas=congue&tristique=elementum&est=in&et=hac&tempus=habitasse&semper=platea&est=dictumst&quam=morbi&pharetra=vestibulum&magna=velit&ac=id&consequat=pretium&metus=iaculis&sapien=diam&ut=erat&nunc=fermentum&vestibulum=justo&ante=nec&ipsum=condimentum\",\r\n \"projectDeveloper\": \"Cogibox\",\r\n \"sector\": \"Viva\",\r\n \"projectType\": \"Topicshots\",\r\n \"coveredByNDC\": 0,\r\n \"NDCLinkage\": \"Shuffletag\",\r\n \"projectStatus\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\",\r\n \"projectStatusDate\": \"2022-01-19\",\r\n \"unitMetric\": \"Fuscia\",\r\n \"methodology\": \"Quatz\",\r\n \"methodologyVersion\": 43,\r\n \"validationApproach\": \"Praesent in consequat urna\",\r\n \"validationDate\": \"2022-01-19\",\r\n \"projectTag\": \"Neque\",\r\n \"estimatedAnnualAverageEmissionReduction\": \"223\",\r\n \"projectLocations\": [\r\n {\r\n \"id\": \"40ae83b1-b497-4f63-9b7d-874505b67662\",\r\n \"countryRegion\": \"United States\",\r\n \"country\": null,\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ],\r\n \"qualifications\": [\r\n {\r\n \"id\": \"702cafbb-c624-4273-9cdc-c617ad5675df\",\r\n \"qualificationId\": null,\r\n \"qualificationLink\": \"https://qualification.link/1\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"type\": \"basic type\",\r\n \"label\": \"qualification 1\",\r\n \"creditingPeriodStartDate\": null,\r\n \"creditingPeriodEndDate\": null,\r\n \"warehouseUnitId\": null,\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ],\r\n \"issuances\": [\r\n {\r\n \"id\": \"3d5a8ed2-e5a7-4275-a36e-3456812e39b7\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"57c1859d-6aa4-4c57-9dfb-6438e0d4653e\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"74887b22-da3b-4c2b-b945-670319193cdd\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"7f7f23a5-3e1a-43b4-82d8-b4156b158f88\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"a6745831-5d5e-45ed-b9fe-fd6aa129df25\",\r\n \"startDate\": null,\r\n \"endDate\": null,\r\n \"verificationApproach\": null,\r\n \"verificationDate\": null,\r\n \"verificationBody\": \"This is verified\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ],\r\n \"coBenefits\": [\r\n {\r\n \"id\": \"2995a129-1fad-4251-9942-7c6db2fbff74\",\r\n \"benefit\": \"TEST_COBENEFIT_4\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"729c71bf-cc6e-4424-842f-54c2a490952a\",\r\n \"benefit\": \"TEST_COBENEFIT_3\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"83913f9e-9876-4c4d-ac4c-10dd992d7d7f\",\r\n \"benefit\": \"TEST_COBENEFIT_5\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"9506cf84-6f9e-437a-a099-9672e4737668\",\r\n \"benefit\": \"TEST_COBENEFIT_1\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n },\r\n {\r\n \"id\": \"f124ebef-6436-4cd4-abdd-c55e10f4d1a0\",\r\n \"benefit\": \"TEST_COBENEFIT_2\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": null,\r\n \"updatedAt\": null\r\n }\r\n ],\r\n \"relatedProjects\": [\r\n {\r\n \"id\": \"394e319e-a4d2-4ad8-a4b3-0d5b660dd8ec\",\r\n \"type\": \"Greenlam\",\r\n \"registry\": \"Ventosanzap\",\r\n \"note\": \"Donec dapibus.\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n },\r\n {\r\n \"id\": \"39b80025-1a2c-4cda-92aa-541e8e059258\",\r\n \"type\": \"Matsoft\",\r\n \"registry\": \"Sub-Ex\",\r\n \"note\": \"Cras pellentesque volutpat dui. Maecenas tristique, est et tempus semper, est quam pharetra magna, ac consequat metus sapien ut nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris viverra diam vitae quam. Suspendisse potenti.\",\r\n \"warehouseProjectId\": \"81e05bfa-e93f-458f-b907-96bf170e52cd\",\r\n \"createdAt\": \"2022-01-19\",\r\n \"updatedAt\": \"2022-01-19\"\r\n }\r\n ]\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down
12 changes: 12 additions & 0 deletions migrations/20211201194541-create-issuance.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

const modelTypes = require('../src/models/issuances/issuances.modeltypes.cjs');

module.exports = {
up: async (queryInterface) => {
await queryInterface.createTable('issuances', modelTypes);
},
down: async (queryInterface) => {
await queryInterface.dropTable('issuances');
},
};
12 changes: 0 additions & 12 deletions migrations/20211201194541-create-vintage.cjs

This file was deleted.

6 changes: 3 additions & 3 deletions migrations/20211212200953-fulltext-search.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

module.exports = {
up: async (queryInterface, Sequelize) => {
up: async (queryInterface) => {
if (queryInterface.sequelize.getDialect() === 'sqlite') {
await queryInterface.sequelize.query(`
CREATE VIRTUAL TABLE projects_fts USING fts5(
Expand Down Expand Up @@ -55,13 +55,13 @@ module.exports = {
unitMarketplaceLink,
correspondingAdjustmentDeclaration,
correspondingAdjustmentStatus,
vintageId
issuanceId
);
`);
}
},

down: async (queryInterface, Sequelize) => {
down: async (queryInterface) => {
if (queryInterface.sequelize.getDialect() === 'sqlite') {
await queryInterface.sequelize.query(`drop table projects_fts;`);
await queryInterface.sequelize.query('drop table units_fts;');
Expand Down
9 changes: 5 additions & 4 deletions migrations/20211215231227-vintage-unit-junction.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
'use strict';

module.exports = {
// eslint-disable-next-line
up: async (queryInterface, Sequelize) => {
/* await queryInterface.createTable('vintage_unit', {
/* await queryInterface.createTable('issuance_unit', {
unitId: Sequelize.INTEGER,
vintageId: Sequelize.INTEGER,
issuanceId: Sequelize.INTEGER,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE,
});*/
},

down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('vintage_unit');
down: async (queryInterface) => {
await queryInterface.dropTable('issuance_unit');
},
};
2 changes: 1 addition & 1 deletion migrations/20211219182106-sqlite-triggers-projects.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

module.exports = {
up: async (queryInterface, Sequelize) => {
up: async (queryInterface) => {
if (queryInterface.sequelize.getDialect() === 'sqlite') {
await queryInterface.sequelize.query(`
CREATE TRIGGER project_insert_fts AFTER INSERT ON projects BEGIN
Expand Down
8 changes: 4 additions & 4 deletions migrations/20211219184405-sqlite-triggers-units.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
unitMarketplaceLink,
correspondingAdjustmentDeclaration,
correspondingAdjustmentStatus,
vintageId
issuanceId
) VALUES (
new.warehouseUnitId,
new.orgUid,
Expand All @@ -52,7 +52,7 @@ module.exports = {
new.unitMarketplaceLink,
new.correspondingAdjustmentDeclaration,
new.correspondingAdjustmentStatus,
new.vintageId
new.issuanceId
);
END;`);

Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = {
unitMarketplaceLink,
correspondingAdjustmentDeclaration,
correspondingAdjustmentStatus,
vintageId
issuanceId
) VALUES (
new.warehouseUnitId,
new.orgUid,
Expand All @@ -112,7 +112,7 @@ module.exports = {
new.unitMarketplaceLink,
new.correspondingAdjustmentDeclaration,
new.correspondingAdjustmentStatus,
new.vintageId
new.issuanceId
);
END;
`);
Expand Down
4 changes: 2 additions & 2 deletions seeders/20211209204301-add-projects.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const CoBenifetStub = require('../src/models/co-benefits/co-benefits.stub.json')
const RelatedProjectStub = require('../src/models/related-projects/related-projects.stub.json');
const QualificationStub = require('../src/models/qualifications/qualifications.stub.json');
const RatingsStub = require('../src/models/ratings/ratings.stub.json');
const VintagesStub = require('../src/models/vintages/vintages.stub.json');
const IssuanceStub = require('../src/models/issuances/issuances.stub.json');
const LocationsStub = require('../src/models/locations/locations.stub.json');

module.exports = {
Expand All @@ -14,7 +14,7 @@ module.exports = {
await queryInterface.bulkInsert('relatedProjects', RelatedProjectStub, {});
await queryInterface.bulkInsert('qualifications', QualificationStub, {});
await queryInterface.bulkInsert('projectRatings', RatingsStub, {});
await queryInterface.bulkInsert('vintages', VintagesStub, {});
await queryInterface.bulkInsert('issuances', IssuanceStub, {});
await queryInterface.bulkInsert('projectLocations', LocationsStub, {});
},

Expand Down
Loading

0 comments on commit 28bb917

Please sign in to comment.