brutalism design
This commit is contained in:
@@ -19,9 +19,8 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
},
|
||||
async (req, reply) => {
|
||||
const user = await fastify.prisma.user.findFirst({
|
||||
where: { username: req.query.username, id: req.query.id },
|
||||
where: { username: req.query.username },
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
displayName: true,
|
||||
createdAt: true,
|
||||
@@ -55,8 +54,8 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
const user = req.user!
|
||||
|
||||
const preferences = await fastify.prisma.userPreferences.upsert({
|
||||
where: { userId: user.id },
|
||||
create: { userId: user.id },
|
||||
where: { username: user.username },
|
||||
create: { username: user.username },
|
||||
update: {},
|
||||
})
|
||||
|
||||
@@ -81,9 +80,9 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
const user = req.user!
|
||||
|
||||
return fastify.prisma.userPreferences.upsert({
|
||||
where: { userId: user.id },
|
||||
where: { username: user.username },
|
||||
create: {
|
||||
userId: user.id,
|
||||
username: user.username,
|
||||
...req.body,
|
||||
},
|
||||
update: req.body,
|
||||
@@ -108,12 +107,11 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
const user = req.user!
|
||||
|
||||
const updatedUser = await fastify.prisma.user.update({
|
||||
where: { id: user.id },
|
||||
where: { username: user.username },
|
||||
data: {
|
||||
displayName: req.body.displayName,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
displayName: true,
|
||||
createdAt: true,
|
||||
|
||||
Reference in New Issue
Block a user