change to biome
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 80,
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
34
.vscode/launch.json
vendored
34
.vscode/launch.json
vendored
@@ -1,21 +1,17 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"runtimeExecutable": "C:\\Users\\AliensVN\\AppData\\Roaming\\fnm\\node-versions\\v20.17.0\\installation\\node.exe",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${file}",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/**/*.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"runtimeExecutable": "C:\\Users\\AliensVN\\AppData\\Roaming\\fnm\\node-versions\\v20.17.0\\installation\\node.exe",
|
||||
"skipFiles": ["<node_internals>/**"],
|
||||
"program": "${file}",
|
||||
"outFiles": ["${workspaceFolder}/**/*.js"]
|
||||
}
|
||||
]
|
||||
}
|
||||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"dependi.npm.lockFileEnabled": false,
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||
"compile-hero.disable-compile-files-on-did-save-code": true
|
||||
"dependi.npm.lockFileEnabled": false,
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||
"compile-hero.disable-compile-files-on-did-save-code": true
|
||||
}
|
||||
208
biome.json
Normal file
208
biome.json
Normal file
@@ -0,0 +1,208 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
|
||||
"files": { "ignoreUnknown": false, "ignore": [] },
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"useEditorconfig": true,
|
||||
"formatWithErrors": false,
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 2,
|
||||
"lineEnding": "lf",
|
||||
"lineWidth": 80,
|
||||
"attributePosition": "auto",
|
||||
"bracketSpacing": true
|
||||
},
|
||||
"organizeImports": { "enabled": true },
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": false,
|
||||
"complexity": {
|
||||
"noUselessThisAlias": "error",
|
||||
"noUselessTypeConstraint": "error",
|
||||
"useArrowFunction": "off"
|
||||
},
|
||||
"correctness": {
|
||||
"noConstAssign": "off",
|
||||
"noGlobalObjectCalls": "off",
|
||||
"noInvalidBuiltinInstantiation": "off",
|
||||
"noInvalidConstructorSuper": "off",
|
||||
"noNewSymbol": "off",
|
||||
"noSetterReturn": "off",
|
||||
"noUndeclaredVariables": "off",
|
||||
"noUnreachable": "off",
|
||||
"noUnreachableSuper": "off",
|
||||
"noUnusedVariables": "error",
|
||||
"useArrayLiterals": "off"
|
||||
},
|
||||
"style": {
|
||||
"noArguments": "error",
|
||||
"noNamespace": "error",
|
||||
"noVar": "error",
|
||||
"useAsConstAssertion": "error",
|
||||
"useBlockStatements": "off",
|
||||
"useConst": "error"
|
||||
},
|
||||
"suspicious": {
|
||||
"noDuplicateClassMembers": "off",
|
||||
"noDuplicateObjectKeys": "off",
|
||||
"noDuplicateParameters": "off",
|
||||
"noExplicitAny": "error",
|
||||
"noExtraNonNullAssertion": "error",
|
||||
"noFunctionAssign": "off",
|
||||
"noImportAssign": "off",
|
||||
"noMisleadingInstantiator": "error",
|
||||
"noRedeclare": "off",
|
||||
"noUnsafeDeclarationMerging": "error",
|
||||
"noUnsafeNegation": "off",
|
||||
"useGetterReturn": "off",
|
||||
"useNamespaceKeyword": "error"
|
||||
}
|
||||
},
|
||||
"ignore": ["**/.eslintrc.js"]
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"jsxQuoteStyle": "double",
|
||||
"quoteProperties": "asNeeded",
|
||||
"trailingCommas": "all",
|
||||
"semicolons": "asNeeded",
|
||||
"arrowParentheses": "always",
|
||||
"bracketSameLine": false,
|
||||
"quoteStyle": "single",
|
||||
"attributePosition": "auto",
|
||||
"bracketSpacing": true
|
||||
},
|
||||
"parser": {
|
||||
"unsafeParameterDecoratorsEnabled": true
|
||||
},
|
||||
"globals": [
|
||||
"onscrollend",
|
||||
"onpointerleave",
|
||||
"oncontextrestored",
|
||||
"onemptied",
|
||||
"ongamepaddisconnected",
|
||||
"onkeypress",
|
||||
"onloadeddata",
|
||||
"onmouseup",
|
||||
"onvolumechange",
|
||||
"onpaste",
|
||||
"onstorage",
|
||||
"onkeyup",
|
||||
"onabort",
|
||||
"oncut",
|
||||
"ontransitionrun",
|
||||
"onafterprint",
|
||||
"onblur",
|
||||
"ondurationchange",
|
||||
"ontransitionstart",
|
||||
"oncanplaythrough",
|
||||
"onanimationend",
|
||||
"onmouseleave",
|
||||
"ondragleave",
|
||||
"onplay",
|
||||
"onunhandledrejection",
|
||||
"onbeforeprint",
|
||||
"onpointercancel",
|
||||
"onsubmit",
|
||||
"ondragstart",
|
||||
"onmessage",
|
||||
"location",
|
||||
"onoffline",
|
||||
"onappinstalled",
|
||||
"onwheel",
|
||||
"onended",
|
||||
"onkeydown",
|
||||
"onclick",
|
||||
"onfocus",
|
||||
"onscroll",
|
||||
"ongamepadconnected",
|
||||
"oncanplay",
|
||||
"onpointerdown",
|
||||
"ondeviceorientationabsolute",
|
||||
"onauxclick",
|
||||
"ondevicemotion",
|
||||
"onratechange",
|
||||
"ontransitionend",
|
||||
"onscrollsnapchanging",
|
||||
"onchange",
|
||||
"onselect",
|
||||
"onbeforeinstallprompt",
|
||||
"onbeforetoggle",
|
||||
"onmouseout",
|
||||
"ontimeupdate",
|
||||
"ondragover",
|
||||
"oncuechange",
|
||||
"ontransitioncancel",
|
||||
"onprogress",
|
||||
"onbeforeinput",
|
||||
"onpointerenter",
|
||||
"onmouseenter",
|
||||
"oninvalid",
|
||||
"onpointerout",
|
||||
"onpagereveal",
|
||||
"onpause",
|
||||
"onanimationstart",
|
||||
"onwaiting",
|
||||
"onscrollsnapchange",
|
||||
"ondeviceorientation",
|
||||
"onclose",
|
||||
"onbeforeunload",
|
||||
"oncancel",
|
||||
"onseeked",
|
||||
"onpointerover",
|
||||
"ongotpointercapture",
|
||||
"onloadedmetadata",
|
||||
"onpageshow",
|
||||
"onstalled",
|
||||
"oncontextmenu",
|
||||
"onreset",
|
||||
"ondrag",
|
||||
"onbeforematch",
|
||||
"onload",
|
||||
"onlostpointercapture",
|
||||
"onsuspend",
|
||||
"onselectionchange",
|
||||
"onpagehide",
|
||||
"onrejectionhandled",
|
||||
"onunload",
|
||||
"onanimationcancel",
|
||||
"onmousedown",
|
||||
"onpointerup",
|
||||
"onmouseover",
|
||||
"onformdata",
|
||||
"oncontentvisibilityautostatechange",
|
||||
"onresize",
|
||||
"onsearch",
|
||||
"ontoggle",
|
||||
"exports",
|
||||
"onpageswap",
|
||||
"onbeforexrselect",
|
||||
"onlanguagechange",
|
||||
"ondragenter",
|
||||
"onerror",
|
||||
"onpointermove",
|
||||
"onmousemove",
|
||||
"ondrop",
|
||||
"onhashchange",
|
||||
"onsecuritypolicyviolation",
|
||||
"onslotchange",
|
||||
"oncopy",
|
||||
"onanimationiteration",
|
||||
"ondblclick",
|
||||
"ondragend",
|
||||
"onpointerrawupdate",
|
||||
"onpopstate",
|
||||
"onplaying",
|
||||
"oncontextlost",
|
||||
"onloadstart",
|
||||
"onseeking",
|
||||
"oninput",
|
||||
"onmessageerror",
|
||||
"onselectstart",
|
||||
"onmousewheel",
|
||||
"ononline"
|
||||
]
|
||||
}
|
||||
}
|
||||
Submodule epess-database updated: 2eceaaa3c2...e357cb52b0
@@ -1,54 +0,0 @@
|
||||
import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin';
|
||||
import globals from 'globals';
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import js from '@eslint/js';
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
});
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: ['**/.eslintrc.js'],
|
||||
},
|
||||
...compat.extends(
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
),
|
||||
{
|
||||
plugins: {
|
||||
'@typescript-eslint': typescriptEslintEslintPlugin,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.jest,
|
||||
...globals.browser,
|
||||
},
|
||||
|
||||
parser: tsParser,
|
||||
ecmaVersion: 5,
|
||||
sourceType: 'module',
|
||||
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir: __dirname,
|
||||
},
|
||||
},
|
||||
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
},
|
||||
},
|
||||
];
|
||||
165
package-lock.json
generated
165
package-lock.json
generated
@@ -61,6 +61,7 @@
|
||||
"type-graphql": "^2.0.0-rc.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@clerk/types": "^4.23.0",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@eslint/js": "^9.12.0",
|
||||
@@ -1741,6 +1742,170 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@biomejs/biome": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz",
|
||||
"integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"bin": {
|
||||
"biome": "bin/biome"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/biome"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@biomejs/cli-darwin-arm64": "1.9.4",
|
||||
"@biomejs/cli-darwin-x64": "1.9.4",
|
||||
"@biomejs/cli-linux-arm64": "1.9.4",
|
||||
"@biomejs/cli-linux-arm64-musl": "1.9.4",
|
||||
"@biomejs/cli-linux-x64": "1.9.4",
|
||||
"@biomejs/cli-linux-x64-musl": "1.9.4",
|
||||
"@biomejs/cli-win32-arm64": "1.9.4",
|
||||
"@biomejs/cli-win32-x64": "1.9.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-darwin-arm64": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz",
|
||||
"integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-darwin-x64": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz",
|
||||
"integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-arm64": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz",
|
||||
"integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-arm64-musl": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz",
|
||||
"integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-x64": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz",
|
||||
"integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-x64-musl": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz",
|
||||
"integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-win32-arm64": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz",
|
||||
"integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-win32-x64": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz",
|
||||
"integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.21.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@clerk/backend": {
|
||||
"version": "1.15.1",
|
||||
"resolved": "https://registry.npmjs.org/@clerk/backend/-/backend-1.15.1.tgz",
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
"prisma:seed": "npx prisma db seed --schema=./epess-database/prisma/schema.prisma",
|
||||
"prisma:format": "npx prisma format --schema=./epess-database/prisma/schema.prisma",
|
||||
"prisma:studio": "npx prisma studio --schema=./epess-database/prisma/schema.prisma",
|
||||
"biome:check": "biome check",
|
||||
"biome:fix": "biome fix",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"test": "jest",
|
||||
@@ -81,6 +83,7 @@
|
||||
"type-graphql": "^2.0.0-rc.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@clerk/types": "^4.23.0",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@eslint/js": "^9.12.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { Injectable, OnModuleInit } from '@nestjs/common'
|
||||
|
||||
// import { ConfigConstant } from 'src/common/constant/config.constant';
|
||||
import { PrismaService } from 'src/Prisma/prisma.service';
|
||||
import { PrismaService } from 'src/Prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class AppConfigService implements OnModuleInit {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common'
|
||||
import {
|
||||
Pothos,
|
||||
PothosRef,
|
||||
PothosSchema,
|
||||
SchemaBuilderToken,
|
||||
} from '@smatch-corp/nestjs-pothos';
|
||||
import { Builder } from '../Graphql/graphql.builder';
|
||||
import { PrismaService } from '../Prisma/prisma.service';
|
||||
import { MailService } from '../Mail/mail.service';
|
||||
import { JwtUtils } from '../common/utils/jwt.utils';
|
||||
} from '@smatch-corp/nestjs-pothos'
|
||||
import { Builder } from '../Graphql/graphql.builder'
|
||||
import { PrismaService } from '../Prisma/prisma.service'
|
||||
import { MailService } from '../Mail/mail.service'
|
||||
import { JwtUtils } from '../common/utils/jwt.utils'
|
||||
@Injectable()
|
||||
export class CenterMentorSchema extends PothosSchema {
|
||||
constructor(
|
||||
@@ -17,7 +17,7 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
private readonly mailService: MailService,
|
||||
private readonly jwtUtils: JwtUtils,
|
||||
) {
|
||||
super();
|
||||
super()
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
@@ -50,7 +50,7 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
description: 'The admin note of the center mentor.',
|
||||
}),
|
||||
}),
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@Pothos()
|
||||
@@ -61,17 +61,17 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
'Retrieve a list of center mentors with optional filtering, ordering, and pagination.',
|
||||
type: [this.centerMentor()],
|
||||
args: this.builder.generator.findManyArgs('CenterMentor'),
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
return await this.prisma.centerMentor.findMany({
|
||||
...query,
|
||||
skip: args.skip ?? undefined,
|
||||
take: args.take ?? undefined,
|
||||
orderBy: args.orderBy ?? undefined,
|
||||
where: args.filter ?? undefined,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
|
||||
// mutations
|
||||
this.builder.mutationFields((t) => ({
|
||||
@@ -84,11 +84,11 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
return await this.prisma.centerMentor.create({
|
||||
...query,
|
||||
data: args.data,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -105,12 +105,12 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
return await this.prisma.centerMentor.update({
|
||||
...query,
|
||||
where: args.where,
|
||||
data: args.data,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -123,11 +123,11 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
return await this.prisma.centerMentor.delete({
|
||||
...query,
|
||||
where: args.where,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
inviteCenterMentor: t.prismaField({
|
||||
@@ -136,30 +136,30 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
args: {
|
||||
email: t.arg({ type: 'String', required: true }),
|
||||
},
|
||||
resolve: async (query, root, args, ctx) => {
|
||||
resolve: async (_query, _root, args, ctx) => {
|
||||
return this.prisma.$transaction(async (prisma) => {
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Not allowed');
|
||||
throw new Error('Not allowed')
|
||||
}
|
||||
// get centerId by user id from context
|
||||
const userId = ctx.http.me.id;
|
||||
const userId = ctx.http.me.id
|
||||
if (!userId) {
|
||||
throw new Error('User ID is required');
|
||||
throw new Error('User ID is required')
|
||||
}
|
||||
// get centerId by user id
|
||||
const center = await prisma.center.findUnique({
|
||||
where: { centerOwnerId: userId },
|
||||
});
|
||||
})
|
||||
if (!center) {
|
||||
throw new Error('Center not found');
|
||||
throw new Error('Center not found')
|
||||
}
|
||||
// build signature
|
||||
const token = this.jwtUtils.signTokenRS256(
|
||||
{ centerId: center.id, email: args.email },
|
||||
'1d',
|
||||
);
|
||||
)
|
||||
// build invite url
|
||||
const inviteUrl = `${process.env.CENTER_BASE_URL}/invite?token=${token}`;
|
||||
const inviteUrl = `${process.env.CENTER_BASE_URL}/invite?token=${token}`
|
||||
// mail to user with params centerId, email
|
||||
await this.mailService.sendTemplateEmail(
|
||||
[args.email],
|
||||
@@ -169,9 +169,9 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
center_name: center.name,
|
||||
invite_url: inviteUrl,
|
||||
},
|
||||
);
|
||||
return null;
|
||||
});
|
||||
)
|
||||
return null
|
||||
})
|
||||
},
|
||||
}),
|
||||
testInviteCenterMentor: t.prismaField({
|
||||
@@ -181,15 +181,15 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
centerId: t.arg({ type: 'String', required: true }),
|
||||
},
|
||||
description: 'Test invite center mentor.',
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (_query, _root, args) => {
|
||||
return this.prisma.$transaction(async () => {
|
||||
// sign token
|
||||
const token = this.jwtUtils.signTokenRS256(
|
||||
{ centerId: args.centerId, email: args.email },
|
||||
'1d',
|
||||
);
|
||||
)
|
||||
// build invite url
|
||||
const inviteUrl = `${process.env.CENTER_BASE_URL}/invite?token=${token}`;
|
||||
const inviteUrl = `${process.env.CENTER_BASE_URL}/invite?token=${token}`
|
||||
// mail to user with params centerId, email
|
||||
await this.mailService.sendTemplateEmail(
|
||||
[args.email],
|
||||
@@ -199,9 +199,9 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
center_name: args.centerId,
|
||||
invite_url: inviteUrl,
|
||||
},
|
||||
);
|
||||
return null;
|
||||
});
|
||||
)
|
||||
return null
|
||||
})
|
||||
},
|
||||
}),
|
||||
approveOrRejectCenterMentor: t.prismaField({
|
||||
@@ -215,43 +215,43 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
approved: t.arg({ type: 'Boolean', required: true }),
|
||||
adminNote: t.arg({ type: 'String', required: false }),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
resolve: async (_query, _root, args, ctx, _info) => {
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Not allowed');
|
||||
throw new Error('Not allowed')
|
||||
}
|
||||
return this.prisma.$transaction(async (prisma) => {
|
||||
// validate input
|
||||
if (args.approved && !args.adminNote) {
|
||||
throw new Error('Admin note is required');
|
||||
throw new Error('Admin note is required')
|
||||
}
|
||||
// get mentor info
|
||||
const mentor = await prisma.user.findUnique({
|
||||
where: args.where,
|
||||
});
|
||||
})
|
||||
if (!mentor) {
|
||||
throw new Error('Mentor not found');
|
||||
throw new Error('Mentor not found')
|
||||
}
|
||||
// get centerMentor
|
||||
const centerMentor = await prisma.centerMentor.findUnique({
|
||||
where: { mentorId: mentor.id },
|
||||
});
|
||||
})
|
||||
if (!centerMentor) {
|
||||
throw new Error('Center mentor not found');
|
||||
throw new Error('Center mentor not found')
|
||||
}
|
||||
// get center
|
||||
const center = await prisma.center.findUnique({
|
||||
where: { id: centerMentor.centerId },
|
||||
});
|
||||
})
|
||||
if (!center) {
|
||||
throw new Error('Center not found');
|
||||
throw new Error('Center not found')
|
||||
}
|
||||
// get email
|
||||
const email = await prisma.user.findUnique({
|
||||
where: args.where,
|
||||
select: { email: true },
|
||||
});
|
||||
})
|
||||
if (!email) {
|
||||
throw new Error('Email is required');
|
||||
throw new Error('Email is required')
|
||||
}
|
||||
// if approved, update role to mentor
|
||||
if (args.approved) {
|
||||
@@ -264,7 +264,7 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
CENTER_NAME: center.name,
|
||||
USER_NAME: mentor.name,
|
||||
},
|
||||
);
|
||||
)
|
||||
// create adminNote
|
||||
const adminNote = await prisma.adminNote.create({
|
||||
data: {
|
||||
@@ -272,7 +272,7 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
mentorId: mentor.id,
|
||||
notedByUserId: ctx.http.me.id,
|
||||
},
|
||||
});
|
||||
})
|
||||
// update user role
|
||||
await prisma.user.update({
|
||||
where: args.where,
|
||||
@@ -280,7 +280,7 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
role: 'CENTER_MENTOR',
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
});
|
||||
})
|
||||
// update centerMentor
|
||||
const updatedCenterMentor = await prisma.centerMentor.update({
|
||||
where: {
|
||||
@@ -292,8 +292,8 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
data: {
|
||||
adminNote: { connect: { id: adminNote.id } },
|
||||
},
|
||||
});
|
||||
return updatedCenterMentor;
|
||||
})
|
||||
return updatedCenterMentor
|
||||
}
|
||||
// if rejected, update adminNote
|
||||
await this.mailService.sendTemplateEmail(
|
||||
@@ -304,7 +304,7 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
CENTER_NAME: center.name,
|
||||
USER_NAME: mentor.name,
|
||||
},
|
||||
);
|
||||
)
|
||||
return await prisma.centerMentor.update({
|
||||
where: {
|
||||
mentorId_centerId: {
|
||||
@@ -321,10 +321,10 @@ export class CenterMentorSchema extends PothosSchema {
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ const stringFilterOps = [
|
||||
'startsWith',
|
||||
'endsWith',
|
||||
'mode',
|
||||
'search',
|
||||
] as const;
|
||||
const sortableTypes = ['String', 'Int', 'Float', 'DateTime', 'BigInt'] as const;
|
||||
const listOps = ['every', 'some', 'none'] as const;
|
||||
@@ -43,6 +44,7 @@ export class PrismaCrudGenerator<Types extends SchemaTypes> {
|
||||
private enumRefs = new Map<string, EnumRef<Types, unknown>>();
|
||||
|
||||
constructor(
|
||||
//
|
||||
@Inject(SchemaBuilderToken)
|
||||
private builder: PothosSchemaTypes.SchemaBuilder<Types>,
|
||||
) {}
|
||||
@@ -117,7 +119,6 @@ export class PrismaCrudGenerator<Types extends SchemaTypes> {
|
||||
),
|
||||
)
|
||||
.forEach((field) => {
|
||||
// biome-ignore lint/suspicious/noImplicitAnyLet: <explanation>
|
||||
let type;
|
||||
switch (field.kind) {
|
||||
case 'scalar':
|
||||
@@ -182,7 +183,6 @@ export class PrismaCrudGenerator<Types extends SchemaTypes> {
|
||||
model.primaryKey?.fields.includes(field.name),
|
||||
)
|
||||
.forEach((field) => {
|
||||
// biome-ignore lint/suspicious/noImplicitAnyLet: <explanation>
|
||||
let type;
|
||||
switch (field.kind) {
|
||||
case 'scalar':
|
||||
@@ -226,7 +226,6 @@ export class PrismaCrudGenerator<Types extends SchemaTypes> {
|
||||
const fields: Record<string, InputType<Types> | boolean> = {};
|
||||
|
||||
model.fields.forEach((field) => {
|
||||
// biome-ignore lint/suspicious/noImplicitAnyLet: <explanation>
|
||||
let type;
|
||||
switch (field.kind) {
|
||||
case 'scalar':
|
||||
|
||||
Reference in New Issue
Block a user