Skip to content

Commit

Permalink
Referencing RULE_TYPES when constructing schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Miller committed Nov 26, 2019
1 parent 6242516 commit 87def6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/mds-schema-validators/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
VEHICLE_EVENTS,
AUDIT_EVENT_TYPE,
VEHICLE_EVENT,
RULE_TYPES,
UUID,
Timestamp,
Telemetry
Expand Down Expand Up @@ -89,7 +90,7 @@ const ruleSchema = Joi.object().keys({
.guid()
.required(),
rule_type: Joi.string()
.valid(['count', 'time', 'speed', 'user'])
.valid(RULE_TYPES)
.required(),
rule_units: Joi.string().valid(['seconds', 'minutes', 'hours', 'mph', 'kph']),
geographies: Joi.array().items(Joi.string().guid()),
Expand Down
2 changes: 1 addition & 1 deletion packages/mds-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const isEnum = (enums: { [key: string]: string }, value: unknown) =>
export const VEHICLE_TYPES = Enum('car', 'bicycle', 'scooter', 'recumbent')
export type VEHICLE_TYPE = keyof typeof VEHICLE_TYPES

export const RULE_TYPES = Enum('count', 'speed', 'time')
export const RULE_TYPES = Enum('count', 'speed', 'time', 'user')
export type RULE_TYPE = keyof typeof RULE_TYPES

export const RULE_UNIT_MAP = {
Expand Down

0 comments on commit 87def6e

Please sign in to comment.