-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow child table updates in schema
- Loading branch information
1 parent
534e01f
commit d0b5dc4
Showing
8 changed files
with
83 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import Joi from 'joi'; | ||
|
||
export const newCobenefitScheme = Joi.object({ | ||
const baseSchema = { | ||
cobenefit: Joi.string().required(), | ||
}); | ||
}; | ||
|
||
export const newCobenefitSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingCobenefitSchema = Joi.object({ | ||
cobenefitId: Joi.string().required(), | ||
id: Joi.string().required(), | ||
...baseSchema, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import Joi from 'joi'; | ||
|
||
export const newIssuanceScheme = Joi.object({ | ||
const baseSchema = { | ||
// orgUid - derived upon creation | ||
// warehouseProjectId - derived upon creation | ||
startDate: Joi.date().required(), | ||
endDate: Joi.date().required(), | ||
verificationApproach: Joi.string().required(), | ||
verificationDate: Joi.date().required(), | ||
verificationBody: Joi.string().required(), | ||
}); | ||
}; | ||
|
||
export const newIssuanceSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingIssuanceSchema = Joi.object({ | ||
issuanceId: Joi.string().required(), | ||
id: Joi.string().required(), | ||
...baseSchema, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
import Joi from 'joi'; | ||
|
||
export const newLabelScheme = Joi.object({ | ||
const baseSchema = { | ||
label: Joi.string().required(), | ||
creditingPeriodStartDate: Joi.date().required(), | ||
creditingPeriodEndDate: Joi.date().required(), | ||
validityStartDate: Joi.date().required(), | ||
validityPeriodEndDate: Joi.date().required(), | ||
unitQuantity: Joi.number().integer().required(), | ||
labelLink: Joi.string().required(), | ||
}; | ||
|
||
export const newLabelSchema = Joi.object({ | ||
...baseSchema, | ||
}); | ||
|
||
export const existingLabelScheme = Joi.object({ | ||
labelId: Joi.string().required(), | ||
export const existingLabelSchema = Joi.object({ | ||
id: Joi.string().required(), | ||
...baseSchema, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import Joi from 'joi'; | ||
|
||
export const newLocationScheme = Joi.object({ | ||
const baseSchema = { | ||
country: Joi.string().required(), | ||
inCountryRegion: Joi.string().required(), | ||
geographicIdentifier: Joi.string().required(), | ||
}); | ||
}; | ||
|
||
export const newLocationSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingLocationSchema = Joi.object({ | ||
projectLocationId: Joi.string().required(), | ||
id: Joi.string().required(), | ||
...baseSchema, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import Joi from 'joi'; | ||
|
||
export const newRatingScheme = Joi.object({ | ||
const baseSchema = { | ||
ratingType: Joi.string().required(), | ||
ratingRangeHighest: Joi.number().integer().required(), | ||
ratingRangeLowest: Joi.number().integer().required(), | ||
rating: Joi.number().integer().required(), | ||
ratingLink: Joi.string().optional(), | ||
}); | ||
}; | ||
|
||
export const newRatingSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingRatingSchema = Joi.object({ | ||
ratingId: Joi.string().required(), | ||
id: Joi.string().required(), | ||
...baseSchema, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import Joi from 'joi'; | ||
|
||
export const newRelatedProjectScheme = Joi.object({ | ||
const baseSchema = { | ||
// warehouseProjectId - derived upon creation | ||
relationshipType: Joi.string().optional(), | ||
registry: Joi.string().optional(), | ||
}); | ||
}; | ||
|
||
export const newRelatedProjectSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingRelatedProjectSchema = Joi.object({ | ||
relatedProjectId: Joi.string().required(), | ||
id: Joi.string().required(), | ||
...baseSchema, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters