reformat with prettier with semicolons and tabs

This commit is contained in:
m5r
2021-07-31 23:57:43 +08:00
parent fc4278ca7b
commit 079241ddb0
80 changed files with 1187 additions and 1270 deletions

View File

@ -1,31 +1,31 @@
import { resolver } from "blitz"
import { z } from "zod"
import { resolver } from "blitz";
import { z } from "zod";
import db, { Prisma } from "../../../db"
import { decrypt } from "../../../db/_encryption"
import getCurrentCustomer from "../../customers/queries/get-current-customer"
import db, { Prisma } from "../../../db";
import { decrypt } from "../../../db/_encryption";
import getCurrentCustomer from "../../customers/queries/get-current-customer";
const GetConversations = z.object({
recipient: z.string(),
})
});
export default resolver.pipe(
resolver.zod(GetConversations),
resolver.authorize(),
async ({ recipient }, context) => {
const customer = await getCurrentCustomer(null, context)
const customer = await getCurrentCustomer(null, context);
const conversation = await db.message.findMany({
where: {
OR: [{ from: recipient }, { to: recipient }],
},
orderBy: { sentAt: Prisma.SortOrder.asc },
})
});
return conversation.map((message) => {
return {
...message,
content: decrypt(message.content, customer!.encryptionKey),
}
})
};
});
}
)
);