diff --git a/src/decorators/create-kweek.decorator.ts b/src/decorators/create-kweek.decorator.ts index 266e30e..86d706a 100644 --- a/src/decorators/create-kweek.decorator.ts +++ b/src/decorators/create-kweek.decorator.ts @@ -1,4 +1,5 @@ // Thanks sandeepsuvit @ https://github.com/nestjs/swagger/issues/417 +// TODO: Remove this decorator. import { ApiBody } from "@nestjs/swagger"; diff --git a/src/main.ts b/src/main.ts index 29639dd..567d43c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,6 +8,40 @@ import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger"; import { patchNestJsSwagger } from "nestjs-zod"; import { AppModule } from "./app.module"; +/* + --- Present --- + + TODO: Remove the eval on buffer type validator. <--- TOP PRIORITY. THIS IS DANGEROUS. <-- Downgrade to 16.5.4 is the solution. + TODO: Find a way to get the static url of the uploaded file. + TODO: Remove single file upload function. + TODO: Remove `create-kweek` decorator. + TODO: Finish some routes. + -> Kweek/Comments routes needs to be finished. + -> Delete User service needs more protection. + TODO: Create tests. <- Check NestJS documentation for that. + TODO: Add `user` type to @nestjs/common ---> Request. + TODO: Remove some useless information on `README`. + TODO: Check if the Dockerfile is still working. + TODO: Replace Prisma to Kysely or something more low-level. + TODO: Replace Zod to Typebox. + + --- Future --- + + TODO: Kubernetes. + TODO: Send e-mails to the user when something happens to his account. + TODO: Add a authorization system. + TODO: Create a administrator dashboard showing statistics of the platform. <- Needs front-end first I guess... + -> Only users with moderation/administration permission will be able to access it. + -> Users with moderation role can't access the statistics. + -> They will need the permission of an administrator to delete kweeks and users. + -> These users will be able to delete kweeks and terminate accounts with a obligatory reason. + -> This reason will be send to the person by e-mail and he can contest this decision. + TODO: Create a TOS. + TODO: Create the chat system. + -> Initialize the websocket system first. + TODO: Check compatibility with Bun. +*/ + async function bootstrap() { const app = await NestFactory.create( AppModule, diff --git a/src/services/s3/s3.service.ts b/src/services/s3/s3.service.ts index ddc2f71..9360b35 100644 --- a/src/services/s3/s3.service.ts +++ b/src/services/s3/s3.service.ts @@ -8,6 +8,12 @@ import sharp from "sharp"; export class S3Service { constructor(@InjectS3() private readonly s3: S3) {} + /* + TODO: Remove single image upload since we can use the multiple one. + TODO: Find a way to automatically get the image complete URL. + -> iirc, S3 api has a function for that. + */ + /** * Returns the image url if the upload to minio was successful. */ diff --git a/src/users/users.service.ts b/src/users/users.service.ts index be38f2d..b864e64 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -214,6 +214,7 @@ export class UserService { async delete(id: string) { // TODO: Add validation for safety (like e-mail confirmation or password) + // TODO: Delete the user's attachments when deleting, like Kweeks attachments and profile pictures. try { await this.prisma.user.deleteMany({ where: { id } }); return { message: "User deleted" }; diff --git a/src/validators/buffer.validator.ts b/src/validators/buffer.validator.ts index f3460bc..3fede41 100644 --- a/src/validators/buffer.validator.ts +++ b/src/validators/buffer.validator.ts @@ -9,7 +9,7 @@ export class BufferValidator implements PipeTransform { async transform(value: File) { const { fileTypeFromBuffer } = await (eval( 'import("file-type")', - ) as Promise); + ) as Promise); // TODO: Find a way to remove this eval. This is very dangerous. TOP PRIORITY. <-- Downgrade to 16.5.4 should work. const ALLOWED_MIMES = ["image/jpeg", "image/png", "image/webp"]; const buffer_type = await fileTypeFromBuffer(value.buffer);