feat: enhance RefundTicketSchema with additional role checks for refund requests
- Updated RefundTicketSchema to include CENTER_OWNER in the authorization check for refund requests, ensuring that only authorized roles can request refunds. - Improved error handling to provide clearer feedback for unauthorized access attempts. These changes enhance the security and functionality of the refund ticket process, ensuring proper role validation and user experience.
This commit is contained in:
@@ -139,7 +139,11 @@ export class RefundTicketSchema extends PothosSchema {
|
|||||||
throw new Error('Unauthorized')
|
throw new Error('Unauthorized')
|
||||||
}
|
}
|
||||||
// Check if the user is a customer or a center mentor
|
// Check if the user is a customer or a center mentor
|
||||||
if (ctx.http.me?.role !== Role.CUSTOMER && ctx.http.me?.role !== Role.CENTER_MENTOR) {
|
if (
|
||||||
|
ctx.http.me?.role !== Role.CUSTOMER &&
|
||||||
|
ctx.http.me?.role !== Role.CENTER_MENTOR &&
|
||||||
|
ctx.http.me?.role !== Role.CENTER_OWNER
|
||||||
|
) {
|
||||||
throw new Error('Only customers and center mentors can request refund')
|
throw new Error('Only customers and center mentors can request refund')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user