diff --git a/prisma/migrations/20240706074316_size_key/migration.sql b/prisma/migrations/20240706074316_size_key/migration.sql new file mode 100644 index 0000000..18e219c --- /dev/null +++ b/prisma/migrations/20240706074316_size_key/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Added the required column `size` to the `Upload` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE `Upload` ADD COLUMN `size` BIGINT NOT NULL; diff --git a/prisma/migrations/20240706074424_am_i_crazy/migration.sql b/prisma/migrations/20240706074424_am_i_crazy/migration.sql new file mode 100644 index 0000000..1f42d1a --- /dev/null +++ b/prisma/migrations/20240706074424_am_i_crazy/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - You are about to alter the column `size` on the `Upload` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + +*/ +-- AlterTable +ALTER TABLE `Upload` MODIFY `size` INTEGER NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 33e2c61..19ef386 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -53,6 +53,7 @@ model Upload { fileName String @db.LongText internalName String @db.LongText + size Int public Boolean @default(true) uploaded DateTime @default(now()) } diff --git a/src/lib/components/File.svelte b/src/lib/components/File.svelte index 8fc06dc..5200eff 100644 --- a/src/lib/components/File.svelte +++ b/src/lib/components/File.svelte @@ -35,9 +35,13 @@ >
{#if url} - {file.name} + {file.name} {:else} -

{file.name}

+

{file.name}

{/if}
diff --git a/src/lib/components/ThemeHandler.svelte b/src/lib/components/ThemeHandler.svelte index c443267..62f715b 100644 --- a/src/lib/components/ThemeHandler.svelte +++ b/src/lib/components/ThemeHandler.svelte @@ -1,5 +1,6 @@ + +{#await data.uploads then uploads} + +
+ +

{$pageIndex + 1} / {Math.ceil(data.totalUploads / 15)}

+ +
+{/await} diff --git a/src/routes/api/upload/+server.ts b/src/routes/api/upload/+server.ts index c42b658..9156bef 100644 --- a/src/routes/api/upload/+server.ts +++ b/src/routes/api/upload/+server.ts @@ -35,7 +35,7 @@ export const POST = async ({ request, cookies }) => { if (!object) return error(500, { status: 500, message: 'Internal Server Error - Contact Administrator' }); - const objectRecord = await createUpload(id, user.id, file.name, internalName); + const objectRecord = await createUpload(id, user.id, file.name, internalName, file.size); if (!objectRecord) return error(500, { status: 500, message: 'Internal Server Error - Contact Administrator' });