chore: added todos

This commit is contained in:
Cookie 2024-05-03 22:27:34 +01:00
parent 2eaa2294da
commit c82f605d6e
5 changed files with 43 additions and 1 deletions

View file

@ -1,4 +1,5 @@
// Thanks sandeepsuvit @ https://github.com/nestjs/swagger/issues/417
// TODO: Remove this decorator.
import { ApiBody } from "@nestjs/swagger";

View file

@ -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<NestFastifyApplication>(
AppModule,

View file

@ -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.
*/

View file

@ -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" };

View file

@ -9,7 +9,7 @@ export class BufferValidator implements PipeTransform {
async transform(value: File) {
const { fileTypeFromBuffer } = await (eval(
'import("file-type")',
) as Promise<typeof import("file-type")>);
) as Promise<typeof import("file-type")>); // 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);