-
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: remove extraneous joi alternative schemas
- Loading branch information
1 parent
5a45a35
commit 12357ce
Showing
8 changed files
with
28 additions
and
97 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,12 +1,6 @@ | ||
import Joi from 'joi'; | ||
|
||
const baseSchema = { | ||
export const cobenefitSchema = Joi.object({ | ||
id: Joi.string().optional(), | ||
cobenefit: Joi.string().required(), | ||
}; | ||
|
||
export const newCobenefitSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingCobenefitSchema = 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,18 +1,12 @@ | ||
import Joi from 'joi'; | ||
|
||
const baseSchema = { | ||
export const issuanceSchema = Joi.object({ | ||
// orgUid - derived upon creation | ||
// warehouseProjectId - derived upon creation | ||
id: Joi.string().optional(), | ||
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({ | ||
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,20 +1,12 @@ | ||
import Joi from 'joi'; | ||
|
||
const baseSchema = { | ||
export const labelSchema = Joi.object({ | ||
id: Joi.string().optional(), | ||
label: Joi.string().required(), | ||
creditingPeriodStartDate: Joi.string().required(), | ||
creditingPeriodEndDate: Joi.string().required(), | ||
validityPeriodStartDate: Joi.string().required(), | ||
validityPeriodEndDate: Joi.string().required(), | ||
unitQuantity: Joi.number().integer().required(), | ||
labelLink: Joi.string().required(), | ||
}; | ||
|
||
export const newLabelSchema = Joi.object({ | ||
...baseSchema, | ||
}); | ||
|
||
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,14 +1,8 @@ | ||
import Joi from 'joi'; | ||
|
||
const baseSchema = { | ||
export const locationSchema = Joi.object({ | ||
id: Joi.string().optional(), | ||
country: Joi.string().required(), | ||
inCountryRegion: Joi.string().required(), | ||
geographicIdentifier: Joi.string().required(), | ||
}; | ||
|
||
export const newLocationSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingLocationSchema = 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
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,16 +1,10 @@ | ||
import Joi from 'joi'; | ||
|
||
const baseSchema = { | ||
export const ratingSchema = Joi.object({ | ||
id: Joi.string().optional(), | ||
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({ | ||
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,14 +1,8 @@ | ||
import Joi from 'joi'; | ||
|
||
const baseSchema = { | ||
export const relatedProjectSchema = Joi.object({ | ||
// warehouseProjectId - derived upon creation | ||
id: Joi.string().optional(), | ||
relationshipType: Joi.string().optional(), | ||
registry: Joi.string().optional(), | ||
}; | ||
|
||
export const newRelatedProjectSchema = Joi.object({ ...baseSchema }); | ||
|
||
export const existingRelatedProjectSchema = 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