diff --git a/.DS_Store b/.DS_Store index 9766867..a621df3 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 517ffa4..27c291b 100755 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ package-lock.json dist/ rds-combined-ca-bundle.pem docker-variables.env +dist-frontend/ +dist-backend/ \ No newline at end of file diff --git a/backend/server/server.ts b/backend/server/server.ts index 1e8aa5a..2f1d4da 100755 --- a/backend/server/server.ts +++ b/backend/server/server.ts @@ -16,7 +16,7 @@ import { middlewareErrorHandler } from "../middleware/utils/middleware-utils"; // import requestIp from "request-ip"; const app = express(); -const publicPath = path.join(__dirname, "..", "..", "public"); +const publicPath = path.join(__dirname, "..", "..", "dist-frontend"); let server: any; let serverHttps: any; diff --git a/backend/services/chunk-service/utils/addToStorageSize.ts b/backend/services/chunk-service/utils/addToStorageSize.ts deleted file mode 100644 index 72f8e54..0000000 --- a/backend/services/chunk-service/utils/addToStorageSize.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { UserInterface } from "../../../models/user-model"; -import env from "../../../enviroment/env"; - -const addToStoageSize = async ( - user: UserInterface, - size: number, - isPersonalFile: boolean -) => { - if (isPersonalFile) { - //console.log("user storage") - user.storageDataPersonal!.storageSize = - +user.storageDataPersonal!.storageSize! + +size; - await user.save(); - return; - } - - if ( - !user.storageData || - (!user.storageData.storageSize && !user.storageData.storageLimit) - ) - user.storageData = { storageSize: 0, storageLimit: 0 }; - - user.storageData!.storageSize = +user.storageData!.storageSize! + +size; - - await user.save(); -}; - -export default addToStoageSize; diff --git a/backend/services/chunk-service/utils/getPrevIVS3.ts b/backend/services/chunk-service/utils/getPrevIVS3.ts index 2acd51d..70d83a2 100644 --- a/backend/services/chunk-service/utils/getPrevIVS3.ts +++ b/backend/services/chunk-service/utils/getPrevIVS3.ts @@ -1,4 +1,4 @@ -import s3 from "../../../db/s3"; +import s3 from "../../../db/connections/s3"; import env from "../../../enviroment/env"; import { UserInterface } from "../../../models/user-model"; @@ -17,7 +17,7 @@ const getPrevIV = ( const stream = s3.getObject(params).createReadStream(); - stream.on("data", (data) => { + stream.on("data", (data: any) => { resolve(data); }); }); diff --git a/backend/services/chunk-service/utils/subtractFromStorageSize.ts b/backend/services/chunk-service/utils/subtractFromStorageSize.ts deleted file mode 100644 index 9b4d5e0..0000000 --- a/backend/services/chunk-service/utils/subtractFromStorageSize.ts +++ /dev/null @@ -1,33 +0,0 @@ -import User, { UserInterface } from "../../../models/user-model"; -import env from "../../../enviroment/env"; - -const subtractFromStorageSize = async ( - userID: string, - size: number, - isPersonalFile: boolean -) => { - const user = (await User.findById(userID)) as UserInterface; - - if (isPersonalFile) { - user.storageDataPersonal!.storageSize = - +user.storageDataPersonal!.storageSize! - +size; - if (user.storageDataPersonal!.storageSize < 0) - user.storageDataPersonal!.storageSize = 0; - await user.save(); - return; - } - - if ( - !user.storageData || - (!user.storageData.storageSize && !user.storageData.storageLimit) - ) - user.storageData = { storageSize: 0, storageLimit: 0 }; - - user.storageData!.storageSize = +user.storageData!.storageSize! - +size; - - if (user.storageData?.storageSize! < 0) user.storageData!.storageSize! = 0; - - await user.save(); -}; - -export default subtractFromStorageSize; diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 20a24ee..2394933 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -12,7 +12,7 @@ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "../dist" /* Redirect output structure to the directory. */, + "outDir": "../dist-backend" /* Redirect output structure to the directory. */, "rootDir": "./" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ @@ -45,9 +45,7 @@ "typeRoots": [ "./node_modules/@types" ] /* List of folders to include type definitions from. */, - "types": [ - "node" - ] /* Type declaration files to be included in compilation. */, + "types": [] /* Type declaration files to be included in compilation. */, // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ diff --git a/nodemon.json b/nodemon.json index 3906e53..6738ca9 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,6 +1,6 @@ { - "watch": ["dist/"], + "watch": ["dist-backend/"], "ignore": ["src", "node_modules"], "ext": "js,json", - "exec": "node dist/server/server-start.js" + "exec": "node dist-backend/server/server-start.js" } diff --git a/package.json b/package.json index 3ac7bd9..2cb6223 100755 --- a/package.json +++ b/package.json @@ -8,9 +8,12 @@ }, "scripts": { "dev": "concurrently \"vite\" \"tsc -w -p ./backend/tsconfig.json\" \"npm run dev:backend\"", - "dev:backend": "NODE_ENV=development nodemon dist/server/server-start.js", - "vite-build": "vite build", - "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'" + "dev:backend": "NODE_ENV=development nodemon dist-backend/server/server-start.js", + "build:frontend": "vite build", + "build:backend": "tsc -p ./backend/tsconfig.json", + "build": "npm run build:frontend && npm run build:backend", + "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", + "start": "NODE_ENV=production node dist-backend/server/server-start.js" }, "dependencies": { "@babel/core": "^7.8.4", diff --git a/public/index.html b/public/index.html deleted file mode 100755 index 24afa9d..0000000 --- a/public/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - myDrive - - - - - - - - - - - - - - - - -
- - - - - \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index a47e16c..ae6703c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,7 @@ import react from "@vitejs/plugin-react"; export default defineConfig({ plugins: [react()], build: { - outDir: "dist", + outDir: "dist-frontend", }, resolve: { extensions: [".js", ".jsx", ".ts", ".tsx"], // Include these extensions