replace early returns with NotFoundError
test /api/webhook/incoming-message
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { resolver } from "blitz";
|
||||
import { NotFoundError, resolver } from "blitz";
|
||||
import { z } from "zod";
|
||||
|
||||
import db, { Prisma } from "../../../db";
|
||||
@ -12,7 +12,7 @@ const GetConversations = z.object({
|
||||
export default resolver.pipe(resolver.zod(GetConversations), resolver.authorize(), async ({ recipient }, context) => {
|
||||
const customer = await getCurrentCustomer(null, context);
|
||||
if (!customer) {
|
||||
return;
|
||||
throw new NotFoundError();
|
||||
}
|
||||
|
||||
const conversation = await db.message.findMany({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { resolver } from "blitz";
|
||||
import { resolver, NotFoundError } from "blitz";
|
||||
|
||||
import db, { Direction, Message, Prisma } from "../../../db";
|
||||
import getCurrentCustomer from "../../customers/queries/get-current-customer";
|
||||
@ -7,7 +7,7 @@ import { decrypt } from "../../../db/_encryption";
|
||||
export default resolver.pipe(resolver.authorize(), async (_ = null, context) => {
|
||||
const customer = await getCurrentCustomer(null, context);
|
||||
if (!customer) {
|
||||
return;
|
||||
throw new NotFoundError();
|
||||
}
|
||||
|
||||
const messages = await db.message.findMany({
|
||||
|
Reference in New Issue
Block a user