feat: remove appwrite and add nextjs backend

This commit is contained in:
Elias Schneider
2022-10-09 22:30:32 +02:00
parent 7728351158
commit 4bab33ad8a
153 changed files with 13400 additions and 2811 deletions

View File

@@ -0,0 +1,18 @@
import { Type } from "class-transformer";
import { IsString, Matches, ValidateNested } from "class-validator";
import { ShareSecurityDTO } from "./shareSecurity.dto";
export class CreateShareDTO {
@IsString()
@Matches("^[a-zA-Z0-9_-]*$", undefined, {
message: "ID only can contain letters, numbers, underscores and hyphens",
})
id: string;
@IsString()
expiration: string;
@ValidateNested()
@Type(() => ShareSecurityDTO)
security: ShareSecurityDTO;
}

View File

@@ -0,0 +1,20 @@
import { Expose, plainToClass } from "class-transformer";
import { ShareDTO } from "./share.dto";
export class MyShareDTO extends ShareDTO {
@Expose()
views: number;
@Expose()
createdAt: Date;
from(partial: Partial<MyShareDTO>) {
return plainToClass(MyShareDTO, partial, { excludeExtraneousValues: true });
}
fromList(partial: Partial<MyShareDTO>[]) {
return partial.map((part) =>
plainToClass(MyShareDTO, part, { excludeExtraneousValues: true })
);
}
}

View File

@@ -0,0 +1,29 @@
import { Expose, plainToClass, Type } from "class-transformer";
import { AuthDTO } from "src/auth/dto/auth.dto";
import { FileDTO } from "src/file/dto/file.dto";
export class ShareDTO {
@Expose()
id: string;
@Expose()
expiration: Date;
@Expose()
@Type(() => FileDTO)
files: FileDTO[];
@Expose()
@Type(() => AuthDTO)
creator: AuthDTO;
from(partial: Partial<ShareDTO>) {
return plainToClass(ShareDTO, partial, { excludeExtraneousValues: true });
}
fromList(partial: Partial<ShareDTO>[]) {
return partial.map((part) =>
plainToClass(ShareDTO, part, { excludeExtraneousValues: true })
);
}
}

View File

@@ -0,0 +1,15 @@
import { Expose, plainToClass } from "class-transformer";
export class ShareMetaDataDTO {
@Expose()
id: string;
@Expose()
isZipReady: boolean;
from(partial: Partial<ShareMetaDataDTO>) {
return plainToClass(ShareMetaDataDTO, partial, {
excludeExtraneousValues: true,
});
}
}

View File

@@ -0,0 +1,6 @@
import { IsNotEmpty } from "class-validator";
export class SharePasswordDto {
@IsNotEmpty()
password: string;
}

View File

@@ -0,0 +1,12 @@
import { IsNumber, IsOptional, IsString, Length } from "class-validator";
export class ShareSecurityDTO {
@IsString()
@IsOptional()
@Length(3, 30)
password: string;
@IsNumber()
@IsOptional()
maxViews: number;
}