-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"cSpell.words": [ | ||
"autorestart", | ||
"ctsx", | ||
"EDITMSG", | ||
"gitmoji", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 前端监控模块 | ||
|
||
- 监控网站情况 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "monitor", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
apps: [ | ||
{ | ||
name: 'poster-craft-server', | ||
script: 'pnpm', | ||
args: 'start:prod', | ||
cwd: '.', | ||
instances: 1, | ||
autorestart: true, | ||
watch: false, | ||
max_memory_restart: '1G', | ||
env: { | ||
NODE_ENV: 'production', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ApiProperty, PickType } from '@nestjs/swagger'; | ||
import { IsNotEmpty, Length } from 'class-validator'; | ||
|
||
export class CreateUserDto { | ||
@ApiProperty({ | ||
example: 'admin', | ||
description: '用户名不能为空,长度为2-20位', | ||
}) | ||
@IsNotEmpty({ message: '用户名不能为空' }) | ||
@Length(2, 20, { message: '用户名长度为2-20位' }) | ||
username: string; | ||
|
||
@ApiProperty({ | ||
example: '15512345678', | ||
description: '手机号码不能为空,长度应在6-20位之间', | ||
}) | ||
@IsNotEmpty({ message: '手机号码不能为空' }) | ||
@Length(6, 20, { message: '手机号码长度应在6到20位之间' }) | ||
phone: string; | ||
|
||
@ApiProperty({ | ||
example: '123456', | ||
description: '密码不能为空,长度应在6-20位之间', | ||
}) | ||
@IsNotEmpty({ message: '密码不能为空' }) | ||
@Length(6, 20, { message: '密码长度为6-20位' }) | ||
password: string; | ||
|
||
avatar: string; | ||
} | ||
|
||
export class FindUserDto { | ||
@ApiProperty() | ||
@IsNotEmpty({ message: '手机号码不能为空' }) | ||
@Length(6, 20, { message: '手机号码长度应在6到20位之间' }) | ||
phone: string; | ||
} | ||
|
||
export class UpdateUserDto extends PickType(CreateUserDto, [ | ||
'username', | ||
'avatar', | ||
]) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Body, Controller, Get, Patch, Post, UseGuards } from '@nestjs/common'; | ||
|
||
@Controller('user') | ||
export class UserController {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
|
||
type User = { | ||
userId: string; | ||
}; | ||
export type UserEntity = User | null; | ||
|
||
export const User: () => ParameterDecorator = createParamDecorator( | ||
(data: unknown, ctx: ExecutionContext) => { | ||
const request = ctx.switchToHttp().getRequest(); | ||
return { | ||
userId: request.userId, | ||
}; | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { UserController } from './user.controller'; | ||
import { UserService } from './user.service'; | ||
|
||
@Module({ | ||
imports: [], | ||
providers: [UserService], | ||
controllers: [UserController], | ||
exports: [UserService], | ||
}) | ||
export class UserModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { HttpException, Inject, Injectable } from '@nestjs/common'; | ||
import { eq } from 'drizzle-orm'; | ||
|
||
@Injectable() | ||
export class UserService { | ||
constructor() {} | ||
} |