diff --git a/dto/index.ts b/dto/index.ts index f7b0a1d..22f24bf 100644 --- a/dto/index.ts +++ b/dto/index.ts @@ -1,73 +1,2 @@ -// -// Responses -// - -export interface BaseResponse { - statusCode: number; -} - -export interface ErrorResponse extends BaseResponse { - statusCode: 400 | 401 | 403; - message?: string; -} - -export type RefreshResponse = LoginResponse; -export interface LoginResponse extends BaseResponse { - statusCode: 200; - jwt: string; -} - -export interface GetRootResponse extends BaseResponse { - statusCode: 200; - rootId: number; -} - -export interface GetNodeResponse extends BaseResponse { - statusCode: 200; - id: number; - name: string; - isFile: boolean; - parent: number | null; - children?: number[]; - size?: number; -} - -export interface GetPathResponse extends BaseResponse { - statusCode: 200; - path: string; -} - -export type CreateFileResponse = CreateFolderResponse; -export interface CreateFolderResponse extends BaseResponse { - statusCode: 200; - id: number; -} - -export type SignupResponse = DeleteResponse; -export type UploadFileResponse = DeleteResponse; -export interface DeleteResponse extends BaseResponse { - statusCode: 200; -} - -// -// Requests -// - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface BaseRequest {} - -export type AuthSignUpRequest = AuthLoginRequest; -export interface AuthLoginRequest extends BaseRequest { - username: string; - password: string; -} - -export type CreateFileRequest = CreateFolderRequest; -export interface CreateFolderRequest extends BaseRequest { - parent: number; - name: string; -} - -export interface DeleteRequest extends BaseRequest { - node: number; -} +export * as Requests from './requests'; +export * as Responses from './responses'; diff --git a/dto/requests/auth.ts b/dto/requests/auth.ts new file mode 100644 index 0000000..ea1e6f7 --- /dev/null +++ b/dto/requests/auth.ts @@ -0,0 +1,10 @@ +import { BaseRequest } from './base'; + +export interface AuthSignUpRequest extends BaseRequest { + username: string; + password: string; +} + +export interface AuthLoginRequest extends AuthSignUpRequest { + otp?: string; +} diff --git a/dto/requests/base.ts b/dto/requests/base.ts new file mode 100644 index 0000000..9d6341d --- /dev/null +++ b/dto/requests/base.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface BaseRequest {} diff --git a/dto/requests/fs.ts b/dto/requests/fs.ts new file mode 100644 index 0000000..5cd1d06 --- /dev/null +++ b/dto/requests/fs.ts @@ -0,0 +1,12 @@ +import { BaseRequest } from './base'; + +export type CreateFileRequest = CreateFolderRequest; + +export interface CreateFolderRequest extends BaseRequest { + parent: number; + name: string; +} + +export interface DeleteRequest extends BaseRequest { + node: number; +} diff --git a/dto/requests/index.ts b/dto/requests/index.ts new file mode 100644 index 0000000..8f26264 --- /dev/null +++ b/dto/requests/index.ts @@ -0,0 +1,3 @@ +export * from './base'; +export * as Auth from './auth'; +export * as FS from './fs'; diff --git a/dto/responses/auth.ts b/dto/responses/auth.ts new file mode 100644 index 0000000..545a065 --- /dev/null +++ b/dto/responses/auth.ts @@ -0,0 +1,19 @@ +import { BaseResponse, SuccessResponse } from './base'; + +export type TfaRequiredResponse = SuccessResponse; +export type RemoveTfaResponse = SuccessResponse; +export type RequestEmailTfaResponse = SuccessResponse; +export type TfaCompletedResponse = SuccessResponse; +export type SignupResponse = SuccessResponse; +export type RefreshResponse = LoginResponse; + +export interface LoginResponse extends BaseResponse { + statusCode: 200; + jwt: string; +} + +export interface RequestTotpTfaResponse extends BaseResponse { + statusCode: 200; + qrCode: string; + secret: string; +} diff --git a/dto/responses/base.ts b/dto/responses/base.ts new file mode 100644 index 0000000..ce059ce --- /dev/null +++ b/dto/responses/base.ts @@ -0,0 +1,12 @@ +export interface BaseResponse { + statusCode: number; +} + +export interface SuccessResponse extends BaseResponse { + statusCode: 200; +} + +export interface ErrorResponse extends BaseResponse { + statusCode: 400 | 401 | 403; + message?: string; +} diff --git a/dto/responses/fs.ts b/dto/responses/fs.ts new file mode 100644 index 0000000..8432548 --- /dev/null +++ b/dto/responses/fs.ts @@ -0,0 +1,30 @@ +import { BaseResponse, SuccessResponse } from './base'; + +export type UploadFileResponse = SuccessResponse; +export type DeleteResponse = SuccessResponse; +export type CreateFileResponse = CreateFolderResponse; + +export interface GetRootResponse extends BaseResponse { + statusCode: 200; + rootId: number; +} + +export interface GetNodeResponse extends BaseResponse { + statusCode: 200; + id: number; + name: string; + isFile: boolean; + parent: number | null; + children?: number[]; + size?: number; +} + +export interface GetPathResponse extends BaseResponse { + statusCode: 200; + path: string; +} + +export interface CreateFolderResponse extends BaseResponse { + statusCode: 200; + id: number; +} diff --git a/dto/responses/index.ts b/dto/responses/index.ts new file mode 100644 index 0000000..8f26264 --- /dev/null +++ b/dto/responses/index.ts @@ -0,0 +1,3 @@ +export * from './base'; +export * as Auth from './auth'; +export * as FS from './fs'; diff --git a/frontend/src/App.vue b/frontend/src/App.vue index f5cd54d..60c8577 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,7 +1,7 @@ diff --git a/frontend/src/components/FSView/DirViewer.vue b/frontend/src/components/FSView/DirViewer.vue index d2164c9..d77fc14 100644 --- a/frontend/src/components/FSView/DirViewer.vue +++ b/frontend/src/components/FSView/DirViewer.vue @@ -1,18 +1,12 @@ diff --git a/frontend/src/components/UploadDialog/UploadEntry.vue b/frontend/src/components/UploadDialog/UploadEntry.vue index 3f857b1..392e0e9 100644 --- a/frontend/src/components/UploadDialog/UploadEntry.vue +++ b/frontend/src/components/UploadDialog/UploadEntry.vue @@ -1,6 +1,6 @@ - - + + + + + + Please input your 2 factor authentication code + + Login Signup instead? diff --git a/frontend/src/views/SignupView.vue b/frontend/src/views/SignupView.vue index 481ff0c..438ef63 100644 --- a/frontend/src/views/SignupView.vue +++ b/frontend/src/views/SignupView.vue @@ -1,6 +1,6 @@