-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Create monorepo with ui and server
- Loading branch information
Tony Ramirez
authored and
Tony Ramirez
committed
Nov 25, 2024
1 parent
c7b9038
commit 9f106aa
Showing
1,076 changed files
with
151,506 additions
and
21,825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
####################### | ||
#REQUIRED TO RUN UI | ||
####################### | ||
|
||
VITE_CLIENT_URL=http://localhost:5173 | ||
VITE_SERVER_URL=http://localhost:9094 | ||
|
||
VITE_GOOGLE_CLIENT_ID=GOOGLE_CLIENT_ID_THAT_MUST_MATCH_SERVER_GOOGLE_LOGIN_CLIENT_ID | ||
|
||
|
||
####################### | ||
#REQUIRED TO RUN SERVER | ||
####################### | ||
|
||
# Look over the /config/server.config.js file for more information on the environment variables. | ||
# These are just the environment variables required to run the server. | ||
|
||
ENVIRONMENT=development | ||
DATABASE_URL=postgresql://postgres:password123@localhost:5432/mydb?schema=public | ||
PORT=9094 | ||
SERVER_URL=http://localhost:9094 | ||
|
||
# A long random string | ||
AUTH_JWT_SECRET= | ||
|
||
# A long random string | ||
APP_OAUTH_CALLBACK_STATE_SECRET= | ||
|
||
# A 256 bit encryption key (32 characters) | ||
CRYPTO_ENCRYPTION_KEY= |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ tmp | |
# dependencies | ||
node_modules | ||
|
||
# Secrets | ||
**/*.env | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const baseConfig = require('../../eslint.config.js'); | ||
|
||
module.exports = [...baseConfig]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export default { | ||
displayName: 'server-e2e', | ||
preset: '../../jest.preset.js', | ||
globalSetup: '<rootDir>/src/support/global-setup.ts', | ||
globalTeardown: '<rootDir>/src/support/global-teardown.ts', | ||
setupFiles: ['<rootDir>/src/support/test-setup.ts'], | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
}, | ||
], | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/server-e2e', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "server-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"implicitDependencies": ["server"], | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"], | ||
"options": { | ||
"jestConfig": "apps/server-e2e/jest.config.ts", | ||
"passWithNoTests": true | ||
}, | ||
"dependsOn": ["server:build"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import axios from 'axios'; | ||
|
||
describe('GET /api', () => { | ||
it('should return a message', async () => { | ||
const res = await axios.get(`/api`); | ||
|
||
expect(res.status).toBe(200); | ||
expect(res.data).toEqual({ message: 'Hello API' }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint-disable */ | ||
var __TEARDOWN_MESSAGE__: string; | ||
|
||
module.exports = async function () { | ||
// Start services that that the app needs to run (e.g. database, docker-compose, etc.). | ||
console.log('\nSetting up...\n'); | ||
|
||
// Hint: Use `globalThis` to pass variables to global teardown. | ||
globalThis.__TEARDOWN_MESSAGE__ = '\nTearing down...\n'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* eslint-disable */ | ||
|
||
module.exports = async function () { | ||
// Put clean up logic here (e.g. stopping services, docker-compose, etc.). | ||
// Hint: `globalThis` is shared between setup and teardown. | ||
console.log(globalThis.__TEARDOWN_MESSAGE__); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable */ | ||
import axios from 'axios'; | ||
|
||
module.exports = async function () { | ||
// Configure axios for tests to use. | ||
const host = process.env.HOST ?? 'localhost'; | ||
const port = process.env.PORT ?? '3000'; | ||
axios.defaults.baseURL = `http://${host}:${port}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
], | ||
"compilerOptions": { | ||
"esModuleInterop": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": ["jest.config.ts", "src/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const baseConfig = require('../../eslint.config.js'); | ||
|
||
module.exports = [...baseConfig]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default { | ||
displayName: 'server', | ||
preset: '../../jest.preset.js', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }], | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/apps/server', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src/modules", | ||
"compilerOptions": { | ||
"deleteOutDir": true | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
apps/server/prisma/migrations/20240210214405_initial/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- CreateTable | ||
CREATE TABLE "Company" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Company_pkey" PRIMARY KEY ("id") | ||
); |
26 changes: 26 additions & 0 deletions
26
apps/server/prisma/migrations/20240211070445_user/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `updatedAt` to the `Company` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Company" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
ADD COLUMN "deletedAt" TIMESTAMP(3), | ||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL; | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"deletedAt" TIMESTAMP(3), | ||
"email" VARCHAR(255) NOT NULL, | ||
"name" VARCHAR(100) NOT NULL, | ||
"password" VARCHAR(100), | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); |
7 changes: 7 additions & 0 deletions
7
apps/server/prisma/migrations/20240212002338_reset/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- AlterTable | ||
ALTER TABLE "Company" ALTER COLUMN "createdAt" DROP NOT NULL, | ||
ALTER COLUMN "updatedAt" DROP NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "createdAt" DROP NOT NULL, | ||
ALTER COLUMN "updatedAt" DROP NOT NULL; |
16 changes: 16 additions & 0 deletions
16
apps/server/prisma/migrations/20240212002710_no_optional_create_update/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
Warnings: | ||
- Made the column `createdAt` on table `Company` required. This step will fail if there are existing NULL values in that column. | ||
- Made the column `updatedAt` on table `Company` required. This step will fail if there are existing NULL values in that column. | ||
- Made the column `createdAt` on table `User` required. This step will fail if there are existing NULL values in that column. | ||
- Made the column `updatedAt` on table `User` required. This step will fail if there are existing NULL values in that column. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Company" ALTER COLUMN "createdAt" SET NOT NULL, | ||
ALTER COLUMN "updatedAt" SET NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "createdAt" SET NOT NULL, | ||
ALTER COLUMN "updatedAt" SET NOT NULL; |
2 changes: 2 additions & 0 deletions
2
apps/server/prisma/migrations/20240212063720_email_verified_at/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "emailVerifiedAt" TIMESTAMP(3); |
84 changes: 84 additions & 0 deletions
84
apps/server/prisma/migrations/20240218170253_company_user/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
Warnings: | ||
- You are about to alter the column `name` on the `Company` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(100)`. | ||
*/ | ||
-- CreateEnum | ||
CREATE TYPE "CompanyUserRole" AS ENUM ('ADMIN'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Company" ALTER COLUMN "name" SET DATA TYPE VARCHAR(100); | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "FK_organizationId" TEXT, | ||
ADD COLUMN "rootProfileImageUrl" VARCHAR(255); | ||
|
||
-- CreateTable | ||
CREATE TABLE "CompanyUser" ( | ||
"id" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"deletedAt" TIMESTAMP(3), | ||
"email" VARCHAR(255) NOT NULL, | ||
"emailVerifiedAt" TIMESTAMP(3), | ||
"name" VARCHAR(100) NOT NULL, | ||
"password" VARCHAR(100), | ||
"profileImageUrl" VARCHAR(255), | ||
"roles" "CompanyUserRole"[], | ||
"FK_userId" TEXT NOT NULL, | ||
"FK_companyId" TEXT NOT NULL, | ||
|
||
CONSTRAINT "CompanyUser_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "CompanyLocation" ( | ||
"id" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"deletedAt" TIMESTAMP(3), | ||
"name" VARCHAR(100) NOT NULL, | ||
"coordinates" JSONB, | ||
"FK_companyId" TEXT NOT NULL, | ||
|
||
CONSTRAINT "CompanyLocation_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "CompanyLocationAddress" ( | ||
"id" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"deletedAt" TIMESTAMP(3), | ||
"street1" VARCHAR(100) NOT NULL, | ||
"street2" VARCHAR(100), | ||
"city" VARCHAR(100) NOT NULL, | ||
"state" VARCHAR(100) NOT NULL, | ||
"zip" VARCHAR(100) NOT NULL, | ||
"country" VARCHAR(100) NOT NULL, | ||
"FK_location" TEXT NOT NULL, | ||
|
||
CONSTRAINT "CompanyLocationAddress_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "CompanyUser_email_key" ON "CompanyUser"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "CompanyLocationAddress_FK_location_key" ON "CompanyLocationAddress"("FK_location"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "User" ADD CONSTRAINT "User_FK_organizationId_fkey" FOREIGN KEY ("FK_organizationId") REFERENCES "Company"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CompanyUser" ADD CONSTRAINT "CompanyUser_FK_userId_fkey" FOREIGN KEY ("FK_userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CompanyUser" ADD CONSTRAINT "CompanyUser_FK_companyId_fkey" FOREIGN KEY ("FK_companyId") REFERENCES "Company"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CompanyLocation" ADD CONSTRAINT "CompanyLocation_FK_companyId_fkey" FOREIGN KEY ("FK_companyId") REFERENCES "Company"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CompanyLocationAddress" ADD CONSTRAINT "CompanyLocationAddress_FK_location_fkey" FOREIGN KEY ("FK_location") REFERENCES "CompanyLocation"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
22 changes: 22 additions & 0 deletions
22
...isma/migrations/20240218171225_remote_soft_delete_from_location_and_company/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `deletedAt` on the `Company` table. All the data in the column will be lost. | ||
- You are about to drop the column `deletedAt` on the `CompanyLocation` table. All the data in the column will be lost. | ||
- You are about to drop the column `deletedAt` on the `CompanyLocationAddress` table. All the data in the column will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "CompanyLocationAddress" DROP CONSTRAINT "CompanyLocationAddress_FK_location_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Company" DROP COLUMN "deletedAt"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "CompanyLocation" DROP COLUMN "deletedAt"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "CompanyLocationAddress" DROP COLUMN "deletedAt"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CompanyLocationAddress" ADD CONSTRAINT "CompanyLocationAddress_FK_location_fkey" FOREIGN KEY ("FK_location") REFERENCES "CompanyLocation"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
Oops, something went wrong.