Skip to content

Commit

Permalink
Refactor schema
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Mar 17, 2020
1 parent b1ea620 commit 2a831fc
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,20 @@ export const UserSchema = schema.object({
username: schema.string(),
});

export const EntityInformationSchema = schema.object({
const EntityInformationSchemaProps = {
createdAt: schema.string(),
createdBy: UserSchema,
updatedAt: schema.nullable(schema.string()),
updatedBy: schema.nullable(UserSchema),
});
};

export const EntityInformationSchema = schema.object(EntityInformationSchemaProps);

export const CommentSchema = schema.object({
commentId: schema.string(),
comment: schema.string(),
version: schema.maybe(schema.string()),
createdAt: schema.string(),
createdBy: UserSchema,
updatedAt: schema.nullable(schema.string()),
updatedBy: schema.nullable(UserSchema),
...EntityInformationSchemaProps,
});

export const ExecutorAction = schema.oneOf([
Expand All @@ -67,8 +66,5 @@ export const ParamsSchema = schema.object({
comments: schema.maybe(schema.arrayOf(CommentSchema)),
description: schema.maybe(schema.string()),
incidentId: schema.nullable(schema.string()),
createdAt: schema.string(),
createdBy: UserSchema,
updatedAt: schema.nullable(schema.string()),
updatedBy: schema.nullable(UserSchema),
...EntityInformationSchemaProps,
});

0 comments on commit 2a831fc

Please sign in to comment.