diff --git a/.gitignore b/.gitignore index ab84fc8c..4a1572b2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ tmp # dependencies node_modules - +package-lock.json # IDEs and editors /.idea .project diff --git a/apps/api/src/user/service/user.service.ts b/apps/api/src/user/service/user.service.ts index c4f8225b..7b1a3093 100644 --- a/apps/api/src/user/service/user.service.ts +++ b/apps/api/src/user/service/user.service.ts @@ -6,7 +6,7 @@ import { UnauthorizedException } from '@nestjs/common' import { UpdateUserDto } from '../dto/update.user/update.user' -import { AuthProvider, User } from '@prisma/client' +import { AuthProvider, User, Workspace } from '@prisma/client' import { PrismaService } from '@/prisma/prisma.service' import { CreateUserDto } from '../dto/create.user/create.user' import { IMailService, MAIL_SERVICE } from '@/mail/services/interface.service' @@ -30,7 +30,15 @@ export class UserService { } async getSelf(user: User) { - return user + const defaultWorkspace: Workspace | null = + await this.prisma.workspace.findFirst({ + where: { + ownerId: user.id, + isDefault: true + } + }) + + return { ...user, defaultWorkspace } } async updateSelf(user: User, dto: UpdateUserDto) { diff --git a/apps/api/src/user/user.e2e.spec.ts b/apps/api/src/user/user.e2e.spec.ts index 5536211b..80dba297 100644 --- a/apps/api/src/user/user.e2e.spec.ts +++ b/apps/api/src/user/user.e2e.spec.ts @@ -82,7 +82,8 @@ describe('User Controller Tests', () => { }) expect(result.statusCode).toEqual(200) expect(JSON.parse(result.body)).toEqual({ - ...adminUser + ...adminUser, + defaultWorkspace: null }) }) @@ -94,9 +95,23 @@ describe('User Controller Tests', () => { 'x-e2e-user-email': regularUser.email } }) + + const workspace = await prisma.workspace.findFirst({ + where: { + ownerId: regularUser.id, + isDefault: true + } + }) + expect(result.statusCode).toEqual(200) expect(JSON.parse(result.body)).toEqual({ - ...regularUser + ...regularUser, + defaultWorkspace: expect.any(Object) + }) + + expect(result.json().defaultWorkspace).toMatchObject({ + id: workspace.id, + name: workspace.name }) }) diff --git a/packages/eslint-config-custom/package-lock.json b/packages/eslint-config-custom/package-lock.json new file mode 100644 index 00000000..49957b9b --- /dev/null +++ b/packages/eslint-config-custom/package-lock.json @@ -0,0 +1,174 @@ +{ + "name": "eslint-config-custom", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "eslint-config-custom", + "version": "0.0.0", + "license": "MIT", + "devDependencies": { + "@vercel/style-guide": "^5.0.0", + "eslint-config-turbo": "^1.10.12", + "typescript": "^4.5.3" + } + }, + "../../node_modules/.pnpm/@vercel+style-guide@5.2.0_@next+eslint-plugin-next@13.5.6_eslint@8.57.0_jest@29.7.0_@types+no_sdq2icpzhfmze3wlrhq5gaoyxi/node_modules/@vercel/style-guide": { + "version": "5.2.0", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "@babel/core": "^7.22.11", + "@babel/eslint-parser": "^7.22.11", + "@rushstack/eslint-patch": "^1.3.3", + "@typescript-eslint/eslint-plugin": "^6.5.0", + "@typescript-eslint/parser": "^6.5.0", + "eslint-config-prettier": "^9.0.0", + "eslint-import-resolver-alias": "^1.1.2", + "eslint-import-resolver-typescript": "^3.6.0", + "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jest": "^27.2.3", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-playwright": "^0.16.0", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-testing-library": "^6.0.1", + "eslint-plugin-tsdoc": "^0.2.17", + "eslint-plugin-unicorn": "^48.0.1", + "prettier-plugin-packagejson": "^2.4.5" + }, + "devDependencies": { + "@commitlint/cli": "^17.7.1", + "@commitlint/config-conventional": "^17.7.0", + "@semantic-release/git": "^10.0.1", + "eslint": "^8.48.0", + "husky": "^8.0.3", + "lint-staged": "^14.0.1", + "prettier": "^3.0.2", + "semantic-release": "^21.1.1", + "typescript": "^5.2.2" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@next/eslint-plugin-next": ">=12.3.0 <15", + "eslint": ">=8.48.0 <9", + "prettier": ">=3.0.0 <4", + "typescript": ">=4.8.0 <6" + }, + "peerDependenciesMeta": { + "@next/eslint-plugin-next": { + "optional": true + }, + "eslint": { + "optional": true + }, + "prettier": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "../../node_modules/.pnpm/eslint-config-turbo@1.13.4_eslint@8.57.0/node_modules/eslint-config-turbo": { + "version": "1.13.4", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "eslint-plugin-turbo": "1.13.4" + }, + "devDependencies": { + "@turbo/eslint-config": "0.0.0", + "@types/eslint": "^8.44.2" + }, + "peerDependencies": { + "eslint": ">6.6.0" + } + }, + "../../node_modules/.pnpm/typescript@4.9.5/node_modules/typescript": { + "version": "4.9.5", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "devDependencies": { + "@octokit/rest": "latest", + "@types/chai": "latest", + "@types/fancy-log": "^2.0.0", + "@types/fs-extra": "^9.0.13", + "@types/glob": "latest", + "@types/gulp": "^4.0.9", + "@types/gulp-concat": "latest", + "@types/gulp-newer": "latest", + "@types/gulp-rename": "latest", + "@types/gulp-sourcemaps": "latest", + "@types/merge2": "latest", + "@types/microsoft__typescript-etw": "latest", + "@types/minimist": "latest", + "@types/mkdirp": "latest", + "@types/mocha": "latest", + "@types/ms": "latest", + "@types/node": "latest", + "@types/source-map-support": "latest", + "@types/which": "^2.0.1", + "@types/xml2js": "^0.4.11", + "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/parser": "^5.33.1", + "@typescript-eslint/utils": "^5.33.1", + "azure-devops-node-api": "^11.2.0", + "chai": "latest", + "chalk": "^4.1.2", + "del": "^6.1.1", + "diff": "^5.1.0", + "eslint": "^8.22.0", + "eslint-formatter-autolinkable-stylish": "^1.2.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jsdoc": "^39.3.6", + "eslint-plugin-local": "^1.0.0", + "eslint-plugin-no-null": "^1.0.2", + "fancy-log": "latest", + "fs-extra": "^9.1.0", + "glob": "latest", + "gulp": "^4.0.2", + "gulp-concat": "latest", + "gulp-insert": "latest", + "gulp-newer": "latest", + "gulp-rename": "latest", + "gulp-sourcemaps": "latest", + "merge2": "latest", + "minimist": "latest", + "mkdirp": "latest", + "mocha": "latest", + "mocha-fivemat-progress-reporter": "latest", + "ms": "^2.1.3", + "node-fetch": "^3.2.10", + "source-map-support": "latest", + "typescript": "^4.8.4", + "vinyl": "latest", + "which": "^2.0.2", + "xml2js": "^0.4.23" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/@vercel/style-guide": { + "resolved": "../../node_modules/.pnpm/@vercel+style-guide@5.2.0_@next+eslint-plugin-next@13.5.6_eslint@8.57.0_jest@29.7.0_@types+no_sdq2icpzhfmze3wlrhq5gaoyxi/node_modules/@vercel/style-guide", + "link": true + }, + "node_modules/eslint-config-turbo": { + "resolved": "../../node_modules/.pnpm/eslint-config-turbo@1.13.4_eslint@8.57.0/node_modules/eslint-config-turbo", + "link": true + }, + "node_modules/typescript": { + "resolved": "../../node_modules/.pnpm/typescript@4.9.5/node_modules/typescript", + "link": true + } + } +} diff --git a/packages/tsconfig/package-lock.json b/packages/tsconfig/package-lock.json new file mode 100644 index 00000000..b5f3c5d1 --- /dev/null +++ b/packages/tsconfig/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "tsconfig", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "tsconfig", + "version": "0.0.0", + "license": "MIT" + } + } +}