Skip to content

Commit

Permalink
feat: bring models in line with migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeen committed Dec 5, 2021
1 parent d1ea528 commit 5c0fdad
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 72 deletions.
47 changes: 25 additions & 22 deletions models/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,31 @@ module.exports = (sequelize, DataTypes) => {
}
};
Project.init({
currentRegistry: DataTypes.STRING,
registryOfOrigin: DataTypes.STRING,
originProjectId: DataTypes.NUMBER,
program: DataTypes.STRING,
warehouseProjectId: DataTypes.NUMBER,
projectName: DataTypes.STRING,
projectLink: DataTypes.STRING,
projectDeveloper: DataTypes.STRING,
sector: DataTypes.STRING,
projectType: DataTypes.STRING,
coveredByNDC: DataTypes.STRING,
NDCLinkage: DataTypes.STRING,
projectStatus: DataTypes.STRING,
projectStatusDate: DataTypes.DATE,
unitMetric: DataTypes.STRING,
methodology: DataTypes.STRING,
methodologyVersion: DataTypes.STRING,
validationApproach: DataTypes.STRING,
validationDate: DataTypes.DATE,
projectTag: DataTypes.STRING,
estimatedAnnualAverageEmmisionReduction: DataTypes.STRING,
owner: DataTypes.STRING
id: Sequelize.INTEGER,
currentRegistry: Sequelize.STRING,
registryOfOrigin: Sequelize.STRING,
originProjectId: Sequelize.NUMBER,
program: Sequelize.STRING,
warehouseProjectId: Sequelize.NUMBER,
projectName: Sequelize.STRING,
projectLink: Sequelize.STRING,
projectDeveloper: Sequelize.STRING,
sector: Sequelize.STRING,
projectType: Sequelize.STRING,
coveredByNDC: Sequelize.STRING,
NDCLinkage: Sequelize.STRING,
projectStatus: Sequelize.STRING,
projectStatusDate: Sequelize.DATE,
unitMetric: Sequelize.STRING,
methodology: Sequelize.STRING,
methodologyVersion: Sequelize.STRING,
validationApproach: Sequelize.STRING,
validationDate: Sequelize.DATE,
projectTag: Sequelize.STRING,
estimatedAnnualAverageEmmisionReduction: Sequelize.STRING,
owner: Sequelize.STRING,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE,
}, {
sequelize,
modelName: 'Project',
Expand Down
11 changes: 7 additions & 4 deletions models/projectlocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ module.exports = (sequelize, DataTypes) => {
}
};
ProjectLocation.init({
countryRegion: DataTypes.STRING,
country: DataTypes.STRING,
owner: DataTypes.STRING,
projectId: DataTypes.NUMBER
id: Sequelize.INTEGER,
countryRegion: Sequelize.STRING,
country: Sequelize.STRING,
owner: Sequelize.STRING,
projectId: Sequelize.NUMBER,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE,
}, {
sequelize,
modelName: 'ProjectLocation',
Expand Down
15 changes: 9 additions & 6 deletions models/projectrating.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ module.exports = (sequelize, DataTypes) => {
}
};
ProjectRating.init({
ratingType: DataTypes.STRING,
rating: DataTypes.NUMBER,
link: DataTypes.STRING,
scale: DataTypes.STRING,
owner: DataTypes.STRING,
projectId: DataTypes.NUMBER
id: Sequelize.INTEGER,
ratingType: Sequelize.STRING,
rating: Sequelize.NUMBER,
link: Sequelize.STRING,
scale: Sequelize.STRING,
owner: Sequelize.STRING,
projectId: Sequelize.NUMBER,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE,
}, {
sequelize,
modelName: 'ProjectRating',
Expand Down
20 changes: 13 additions & 7 deletions models/qualification.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ module.exports = (sequelize, DataTypes) => {
}
};
Qualification.init({
projectId: DataTypes.NUMBER,
type: DataTypes.STRING,
label: DataTypes.STRING,
creditingPeriodStartDate: DataTypes.DATE,
creditingPeriodEndDate: DataTypes.DATE,
owner: DataTypes.STRING,
unitId: DataTypes.NUMBER
id: Sequelize.INTEGER,
projectId: Sequelize.NUMBER,
type: Sequelize.STRING,
label: Sequelize.STRING,
creditingPeriodStartDate: Sequelize.DATE,
creditingPeriodEndDate: Sequelize.DATE,
validityStartDate: Sequelize.DATE,
validityEndDate: Sequelize.DATE,
unitQuantity: Sequelize.NUMBER,
owner: Sequelize.STRING,
unitId: Sequelize.NUMBER,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE,
}, {
sequelize,
modelName: 'Qualification',
Expand Down
13 changes: 8 additions & 5 deletions models/relatedproject.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ module.exports = (sequelize, DataTypes) => {
}
};
RelatedProject.init({
relatedProjectType: DataTypes.STRING,
registry: DataTypes.STRING,
note: DataTypes.STRING,
owner: DataTypes.STRING,
projectId: DataTypes.NUMBER
id: Sequelize.INTEGER,
relatedProjectType: Sequelize.STRING,
registry: Sequelize.STRING,
note: Sequelize.STRING,
owner: Sequelize.STRING,
projectId: Sequelize.NUMBER,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE
}, {
sequelize,
modelName: 'RelatedProject',
Expand Down
42 changes: 21 additions & 21 deletions models/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ module.exports = (sequelize, DataTypes) => {
}
};
Unit.init({
owner: DataTypes.STRING,
buyer: DataTypes.STRING,
registry: DataTypes.STRING,
blockIdentifier: DataTypes.STRING,
identifier: DataTypes.STRING,
qualificationId: DataTypes.NUMBER,
unitType: DataTypes.STRING,
unitCount: DataTypes.NUMBER,
unitStatus: DataTypes.STRING,
unitStatusDate: DataTypes.DATE,
transactionType: DataTypes.STRING,
unitIssuanceLocation: DataTypes.STRING,
unitLink: DataTypes.STRING,
correspondingAdjustment: DataTypes.STRING,
unitTag: DataTypes.STRING,
vintageId: DataTypes.NUMBER,
qualificationId: DataTypes.NUMBER,
owner: DataTypes.STRING
}, {
sequelize,
modelName: 'Unit',
id: Sequelize.INTEGER,
owner: Sequelize.STRING,
buyer: Sequelize.STRING,
registry: Sequelize.STRING,
blockIdentifier: Sequelize.STRING,
identifier: Sequelize.STRING,
qualificationId: Sequelize.NUMBER,
unitType: Sequelize.STRING,
unitCount: Sequelize.NUMBER,
unitStatus: Sequelize.STRING,
unitStatusDate: Sequelize.DATE,
transactionType: Sequelize.STRING,
unitIssuanceLocation: Sequelize.STRING,
unitLink: Sequelize.STRING,
correspondingAdjustment: Sequelize.STRING,
unitTag: Sequelize.STRING,
vintageId: Sequelize.NUMBER,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE}, {
sequelize,
modelName: 'Unit',
});
return Unit;
};
17 changes: 10 additions & 7 deletions models/vintage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ module.exports = (sequelize, DataTypes) => {
}
};
Vintage.init({
startDate: DataTypes.DATE,
endDate: DataTypes.DATE,
verificationApproach: DataTypes.STRING,
verificationDate: DataTypes.DATE,
verificationBody: DataTypes.STRING,
owner: DataTypes.STRING,
projectId: DataTypes.NUMBER
id: Sequelize.INTEGER,
startDate: Sequelize.DATE,
endDate: Sequelize.DATE,
verificationApproach: Sequelize.STRING,
verificationDate: Sequelize.DATE,
verificationBody: Sequelize.STRING,
owner: Sequelize.STRING,
projectId: Sequelize.NUMBER,
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE,
}, {
sequelize,
modelName: 'Vintage',
Expand Down

0 comments on commit 5c0fdad

Please sign in to comment.