case insensitive names
This commit is contained in:
parent
bf6b2befde
commit
38ba31f2b4
|
@ -45,7 +45,7 @@ export default {
|
||||||
let notifications = await models.$queryRaw(`
|
let notifications = await models.$queryRaw(`
|
||||||
SELECT ${ITEM_FIELDS}, "Item".created_at as "sortTime", NULL as "earnedSats",
|
SELECT ${ITEM_FIELDS}, "Item".created_at as "sortTime", NULL as "earnedSats",
|
||||||
false as mention
|
false as mention
|
||||||
From "Item"
|
FROM "Item"
|
||||||
JOIN "Item" p ON "Item"."parentId" = p.id
|
JOIN "Item" p ON "Item"."parentId" = p.id
|
||||||
WHERE p."userId" = $1
|
WHERE p."userId" = $1
|
||||||
AND "Item"."userId" <> $1 AND "Item".created_at <= $2
|
AND "Item"."userId" <> $1 AND "Item".created_at <= $2
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default {
|
||||||
throw new AuthenticationError('you must be logged in')
|
throw new AuthenticationError('you must be logged in')
|
||||||
}
|
}
|
||||||
|
|
||||||
return me.name === name || !(await models.user.findUnique({ where: { name } }))
|
return me.name?.toUpperCase() === name?.toUpperCase() || !(await models.user.findUnique({ where: { name } }))
|
||||||
},
|
},
|
||||||
recentlyStacked: async (parent, args, { models, me }) => {
|
recentlyStacked: async (parent, args, { models, me }) => {
|
||||||
if (!me) {
|
if (!me) {
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- A unique constraint covering the columns `[name]` on the table `users` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
CREATE EXTENSION IF NOT EXISTS citext;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE users ALTER COLUMN name TYPE citext;
|
|
@ -14,7 +14,7 @@ model User {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
createdAt DateTime @default(now()) @map(name: "created_at")
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
||||||
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
|
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
|
||||||
name String? @unique
|
name String? @unique @db.Citext
|
||||||
email String? @unique
|
email String? @unique
|
||||||
emailVerified DateTime? @map(name: "email_verified")
|
emailVerified DateTime? @map(name: "email_verified")
|
||||||
image String?
|
image String?
|
||||||
|
|
Loading…
Reference in New Issue