chore: update biome configuration and enhance error handling in schema files
- Enabled useIgnoreFile in biome.json for better file management. - Updated various correctness and style rules in biome.json to enforce stricter coding standards. - Added new biome lint command in package.json for improved code quality checks. - Refactored error handling in multiple schema files to use consistent error throwing patterns, enhancing readability and maintainability. - Improved user authentication checks across various schemas to ensure proper access control.
This commit is contained in:
@@ -117,8 +117,12 @@ export class OrderSchema extends PothosSchema {
|
||||
description: 'Retrieve a list of completed orders',
|
||||
args: this.builder.generator.findManyArgs('Order'),
|
||||
resolve: async (query, _root, args, ctx, _info) => {
|
||||
if (ctx.isSubscription) throw new Error('Orders cannot be retrieved in subscription context')
|
||||
if (!ctx.http.me) throw new Error('Unauthorized')
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Orders cannot be retrieved in subscription context')
|
||||
}
|
||||
if (!ctx.http.me) {
|
||||
throw new Error('Unauthorized')
|
||||
}
|
||||
// return orders where user is the one who made the order and status is PAID and schedule.dates is in the past
|
||||
return await this.prisma.order.findMany({
|
||||
...query,
|
||||
|
||||
Reference in New Issue
Block a user