create-dp-koa 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.cursor/commands/cheatsheet-backend-controller.md +2 -2
- package/template/.cursor/commands/implement-backend-api-controller.md +6 -4
- package/template/.cursor/rules/11-backend-controller-recipes.skill.md +89 -10
- package/template/.trae/skills/11-backend-controller-recipes.skill.md +91 -10
- package/template/src/controllers/example/ExampleController.ts +14 -0
- package/template/src/entity/index.ts +1 -15
- package/template/src/framework/decorator/processor/AnnotationProcessor.ts +5 -1
- package/template/src/routers/index.ts +0 -35
- package/template/src/utils/testDataInitializer.ts +2 -269
- package/template/test/controllers/example/ExampleController.test.ts +29 -31
- package/template/test/framework/annotation/AnnotationDecorators.test.ts +15 -15
- package/template/test/framework/annotation/AnnotationExecutor.test.ts +27 -32
- package/template/test/framework/annotation/AnnotationProcessor.test.ts +25 -24
- package/template/test/framework/annotation/CustomProcessors.test.ts +15 -25
- package/template/test/framework/annotation/NewRouter.test.ts +9 -7
- package/template/test/framework/annotation/ProcessorManager.test.ts +14 -27
- package/template/test/framework/databaseConfig.test.ts +2 -2
- package/template/test/integration/integration.test.ts +15 -72
- package/template/src/controllers/cacheManagement.controller.ts +0 -131
- package/template/src/controllers/captcha.controller.ts +0 -57
- package/template/src/controllers/example/NewAnnotationExampleController.ts +0 -159
- package/template/src/controllers/example/SwaggerExampleController.ts +0 -205
- package/template/src/controllers/example/TransactionExample.controller.ts +0 -336
- package/template/src/controllers/health.controller.ts +0 -235
- package/template/src/controllers/home/register.controller.ts +0 -58
- package/template/src/controllers/home/ytGoods.controller.ts +0 -92
- package/template/src/controllers/home/ytShop.controller.ts +0 -135
- package/template/src/controllers/home/ytUser.controller.ts +0 -89
- package/template/src/controllers/logManagement.controller.ts +0 -396
- package/template/src/controllers/public/emailSend.controller.ts +0 -65
- package/template/src/controllers/public/ytUserAuth.controller.ts +0 -174
- package/template/src/controllers/testData.controller.ts +0 -253
- package/template/src/dto/controller/example/NewAnnotationExampleController.dto.ts +0 -73
- package/template/src/dto/controller/home/emailSend.controller.dto.ts +0 -40
- package/template/src/dto/controller/home/register.controller.dto.ts +0 -45
- package/template/src/dto/controller/home/ytGoods.controller.dto.ts +0 -55
- package/template/src/dto/controller/home/ytShop.controller.dto.ts +0 -69
- package/template/src/dto/controller/home/ytUser.controller.dto.ts +0 -44
- package/template/src/dto/controller/public/ytUserAuth.controller.dto.ts +0 -63
- package/template/src/dto/goods.dto.ts +0 -212
- package/template/src/dto/service/ytService.dto.ts +0 -13
- package/template/src/dto/user.dto.ts +0 -177
- package/template/src/entity/columnTypes.ts +0 -13
- package/template/src/entity/goodsImagesUnlockKey.entity.ts +0 -33
- package/template/src/entity/goodsUnlocker.entity.ts +0 -34
- package/template/src/entity/shop.entity.ts +0 -52
- package/template/src/entity/shopUser.entity.ts +0 -41
- package/template/src/entity/ytGoods.entity.ts +0 -94
- package/template/src/entity/ytUser.entity.ts +0 -96
- package/template/src/examples/SwaggerProcessorExample.ts +0 -169
- package/template/src/examples/TransactionManagerDemo.ts +0 -377
- package/template/src/framework/utils/dynamicSwagger.ts +0 -410
- package/template/src/repository/UserRepository.ts +0 -122
- package/template/src/service/paramValidateTest.service.ts +0 -139
- package/template/src/service/ytGoods.service.ts +0 -42
- package/template/src/service/ytShop.service.ts +0 -90
- package/template/src/service/ytUser.service.ts +0 -451
- package/template/src/test/swaggerParameterTest.ts +0 -90
- package/template/test/controllers/controllers.test.ts +0 -173
- package/template/test/controllers/example/NewAnnotationExampleController.test.ts +0 -200
- package/template/test/framework/TransactionManagerDemo.test.ts +0 -363
- package/template/test/service/business.test.ts +0 -87
- package/template/test/service/paramValidateTest.service.test.ts +0 -184
- package/template/test/service/ytUser.service.test.ts +0 -566
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { Get, Post } from '@src/framework/decorator/controller';
|
|
2
|
-
import { Body } from '@src/framework/decorator/controller';
|
|
3
|
-
import { BaseController } from '@src/controllers/base.controller';
|
|
4
|
-
import { testDataInitializer } from '@src/utils/testDataInitializer';
|
|
5
|
-
import { getDataSource } from '@src/framework/utils/db';
|
|
6
|
-
import { logger } from '@src/framework/utils/logger';
|
|
7
|
-
|
|
8
|
-
export class TestDataController extends BaseController {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 检查是否为内存数据库模式
|
|
12
|
-
*/
|
|
13
|
-
private isMemoryDatabase(): boolean {
|
|
14
|
-
const dataSource = getDataSource();
|
|
15
|
-
if (!dataSource || !dataSource.isInitialized) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const driver = (dataSource as any).driver;
|
|
20
|
-
return driver && driver.options && driver.options.database === ':memory:';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 获取测试数据状态
|
|
25
|
-
*/
|
|
26
|
-
@Get('/test-data/status')
|
|
27
|
-
async getTestDataStatus() {
|
|
28
|
-
if (!this.isMemoryDatabase()) {
|
|
29
|
-
return this.fail(400, '当前不是内存数据库模式');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const dataSource = getDataSource();
|
|
34
|
-
if (!dataSource) {
|
|
35
|
-
return this.fail(500, '数据库连接未初始化');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 统计各表的数据量
|
|
39
|
-
const userCount = await dataSource.query("SELECT COUNT(*) as count FROM yt_user");
|
|
40
|
-
const shopCount = await dataSource.query("SELECT COUNT(*) as count FROM shop");
|
|
41
|
-
const goodsCount = await dataSource.query("SELECT COUNT(*) as count FROM yt_goods");
|
|
42
|
-
const unlockKeyCount = await dataSource.query("SELECT COUNT(*) as count FROM goods_images_unlock_key");
|
|
43
|
-
const shopUserCount = await dataSource.query("SELECT COUNT(*) as count FROM shop_user");
|
|
44
|
-
|
|
45
|
-
return this.success({
|
|
46
|
-
isMemoryDatabase: true,
|
|
47
|
-
dataCounts: {
|
|
48
|
-
users: userCount[0]?.count || 0,
|
|
49
|
-
shops: shopCount[0]?.count || 0,
|
|
50
|
-
goods: goodsCount[0]?.count || 0,
|
|
51
|
-
unlockKeys: unlockKeyCount[0]?.count || 0,
|
|
52
|
-
shopUsers: shopUserCount[0]?.count || 0
|
|
53
|
-
},
|
|
54
|
-
timestamp: new Date().toISOString()
|
|
55
|
-
});
|
|
56
|
-
} catch (error) {
|
|
57
|
-
logger.error('获取测试数据状态失败:', error as Error);
|
|
58
|
-
return this.fail(500, `获取测试数据状态失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* 初始化测试数据
|
|
64
|
-
*/
|
|
65
|
-
@Post('/test-data/init')
|
|
66
|
-
async initTestData() {
|
|
67
|
-
if (!this.isMemoryDatabase()) {
|
|
68
|
-
return this.fail(400, '当前不是内存数据库模式');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
await testDataInitializer.initializeTestData();
|
|
73
|
-
logger.info('手动初始化测试数据完成');
|
|
74
|
-
|
|
75
|
-
return this.success({
|
|
76
|
-
message: '测试数据初始化完成',
|
|
77
|
-
timestamp: new Date().toISOString()
|
|
78
|
-
});
|
|
79
|
-
} catch (error) {
|
|
80
|
-
logger.error('初始化测试数据失败:', error as Error);
|
|
81
|
-
return this.fail(500, `初始化测试数据失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 清空测试数据
|
|
87
|
-
*/
|
|
88
|
-
@Post('/test-data/clear')
|
|
89
|
-
async clearTestData() {
|
|
90
|
-
if (!this.isMemoryDatabase()) {
|
|
91
|
-
return this.fail(400, '当前不是内存数据库模式');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
await testDataInitializer.clearTestData();
|
|
96
|
-
logger.info('手动清空测试数据完成');
|
|
97
|
-
|
|
98
|
-
return this.success({
|
|
99
|
-
message: '测试数据已清空',
|
|
100
|
-
timestamp: new Date().toISOString()
|
|
101
|
-
});
|
|
102
|
-
} catch (error) {
|
|
103
|
-
logger.error('清空测试数据失败:', error as Error);
|
|
104
|
-
return this.fail(500, `清空测试数据失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* 重新初始化测试数据(先清空再初始化)
|
|
110
|
-
*/
|
|
111
|
-
@Post('/test-data/reset')
|
|
112
|
-
async resetTestData() {
|
|
113
|
-
if (!this.isMemoryDatabase()) {
|
|
114
|
-
return this.fail(400, '当前不是内存数据库模式');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
try {
|
|
118
|
-
await testDataInitializer.clearTestData();
|
|
119
|
-
await testDataInitializer.initializeTestData();
|
|
120
|
-
logger.info('手动重置测试数据完成');
|
|
121
|
-
|
|
122
|
-
return this.success({
|
|
123
|
-
message: '测试数据已重置',
|
|
124
|
-
timestamp: new Date().toISOString()
|
|
125
|
-
});
|
|
126
|
-
} catch (error) {
|
|
127
|
-
logger.error('重置测试数据失败:', error as Error);
|
|
128
|
-
return this.fail(500, `重置测试数据失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* 获取测试用户信息(用于测试API)
|
|
134
|
-
*/
|
|
135
|
-
@Get('/test-data/users')
|
|
136
|
-
async getTestUsers() {
|
|
137
|
-
if (!this.isMemoryDatabase()) {
|
|
138
|
-
return this.fail(400, '当前不是内存数据库模式');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
try {
|
|
142
|
-
const dataSource = getDataSource();
|
|
143
|
-
if (!dataSource) {
|
|
144
|
-
return this.fail(500, '数据库连接未初始化');
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const users = await dataSource.query(`
|
|
148
|
-
SELECT
|
|
149
|
-
u.id,
|
|
150
|
-
u.nickName,
|
|
151
|
-
u.email,
|
|
152
|
-
u.telnumber,
|
|
153
|
-
u.userType,
|
|
154
|
-
u.status,
|
|
155
|
-
u.avatar,
|
|
156
|
-
u.gender,
|
|
157
|
-
u.age,
|
|
158
|
-
u.constellation
|
|
159
|
-
FROM yt_user u
|
|
160
|
-
ORDER BY u.id
|
|
161
|
-
`);
|
|
162
|
-
|
|
163
|
-
return this.success({
|
|
164
|
-
users,
|
|
165
|
-
count: users.length,
|
|
166
|
-
timestamp: new Date().toISOString()
|
|
167
|
-
});
|
|
168
|
-
} catch (error) {
|
|
169
|
-
logger.error('获取测试用户失败:', error as Error);
|
|
170
|
-
return this.fail(500, `获取测试用户失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* 获取测试店铺信息
|
|
176
|
-
*/
|
|
177
|
-
@Get('/test-data/shops')
|
|
178
|
-
async getTestShops() {
|
|
179
|
-
if (!this.isMemoryDatabase()) {
|
|
180
|
-
return this.fail(400, '当前不是内存数据库模式');
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
try {
|
|
184
|
-
const dataSource = getDataSource();
|
|
185
|
-
if (!dataSource) {
|
|
186
|
-
return this.fail(500, '数据库连接未初始化');
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const shops = await dataSource.query(`
|
|
190
|
-
SELECT
|
|
191
|
-
s.id,
|
|
192
|
-
s.name,
|
|
193
|
-
s.description,
|
|
194
|
-
s.status,
|
|
195
|
-
u.nickName as ownerName,
|
|
196
|
-
u.email as ownerEmail
|
|
197
|
-
FROM shop s
|
|
198
|
-
LEFT JOIN shop_user su ON s.id = su.shopId
|
|
199
|
-
LEFT JOIN yt_user u ON su.userId = u.id
|
|
200
|
-
ORDER BY s.id
|
|
201
|
-
`);
|
|
202
|
-
|
|
203
|
-
return this.success({
|
|
204
|
-
shops,
|
|
205
|
-
count: shops.length,
|
|
206
|
-
timestamp: new Date().toISOString()
|
|
207
|
-
});
|
|
208
|
-
} catch (error) {
|
|
209
|
-
logger.error('获取测试店铺失败:', error as Error);
|
|
210
|
-
return this.fail(500, `获取测试店铺失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* 获取测试商品信息
|
|
216
|
-
*/
|
|
217
|
-
@Get('/test-data/goods')
|
|
218
|
-
async getTestGoods() {
|
|
219
|
-
if (!this.isMemoryDatabase()) {
|
|
220
|
-
return this.fail(400, '当前不是内存数据库模式');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
try {
|
|
224
|
-
const dataSource = getDataSource();
|
|
225
|
-
if (!dataSource) {
|
|
226
|
-
return this.fail(500, '数据库连接未初始化');
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const goods = await dataSource.query(`
|
|
230
|
-
SELECT
|
|
231
|
-
g.id,
|
|
232
|
-
g.name,
|
|
233
|
-
g.description,
|
|
234
|
-
g.price,
|
|
235
|
-
g.albums,
|
|
236
|
-
g.status,
|
|
237
|
-
s.name as shopName
|
|
238
|
-
FROM yt_goods g
|
|
239
|
-
LEFT JOIN shop s ON g.shopId = s.id
|
|
240
|
-
ORDER BY g.id
|
|
241
|
-
`);
|
|
242
|
-
|
|
243
|
-
return this.success({
|
|
244
|
-
goods,
|
|
245
|
-
count: goods.length,
|
|
246
|
-
timestamp: new Date().toISOString()
|
|
247
|
-
});
|
|
248
|
-
} catch (error) {
|
|
249
|
-
logger.error('获取测试商品失败:', error as Error);
|
|
250
|
-
return this.fail(500, `获取测试商品失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { IsString, IsOptional, IsNumber, IsEmail, MinLength, MaxLength } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 示例查询参数 DTO
|
|
5
|
-
*/
|
|
6
|
-
export class ExampleQueryDto {
|
|
7
|
-
@IsOptional()
|
|
8
|
-
@IsString()
|
|
9
|
-
id?: string;
|
|
10
|
-
|
|
11
|
-
@IsOptional()
|
|
12
|
-
@IsString()
|
|
13
|
-
@MinLength(1)
|
|
14
|
-
@MaxLength(50)
|
|
15
|
-
name?: string;
|
|
16
|
-
|
|
17
|
-
@IsOptional()
|
|
18
|
-
@IsString()
|
|
19
|
-
category?: string;
|
|
20
|
-
|
|
21
|
-
@IsOptional()
|
|
22
|
-
@IsNumber()
|
|
23
|
-
page?: number;
|
|
24
|
-
|
|
25
|
-
@IsOptional()
|
|
26
|
-
@IsNumber()
|
|
27
|
-
limit?: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 示例请求体 DTO
|
|
32
|
-
*/
|
|
33
|
-
export class ExampleBodyDto {
|
|
34
|
-
@IsString()
|
|
35
|
-
@MinLength(1)
|
|
36
|
-
@MaxLength(100)
|
|
37
|
-
name: string;
|
|
38
|
-
|
|
39
|
-
@IsString()
|
|
40
|
-
@MinLength(1)
|
|
41
|
-
@MaxLength(500)
|
|
42
|
-
value: string;
|
|
43
|
-
|
|
44
|
-
@IsOptional()
|
|
45
|
-
@IsEmail()
|
|
46
|
-
email?: string;
|
|
47
|
-
|
|
48
|
-
@IsOptional()
|
|
49
|
-
@IsNumber()
|
|
50
|
-
age?: number;
|
|
51
|
-
|
|
52
|
-
@IsOptional()
|
|
53
|
-
@IsString()
|
|
54
|
-
description?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 示例响应 DTO
|
|
59
|
-
*/
|
|
60
|
-
export class ExampleResponseDto {
|
|
61
|
-
@IsString()
|
|
62
|
-
message: string;
|
|
63
|
-
|
|
64
|
-
@IsOptional()
|
|
65
|
-
data?: any;
|
|
66
|
-
|
|
67
|
-
@IsOptional()
|
|
68
|
-
timestamp?: string;
|
|
69
|
-
|
|
70
|
-
@IsOptional()
|
|
71
|
-
@IsNumber()
|
|
72
|
-
code?: number;
|
|
73
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Transform } from "@src/framework/decorator/controller";
|
|
2
|
-
import { Trim } from "@src/framework/utils/transform";
|
|
3
|
-
import { IsEmail, IsNumber, IsString, Length } from "class-validator";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 发送邮件请求参数
|
|
7
|
-
*/
|
|
8
|
-
export class SendEmailDto {
|
|
9
|
-
|
|
10
|
-
@IsString({
|
|
11
|
-
message: "邮箱必须是字符串"
|
|
12
|
-
})
|
|
13
|
-
@Transform((val) => {
|
|
14
|
-
const str = String(val);
|
|
15
|
-
return Trim(str);
|
|
16
|
-
})
|
|
17
|
-
@IsEmail({}, {
|
|
18
|
-
message: "请输入有效的邮箱"
|
|
19
|
-
})
|
|
20
|
-
email: string;
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 发送邮件响应参数
|
|
26
|
-
*/
|
|
27
|
-
export class SendEmailResponseDto {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@Length(1, 256, {
|
|
31
|
-
message: "token长度必须在1-256之间"
|
|
32
|
-
})
|
|
33
|
-
@IsString({
|
|
34
|
-
message: "响应token必须是字符串"
|
|
35
|
-
})
|
|
36
|
-
vcodeToken: string;
|
|
37
|
-
|
|
38
|
-
@IsNumber()
|
|
39
|
-
expire: number
|
|
40
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { IsEmail, IsString, Length } from "class-validator";
|
|
2
|
-
import { Transform } from "@src/framework/decorator/controller";
|
|
3
|
-
import { Trim } from "@src/framework/utils/transform";
|
|
4
|
-
|
|
5
|
-
export class YtUserRegisterDto {
|
|
6
|
-
|
|
7
|
-
@IsString({
|
|
8
|
-
message: "邮箱必须是字符串"
|
|
9
|
-
})
|
|
10
|
-
@Transform((val) => {
|
|
11
|
-
const str = String(val);
|
|
12
|
-
return Trim(str);
|
|
13
|
-
})
|
|
14
|
-
@IsEmail({}, {
|
|
15
|
-
message: "请输入有效的邮箱"
|
|
16
|
-
})
|
|
17
|
-
email: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@Transform((val) => {
|
|
21
|
-
const str = String(val);
|
|
22
|
-
return Trim(str);
|
|
23
|
-
})
|
|
24
|
-
@Length(6, 12, {
|
|
25
|
-
message: "密码长度为6-12"
|
|
26
|
-
})
|
|
27
|
-
@IsString()
|
|
28
|
-
password: string
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 短信验证码
|
|
32
|
-
*/
|
|
33
|
-
@Length(4, 6)
|
|
34
|
-
@IsString()
|
|
35
|
-
@Transform(Trim)
|
|
36
|
-
vcode: string
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 短信验证码的token
|
|
40
|
-
*/
|
|
41
|
-
@IsString()
|
|
42
|
-
@Transform(Trim)
|
|
43
|
-
vcodeToken: string
|
|
44
|
-
}
|
|
45
|
-
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Transform } from "@src/framework/decorator/controller";
|
|
2
|
-
import { IsArray, IsNumber, IsString } from "class-validator";
|
|
3
|
-
|
|
4
|
-
export class GetGoodsInfoDto {
|
|
5
|
-
|
|
6
|
-
@IsNumber()
|
|
7
|
-
@Transform(id => Number(id))
|
|
8
|
-
id: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class GetGoodsInfoResultDto {
|
|
12
|
-
|
|
13
|
-
@IsNumber()
|
|
14
|
-
id: number
|
|
15
|
-
|
|
16
|
-
@IsString()
|
|
17
|
-
name: string
|
|
18
|
-
|
|
19
|
-
@IsArray()
|
|
20
|
-
albums: string[]
|
|
21
|
-
|
|
22
|
-
@IsNumber()
|
|
23
|
-
price: number
|
|
24
|
-
|
|
25
|
-
@IsString()
|
|
26
|
-
description: string
|
|
27
|
-
|
|
28
|
-
@IsString()
|
|
29
|
-
content: string;
|
|
30
|
-
|
|
31
|
-
@IsArray()
|
|
32
|
-
imagesContent: string[]
|
|
33
|
-
|
|
34
|
-
@IsArray()
|
|
35
|
-
tags: string[]
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class GetGoodsUnlockInfoDto {
|
|
40
|
-
|
|
41
|
-
@IsNumber()
|
|
42
|
-
@Transform(id => Number(id))
|
|
43
|
-
goodsId: number
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export class UnlockGoodsImageDto {
|
|
47
|
-
|
|
48
|
-
@IsString()
|
|
49
|
-
key: string
|
|
50
|
-
|
|
51
|
-
@IsNumber()
|
|
52
|
-
@Transform(id => Number(id))
|
|
53
|
-
goodsId: number
|
|
54
|
-
}
|
|
55
|
-
// export class GetGoodsUnlockInfoResponseDto {}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ShopStatusEnum } from "@src/entity/shop.entity";
|
|
2
|
-
import { Transform } from "@src/framework/decorator/controller";
|
|
3
|
-
import { IsArray, IsNumber, IsString } from "class-validator";
|
|
4
|
-
|
|
5
|
-
export class GetShopInfoByIdQueryDto {
|
|
6
|
-
|
|
7
|
-
@Transform((value) => Number(value))
|
|
8
|
-
@IsNumber()
|
|
9
|
-
id: number
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class GetShopInfoByIdResultDto {
|
|
13
|
-
|
|
14
|
-
@IsNumber()
|
|
15
|
-
id: number;
|
|
16
|
-
|
|
17
|
-
@IsString()
|
|
18
|
-
name: string;
|
|
19
|
-
|
|
20
|
-
@IsString()
|
|
21
|
-
description: string;
|
|
22
|
-
|
|
23
|
-
@IsNumber()
|
|
24
|
-
userId: number
|
|
25
|
-
|
|
26
|
-
@IsString()
|
|
27
|
-
status: ShopStatusEnum
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class GetShopGoodsListQueryDto {
|
|
31
|
-
|
|
32
|
-
@Transform((value) => Number(value))
|
|
33
|
-
@IsNumber()
|
|
34
|
-
id: number;
|
|
35
|
-
|
|
36
|
-
@Transform((value) => Number(value))
|
|
37
|
-
@IsNumber()
|
|
38
|
-
page: number;
|
|
39
|
-
|
|
40
|
-
@Transform((value) => Number(value))
|
|
41
|
-
@IsNumber()
|
|
42
|
-
pageSize: number;
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export class GetShopGoodsListResultDto {
|
|
48
|
-
@IsNumber()
|
|
49
|
-
id: number;
|
|
50
|
-
|
|
51
|
-
@IsString()
|
|
52
|
-
name: string;
|
|
53
|
-
|
|
54
|
-
@IsString()
|
|
55
|
-
description: string;
|
|
56
|
-
|
|
57
|
-
@IsNumber()
|
|
58
|
-
price: number;
|
|
59
|
-
|
|
60
|
-
@IsArray({})
|
|
61
|
-
albums: string[];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export class GetShopUserInfoDto {
|
|
65
|
-
|
|
66
|
-
@Transform((value) => Number(value))
|
|
67
|
-
@IsNumber()
|
|
68
|
-
shopId: number;
|
|
69
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { YtUserStatusEnum, YtUserTypeEnum } from "@src/entity/ytUser.entity";
|
|
2
|
-
import { Transform } from "@src/framework/decorator/controller";
|
|
3
|
-
import { IsEmail, IsNumber, isString, IsString, ValidateIf } from "class-validator";
|
|
4
|
-
import { Column } from "typeorm";
|
|
5
|
-
|
|
6
|
-
export class GetUserInfoResponseDto {
|
|
7
|
-
|
|
8
|
-
@IsNumber()
|
|
9
|
-
id: number
|
|
10
|
-
|
|
11
|
-
@IsString()
|
|
12
|
-
@ValidateIf(o => o.nickName)
|
|
13
|
-
nickName: string
|
|
14
|
-
|
|
15
|
-
@IsEmail()
|
|
16
|
-
@IsString()
|
|
17
|
-
email: string
|
|
18
|
-
|
|
19
|
-
@IsString()
|
|
20
|
-
avatar: string
|
|
21
|
-
|
|
22
|
-
@IsNumber()
|
|
23
|
-
gender: number
|
|
24
|
-
|
|
25
|
-
@IsString()
|
|
26
|
-
constellation: string
|
|
27
|
-
|
|
28
|
-
@IsNumber()
|
|
29
|
-
age: number
|
|
30
|
-
|
|
31
|
-
@IsString()
|
|
32
|
-
status: YtUserStatusEnum
|
|
33
|
-
|
|
34
|
-
@IsString()
|
|
35
|
-
type: YtUserTypeEnum
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class getUserInfoByIdDto {
|
|
39
|
-
|
|
40
|
-
@Transform((v)=>Number(v))
|
|
41
|
-
@IsNumber()
|
|
42
|
-
id:number
|
|
43
|
-
|
|
44
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Transform } from "@src/framework/decorator/controller";
|
|
2
|
-
import { Trim } from "@src/framework/utils/transform";
|
|
3
|
-
import { IsEmail, IsNumber, IsString, Length } from "class-validator";
|
|
4
|
-
|
|
5
|
-
export class YtUserLoginDto {
|
|
6
|
-
|
|
7
|
-
@IsString({
|
|
8
|
-
message: "邮箱必须是字符串"
|
|
9
|
-
})
|
|
10
|
-
@Transform((val) => {
|
|
11
|
-
const str = String(val);
|
|
12
|
-
return Trim(str);
|
|
13
|
-
})
|
|
14
|
-
@IsEmail({}, {
|
|
15
|
-
message: "请输入有效的邮箱"
|
|
16
|
-
})
|
|
17
|
-
email: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@Transform((val) => {
|
|
21
|
-
const str = String(val);
|
|
22
|
-
return Trim(str);
|
|
23
|
-
})
|
|
24
|
-
@IsString()
|
|
25
|
-
vcode: string;
|
|
26
|
-
|
|
27
|
-
@IsString()
|
|
28
|
-
vcodeToken: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export class YtUserLoginAutoDto {
|
|
33
|
-
|
|
34
|
-
@Transform((val) => {
|
|
35
|
-
const str = String(val);
|
|
36
|
-
return Trim(str);
|
|
37
|
-
})
|
|
38
|
-
@IsString()
|
|
39
|
-
vcode: string;
|
|
40
|
-
|
|
41
|
-
@IsString()
|
|
42
|
-
vcodeToken: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class GetYtUserBasicInfoDto {
|
|
46
|
-
@IsNumber()
|
|
47
|
-
@Transform(id => Number(id))
|
|
48
|
-
id: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export class GetYtUserBasicInfoResponseDto {
|
|
52
|
-
|
|
53
|
-
@IsNumber()
|
|
54
|
-
id: number
|
|
55
|
-
|
|
56
|
-
@IsString()
|
|
57
|
-
name: string
|
|
58
|
-
|
|
59
|
-
@IsString()
|
|
60
|
-
avatar: string
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|