feat: Base implementation of v2 of avatars (#12369)
* feat: Base implementation of v2 of avatars * Make avatarUrl and logoUrl entirely optional * Made necessary backwards compat changes * fix: type errors * Fix: OG image * fix types * Consistency with other behaviour, ux tweak --------- Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
c55b36f235
commit
4f26ca1a7b
18 files changed
+258
-69
No files matched your search
@@ -0,0 +1,19 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Team" ADD COLUMN "logoUrl" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "users" ADD COLUMN "avatarUrl" TEXT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "avatars" (
|
||||
"teamId" INTEGER NOT NULL DEFAULT 0,
|
||||
"userId" INTEGER NOT NULL DEFAULT 0,
|
||||
"data" TEXT NOT NULL,
|
||||
"objectKey" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "avatars_objectKey_key" ON "avatars"("objectKey");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "avatars_teamId_userId_key" ON "avatars"("teamId", "userId");
|
||||
@@ -192,6 +192,7 @@ model User {
|
||||
password String?
|
||||
bio String?
|
||||
avatar String?
|
||||
avatarUrl String?
|
||||
timeZone String @default("Europe/London")
|
||||
weekStart String @default("Sunday")
|
||||
// DEPRECATED - TO BE REMOVED
|
||||
@@ -279,6 +280,7 @@ model Team {
|
||||
/// @zod.min(1)
|
||||
slug String?
|
||||
logo String?
|
||||
logoUrl String?
|
||||
appLogo String?
|
||||
appIconLogo String?
|
||||
bio String?
|
||||
@@ -1011,3 +1013,17 @@ model TempOrgRedirect {
|
||||
|
||||
@@unique([from, type, fromOrgId])
|
||||
}
|
||||
|
||||
model Avatar {
|
||||
// e.g. NULL(0), organization ID or team logo
|
||||
teamId Int @default(0)
|
||||
// Avatar, NULL(0) if team logo
|
||||
userId Int @default(0)
|
||||
// base64 string
|
||||
data String
|
||||
// different every time to pop the cache.
|
||||
objectKey String @unique
|
||||
|
||||
@@unique([teamId, userId])
|
||||
@@map(name: "avatars")
|
||||
}
|
||||
Reference in new issue
Block a user