-
Notifications
You must be signed in to change notification settings - Fork 17
Added API end points for creating and viewing review roles #2159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
|
||
onUpdateReviewRole(req: Request, reviewRole: ReviewRoleInterface) { | ||
this.checkEventType(AuditInfo.CreateReviewRole, req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CreateReviewRole
?
} | ||
|
||
onViewReviewRoles(req: Request) { | ||
this.checkEventType(AuditInfo.ViewReviewRole, req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViewReviewRole
?
backend/src/models/ReviewRole.ts
Outdated
}, | ||
{ | ||
timestamps: true, | ||
collection: 'v2_webhooks', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2_webhooks
?
backend/src/connectors/audit/Base.ts
Outdated
description: 'Created a new review role', | ||
auditKind: AuditKind.Create, | ||
}, | ||
ViewReviewRole: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be ViewReviewRoles
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added both in case we want a dedicated end point for viewing single review roles by id in the future
backend/src/connectors/audit/Base.ts
Outdated
@@ -192,6 +203,11 @@ export abstract class BaseAuditConnector { | |||
importResult: MongoDocumentImportInformation | FileImportInformation, | |||
) | |||
|
|||
abstract onCreateReviewRole(req: Request, reviewRole: ReviewRoleInterface) | |||
abstract onUpdateReviewRole(req: Request, reviewRole: ReviewRoleInterface) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be pre-emptive, but I thought I'd cover possible future end points that might allow for modifying review roles.
backend/src/connectors/audit/Base.ts
Outdated
@@ -192,6 +203,11 @@ export abstract class BaseAuditConnector { | |||
importResult: MongoDocumentImportInformation | FileImportInformation, | |||
) | |||
|
|||
abstract onCreateReviewRole(req: Request, reviewRole: ReviewRoleInterface) | |||
abstract onUpdateReviewRole(req: Request, reviewRole: ReviewRoleInterface) | |||
abstract onViewReviewRole(req: Request, reviewRoles: ReviewRoleInterface) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For simplicity I'd rather we just add audit stuff for the stuff we have rather than including code for stuff we might have in the future
} catch (error) { | ||
handleDuplicateKeys(error) | ||
throw error | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For other create service functions, we normally return the new mongo model
Review roles are a WIP part of dynamic role work. Bailo currently relies on statically defined review roles, whereas in the future we want admins to be able to create whatever role they want for the review process.