reformat with prettier with semicolons and tabs
This commit is contained in:
@ -1,24 +1,24 @@
|
||||
import { resolver } from "blitz"
|
||||
import { z } from "zod"
|
||||
import { resolver } from "blitz";
|
||||
import { z } from "zod";
|
||||
|
||||
import db, { Direction, MessageStatus } from "../../../db"
|
||||
import getCurrentCustomer from "../../customers/queries/get-current-customer"
|
||||
import getCustomerPhoneNumber from "../../phone-numbers/queries/get-customer-phone-number"
|
||||
import { encrypt } from "../../../db/_encryption"
|
||||
import sendMessageQueue from "../../api/queue/send-message"
|
||||
import db, { Direction, MessageStatus } from "../../../db";
|
||||
import getCurrentCustomer from "../../customers/queries/get-current-customer";
|
||||
import getCustomerPhoneNumber from "../../phone-numbers/queries/get-customer-phone-number";
|
||||
import { encrypt } from "../../../db/_encryption";
|
||||
import sendMessageQueue from "../../api/queue/send-message";
|
||||
|
||||
const Body = z.object({
|
||||
content: z.string(),
|
||||
to: z.string(),
|
||||
})
|
||||
});
|
||||
|
||||
export default resolver.pipe(
|
||||
resolver.zod(Body),
|
||||
resolver.authorize(),
|
||||
async ({ content, to }, context) => {
|
||||
const customer = await getCurrentCustomer(null, context)
|
||||
const customerId = customer!.id
|
||||
const customerPhoneNumber = await getCustomerPhoneNumber({ customerId }, context)
|
||||
const customer = await getCurrentCustomer(null, context);
|
||||
const customerId = customer!.id;
|
||||
const customerPhoneNumber = await getCustomerPhoneNumber({ customerId }, context);
|
||||
|
||||
const message = await db.message.create({
|
||||
data: {
|
||||
@ -30,7 +30,7 @@ export default resolver.pipe(
|
||||
content: encrypt(content, customer!.encryptionKey),
|
||||
sentAt: new Date(),
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
await sendMessageQueue.enqueue(
|
||||
{
|
||||
@ -42,6 +42,6 @@ export default resolver.pipe(
|
||||
{
|
||||
id: message.id,
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
Reference in New Issue
Block a user