Skip to content

Commit a15869c

Browse files
committed
【优化】医疗物资需求 数据模型
1 parent 8c36685 commit a15869c

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
"@types/koa-logger": "^3.1.1",
2929
"@types/koa-multer": "^1.0.0",
3030
"@types/koa-router": "^7.4.0",
31-
"@typescript-eslint/eslint-plugin": "^2.17.0",
32-
"@typescript-eslint/parser": "^2.17.0",
31+
"@typescript-eslint/eslint-plugin": "^2.18.0",
32+
"@typescript-eslint/parser": "^2.18.0",
3333
"eslint": "^6.8.0",
3434
"husky": "^4.2.1",
35-
"lint-staged": "^10.0.2",
35+
"lint-staged": "^10.0.4",
3636
"nodemon": "^2.0.2",
3737
"prettier": "^1.19.1",
3838
"ts-node": "^8.6.2",

source/model/Supplies.ts

+27-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1-
import { Length, IsArray, IsOptional } from 'class-validator';
1+
import {
2+
Length,
3+
IsObject,
4+
IsUrl,
5+
IsArray,
6+
IsOptional,
7+
IsString
8+
} from 'class-validator';
29

3-
interface Contact {
10+
import { Address } from './common';
11+
12+
export interface Supplies {
13+
name: string;
14+
type: 'face' | 'leg' | 'disinfection' | 'device' | 'other';
15+
remark: string;
16+
count: number;
17+
}
18+
19+
export interface Contact {
420
name: string;
521
phone: string;
622
}
@@ -9,16 +25,20 @@ export class RequirementModel {
925
@Length(5)
1026
hospital: string;
1127

12-
@Length(10)
13-
address: string;
28+
@IsObject()
29+
address: Address;
1430

15-
@IsArray()
16-
coords: number[];
31+
@IsUrl()
32+
url: string;
1733

1834
@IsArray()
19-
supplies: string[];
35+
supplies: Supplies[];
2036

2137
@IsOptional()
2238
@IsArray()
2339
contacts?: Contact[];
40+
41+
@IsOptional()
42+
@IsString()
43+
remark?: string;
2444
}

source/model/common.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface Address {
2+
province: string;
3+
city: string;
4+
district: string;
5+
detail: string;
6+
coords: number[];
7+
}

0 commit comments

Comments
 (0)