-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): Add feature to fork projects
- Loading branch information
Showing
12 changed files
with
11,140 additions
and
7,880 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 |
---|---|---|
|
@@ -17,9 +17,9 @@ | |
"db:reset": "pnpx dotenv-cli -e ../../.env -- pnpm dlx prisma migrate reset --force --schema=src/prisma/schema.prisma", | ||
"sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist || echo 'Failed to upload source maps to Sentry'", | ||
"e2e:prepare": "cd ../../ && docker compose down && docker compose -f docker-compose-test.yml up -d && cd apps/api && pnpm db:generate-types && cross-env NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' pnpm run db:deploy-migrations", | ||
"e2e": "pnpm run e2e:prepare && cross-env NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' turbo run test --no-cache --filter=api -- --runInBand --config=jest.e2e-config.ts --coverage --coverageDirectory=../../coverage-e2e/api --coverageReporters=json && pnpm run e2e:teardown", | ||
"e2e": "pnpm run e2e:prepare && cross-env NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' jest --runInBand --config=jest.e2e-config.ts --coverage --coverageDirectory=../../coverage-e2e/api --coverageReporters=json && pnpm run e2e:teardown", | ||
Check failure Code scanning / SonarCloud PostgreSQL database passwords should not be disclosed High
Make sure this PostgreSQL database password gets changed and removed from the code. See more on SonarCloud
|
||
"e2e:teardown": "cd ../../ && docker compose -f docker-compose-test.yml down", | ||
"unit": "pnpm db:generate-types && turbo run test -- --config=jest.config.ts" | ||
"unit": "pnpm db:generate-types && jest --config=jest.config.ts" | ||
}, | ||
"dependencies": { | ||
"@nestjs/common": "^10.0.0", | ||
|
@@ -56,16 +56,17 @@ | |
"@nestjs/schematics": "^10.0.0", | ||
"@nestjs/testing": "^10.0.0", | ||
"@prisma/client": "^5.13.0", | ||
"@types/uuid": "^9.0.8", | ||
"@types/cookie-parser": "^1.4.7", | ||
"@types/eccrypto": "^1.1.6", | ||
"@types/express": "^4.17.17", | ||
"@types/jest": "^29.5.2", | ||
"dotenv-cli": "^7.4.2", | ||
"@types/node": "^20.3.1", | ||
"@types/supertest": "^6.0.0", | ||
"@types/uuid": "^9.0.8", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"ajv": "^7", | ||
"dotenv-cli": "^7.4.2", | ||
"eslint": "^8.42.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
|
@@ -78,7 +79,6 @@ | |
"supertest": "^6.3.3", | ||
"ts-jest": "^29.1.0", | ||
"ts-loader": "^9.4.3", | ||
"ts-node": "^10.9.1", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.1.3" | ||
}, | ||
|
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
6 changes: 6 additions & 0 deletions
6
apps/api/src/prisma/migrations/20240521110332_add_project_fork/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,6 @@ | ||
-- AlterTable | ||
ALTER TABLE "Project" ADD COLUMN "forkedFromId" TEXT, | ||
ADD COLUMN "isForked" BOOLEAN NOT NULL DEFAULT false; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Project" ADD CONSTRAINT "Project_forkedFromId_fkey" FOREIGN KEY ("forkedFromId") REFERENCES "Project"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
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
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
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 @@ | ||
import { ForkProject } from './fork.project' | ||
|
||
describe('ForkProject', () => { | ||
it('should be defined', () => { | ||
expect(new ForkProject()).toBeDefined() | ||
}) | ||
}) |
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 @@ | ||
import { Workspace } from '@prisma/client' | ||
import { IsOptional, IsString } from 'class-validator' | ||
|
||
export class ForkProject { | ||
@IsString() | ||
@IsOptional() | ||
workspaceId?: Workspace['id'] | ||
|
||
@IsString() | ||
@IsOptional() | ||
name?: string | ||
|
||
@IsString() | ||
@IsOptional() | ||
storePrivateKey?: boolean | ||
} |
Oops, something went wrong.