Skip to content

Commit 18974f2

Browse files
committed
fix: phone nullable
1 parent 474858a commit 18974f2

File tree

3 files changed

+76
-61
lines changed

3 files changed

+76
-61
lines changed

eslint.config.mjs

Lines changed: 67 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,91 @@
1-
import { defineConfig, globalIgnores } from "eslint/config";
2-
import _import from "eslint-plugin-import";
3-
import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin";
4-
import unusedImports from "eslint-plugin-unused-imports";
5-
import { fixupPluginRules } from "@eslint/compat";
6-
import tsParser from "@typescript-eslint/parser";
7-
import path from "node:path";
8-
import { fileURLToPath } from "node:url";
9-
import js from "@eslint/js";
10-
import { FlatCompat } from "@eslint/eslintrc";
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
import { fixupPluginRules } from '@eslint/compat';
5+
import { FlatCompat } from '@eslint/eslintrc';
6+
import js from '@eslint/js';
7+
import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin';
8+
import tsParser from '@typescript-eslint/parser';
9+
import _import from 'eslint-plugin-import';
10+
import unusedImports from 'eslint-plugin-unused-imports';
11+
import { defineConfig, globalIgnores } from 'eslint/config';
1112

1213
const __filename = fileURLToPath(import.meta.url);
1314
const __dirname = path.dirname(__filename);
1415
const compat = new FlatCompat({
15-
baseDirectory: __dirname,
16-
recommendedConfig: js.configs.recommended,
17-
allConfig: js.configs.all
16+
baseDirectory: __dirname,
17+
recommendedConfig: js.configs.recommended,
18+
allConfig: js.configs.all,
1819
});
1920

20-
export default defineConfig([globalIgnores(["**/.prettierrc.js", "bin/**/*.js"]), {
21-
extends: compat.extends("plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"),
21+
export default defineConfig([
22+
globalIgnores(['**/.prettierrc.js', 'bin/**/*.js']),
23+
{
24+
extends: compat.extends('plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'),
2225

2326
plugins: {
24-
import: fixupPluginRules(_import),
25-
"@typescript-eslint": typescriptEslintEslintPlugin,
26-
"unused-imports": unusedImports,
27+
'import': fixupPluginRules(_import),
28+
'@typescript-eslint': typescriptEslintEslintPlugin,
29+
'unused-imports': unusedImports,
2730
},
2831

2932
languageOptions: {
30-
parser: tsParser,
33+
parser: tsParser,
3134
},
3235

3336
rules: {
34-
"@typescript-eslint/interface-name-prefix": "off",
35-
"@typescript-eslint/explicit-function-return-type": "off",
36-
"@typescript-eslint/explicit-module-boundary-types": "off",
37-
"@typescript-eslint/no-explicit-any": "off",
38-
"@typescript-eslint/ban-ts-comment": "off",
39-
"react-hooks/exhaustive-deps": "off",
40-
"unused-imports/no-unused-imports": 1,
37+
'@typescript-eslint/interface-name-prefix': 'off',
38+
'@typescript-eslint/explicit-function-return-type': 'off',
39+
'@typescript-eslint/explicit-module-boundary-types': 'off',
40+
'@typescript-eslint/no-explicit-any': 'off',
41+
'@typescript-eslint/ban-ts-comment': 'off',
42+
'react-hooks/exhaustive-deps': 'off',
43+
'unused-imports/no-unused-imports': 1,
4144

42-
"import/order": ["error", {
43-
groups: ["builtin", "external", "internal", "parent", "sibling"],
45+
'import/order': [
46+
'error',
47+
{
48+
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling'],
4449

45-
pathGroups: [{
46-
pattern: "src/**",
47-
group: "internal",
48-
position: "before",
49-
}],
50+
'pathGroups': [
51+
{
52+
pattern: 'src/**',
53+
group: 'internal',
54+
position: 'before',
55+
},
56+
],
5057

51-
pathGroupsExcludedImportTypes: ["builtin"],
58+
'pathGroupsExcludedImportTypes': ['builtin'],
5259

53-
alphabetize: {
54-
order: "asc",
55-
caseInsensitive: false,
56-
},
60+
'alphabetize': {
61+
order: 'asc',
62+
caseInsensitive: false,
63+
},
5764

58-
"newlines-between": "always-and-inside-groups",
59-
warnOnUnassignedImports: true,
60-
}],
65+
'newlines-between': 'always-and-inside-groups',
66+
'warnOnUnassignedImports': true,
67+
},
68+
],
6169

62-
"import/no-extraneous-dependencies": ["error", {
63-
devDependencies: [
64-
"**/*.test.{ts,js}",
65-
"**/*.spec.{ts,js}",
66-
"scripts/**/*.{ts,js}",
67-
"bin/**/*.{ts,js}",
68-
"test/**/*.{ts,js}",
69-
],
70-
}],
70+
'import/no-extraneous-dependencies': [
71+
'error',
72+
{
73+
devDependencies: [
74+
'**/*.test.{ts,js}',
75+
'**/*.spec.{ts,js}',
76+
'scripts/**/*.{ts,js}',
77+
'bin/**/*.{ts,js}',
78+
'test/**/*.{ts,js}',
79+
],
80+
},
81+
],
7182
},
72-
}, {
73-
files: [
74-
"**/setupTests.ts",
75-
"**/*.test.tsx",
76-
"**/*.test.ts",
77-
"**/*.@(story|stories).*",
78-
],
83+
},
84+
{
85+
files: ['**/setupTests.ts', '**/*.test.tsx', '**/*.test.ts', '**/*.@(story|stories).*'],
7986

8087
rules: {
81-
"import/no-extraneous-dependencies": "off",
88+
'import/no-extraneous-dependencies': 'off',
8289
},
83-
}]);
90+
},
91+
]);

openapi.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"hash": "e53a5702f1615db98d73ccef5f59a195fde4908d6a0a9f265ce3800fac5b5d1a",
2+
"hash": "9c7b53ed249543d1b5994078e776a3a52c540309332df65c188b206f250d095f",
33
"openapi": "3.0.0",
44
"paths": {
55
"/hello": {
@@ -3869,6 +3869,7 @@
38693869
"in": "query",
38703870
"description": "手机号",
38713871
"schema": {
3872+
"nullable": true,
38723873
"type": "string"
38733874
}
38743875
},
@@ -4157,6 +4158,7 @@
41574158
"in": "query",
41584159
"description": "手机号",
41594160
"schema": {
4161+
"nullable": true,
41604162
"type": "string"
41614163
}
41624164
},
@@ -4814,6 +4816,7 @@
48144816
"in": "query",
48154817
"description": "手机号",
48164818
"schema": {
4819+
"nullable": true,
48174820
"type": "string"
48184821
}
48194822
},
@@ -5711,6 +5714,7 @@
57115714
},
57125715
"phone": {
57135716
"type": "string",
5717+
"nullable": true,
57145718
"description": "手机号"
57155719
},
57165720
"registerIp": {
@@ -7217,6 +7221,7 @@
72177221
},
72187222
"phone": {
72197223
"type": "string",
7224+
"nullable": true,
72207225
"description": "手机号"
72217226
},
72227227
"registerIp": {
@@ -7337,6 +7342,7 @@
73377342
},
73387343
"phone": {
73397344
"type": "string",
7345+
"nullable": true,
73407346
"description": "手机号"
73417347
},
73427348
"registerIp": {
@@ -7768,6 +7774,7 @@
77687774
},
77697775
"phone": {
77707776
"type": "string",
7777+
"nullable": true,
77717778
"description": "手机号"
77727779
},
77737780
"registerRegion": {

src/user/entities/user.entity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export class UserDoc {
174174
@IsString()
175175
@IsMobilePhone('zh-CN') // 中国大陆地区手机号
176176
@Prop({ unique: true, sparse: true })
177-
phone?: string;
177+
phone?: string | null;
178178

179179
/**
180180
* 注册 IP

0 commit comments

Comments
 (0)