feat: finish migrating to new objectid naming

This commit is contained in:
Huskydog9988
2025-05-08 19:42:46 -04:00
committed by DecDuck
parent 7f7d8c8f45
commit 14f0833d17
11 changed files with 24 additions and 18 deletions

View File

@ -80,11 +80,11 @@
]"
>
<div
v-if="article.image"
v-if="article.imageObjectId"
class="absolute inset-0 rounded-lg transition-all duration-200 overflow-hidden"
>
<img
:src="useObject(article.image)"
:src="useObject(article.imageObjectId)"
class="absolute blur-sm inset-0 w-full h-full object-cover transition-all duration-200 group-hover:scale-110"
/>
<div

View File

@ -4,7 +4,7 @@
<UserHeaderWidget>
<div class="inline-flex items-center text-zinc-300 hover:text-white">
<img
:src="useObject(user.profilePicture)"
:src="useObject(user.profilePictureObjectId)"
class="w-5 h-5 rounded-sm"
/>
<span class="ml-2 text-sm font-bold">{{ user.displayName }}</span>
@ -31,7 +31,7 @@
>
<div class="inline-flex items-center text-zinc-300">
<img
:src="useObject(user.profilePicture)"
:src="useObject(user.profilePictureObjectId)"
class="w-5 h-5 rounded-sm"
/>
<span class="ml-2 text-sm font-bold">{{ user.displayName }}</span>

View File

@ -4,9 +4,9 @@
<div v-if="article" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<!-- Banner header with blurred background -->
<div class="relative w-full h-[300px] mb-8 rounded-lg overflow-hidden">
<div v-if="article.image" class="absolute inset-0">
<div v-if="article.imageObjectId" class="absolute inset-0">
<img
:src="useObject(article.image)"
:src="useObject(article.imageObjectId)"
alt=""
class="w-full h-full object-cover blur-sm scale-110"
/>

View File

@ -26,8 +26,8 @@
>
<div class="relative h-48 w-full overflow-hidden">
<img
v-if="article.image"
:src="useObject(article.image)"
v-if="article.imageObjectId"
:src="useObject(article.imageObjectId)"
alt=""
class="h-full w-full object-cover object-center transition-all duration-500 group-hover:scale-110 scale-105"
/>

View File

@ -8,3 +8,9 @@ ALTER TABLE "Game" RENAME COLUMN "mImageLibrary" TO "mImageLibraryObjectIds";
-- Rename saveslot table columns
ALTER TABLE "SaveSlot" RENAME COLUMN "history" TO "historyObjectIds";
-- Rename article table columns
ALTER TABLE "Article" RENAME COLUMN "image" TO "imageObjectId";
-- Rename user table columns
ALTER TABLE "User" RENAME COLUMN "profilePicture" TO "profilePictureObjectId";

View File

@ -13,8 +13,8 @@ model Article {
tags Tag[]
image String? // Object ID
publishedAt DateTime @default(now())
imageObjectId String? // Object ID
publishedAt DateTime @default(now())
author User? @relation(fields: [authorId], references: [id]) // Optional, if no user, it's a system post
authorId String?

View File

@ -4,9 +4,9 @@ model User {
admin Boolean @default(false)
enabled Boolean @default(true)
email String
displayName String
profilePicture String // Object
email String
displayName String
profilePictureObjectId String // Object
authMecs LinkedAuthMec[]
clients Client[]

View File

@ -77,7 +77,7 @@ export default defineEventHandler(async (h3) => {
username: user.username,
displayName: user.displayName ?? user.username,
email: user.email,
profilePicture: profilePictureId,
profilePictureObjectId: profilePictureId,
admin: invitation.isAdmin,
},
},

View File

@ -127,8 +127,8 @@ class NewsManager {
const article = await prisma.article.delete({
where: { id },
});
if (article.image) {
return await objectHandler.deleteAsSystem(article.image);
if (article.imageObjectId) {
return await objectHandler.deleteAsSystem(article.imageObjectId);
}
return true;
}

View File

@ -276,7 +276,7 @@ export class OIDCManager {
username,
email: userinfo.email ?? "",
displayName: userinfo.name ?? username,
profilePicture: profilePictureId,
profilePictureObjectId: profilePictureId,
admin: isAdmin,
},
},

View File

@ -16,7 +16,7 @@ export default defineNitroPlugin(async (_nitro) => {
displayName: "System",
username: "system",
email: "system@drop",
profilePicture: "",
profilePictureObjectId: "",
},
update: {
admin: true,