This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
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
29 changed files
with
514 additions
and
14 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
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 |
---|---|---|
|
@@ -39,4 +39,6 @@ lerna-debug.log* | |
|
||
# env | ||
.env.local | ||
.env.prodction | ||
.env.prodction | ||
docker-compose.dev.yaml | ||
Dockerfile.dev |
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,69 @@ | ||
version: '3' | ||
|
||
services: | ||
eoapi-remote-server-test: | ||
# build: 从当前路径构建镜像 | ||
# build: . | ||
image: eolinker/eoapi-remote-server:1.9.0 | ||
container_name: eoapi-remote-server-test | ||
deploy: | ||
restart_policy: | ||
condition: on-failure | ||
max_attempts: 10 | ||
environment: | ||
# 服务配置 | ||
EOAPI_SERVER_PORT: 3001 | ||
EOAPI_API_PREFIX: /api | ||
MYSQL_HOST: host.docker.internal # 数据库地址 | ||
TZ: Asia/Shanghai | ||
# 数据库配置 | ||
MYSQL_PORT: 33066 # 数据库端口号 | ||
MYSQL_USERNAME: root | ||
MYSQL_DATABASE: eoapi-test | ||
MYSQL_PASSWORD: 123456a. | ||
MYSQL_ROOT_PASSWORD: 123456a. | ||
# swagger配置 | ||
SWAGGER_PATH: swagger-docs | ||
SWAGGER_ENABLE: 'true' | ||
SWAGGER_VERSION: 1.0 | ||
SWAGGER_TITLE: Eoapi-remote-server API文档 | ||
SWAGGER_DESC: Eoapi remote server API document。 | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
ports: | ||
- '3001:3001' | ||
networks: | ||
- eoapi_net | ||
|
||
eoapi: | ||
image: eolinker/eoapi:1.9.0-dev | ||
container_name: eoapi-dev | ||
deploy: | ||
restart_policy: | ||
condition: on-failure | ||
max_attempts: 3 | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
ports: | ||
- '3002:80' | ||
networks: | ||
- eoapi_net | ||
|
||
eoapi-test-server: | ||
image: eolinker/eoapi-test-server:1.9.0-dev | ||
container_name: eoapi-test-server-dev | ||
deploy: | ||
restart_policy: | ||
condition: on-failure | ||
max_attempts: 3 | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
ports: | ||
- '42011:4201' | ||
- '42022:4202' | ||
networks: | ||
- eoapi_net | ||
|
||
networks: | ||
eoapi_net: | ||
name: eoapi_net |
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
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
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,19 @@ | ||
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
|
||
export type XHeaderType = { | ||
projectID: number; | ||
workspaceID: number; | ||
}; | ||
|
||
type Keys = keyof XHeaderType; | ||
|
||
export const XHeader = createParamDecorator( | ||
(_data: Keys, ctx: ExecutionContext) => { | ||
const { headers } = ctx.switchToHttp().getRequest(); | ||
const result: XHeaderType = { | ||
projectID: headers['x-project-id'], | ||
workspaceID: headers['x-workspace-id'], | ||
}; | ||
return result[_data] ?? result; | ||
}, | ||
); |
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 { Column, Entity, Generated } from 'typeorm'; | ||
import { FictitiousBase } from './base.entity'; | ||
|
||
@Entity({ name: 'shared' }) | ||
export class SharedEntity extends FictitiousBase { | ||
@Column() | ||
@Generated('uuid') | ||
uniqueID: string; | ||
|
||
@Column() | ||
projectID: number; | ||
} |
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,34 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class updateTable1901666580390462 implements MigrationInterface { | ||
name = 'updateTable1901666580390462' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE \`shared\` (\`createdAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`uuid\` int NOT NULL AUTO_INCREMENT, \`uniqueID\` varchar(36) NOT NULL, \`projectID\` int NOT NULL, PRIMARY KEY (\`uuid\`)) ENGINE=InnoDB`); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`project\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`project\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`mock\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`mock\` ADD \`name\` varchar(255) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`environment\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`environment\` ADD \`name\` varchar(255) NOT NULL`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`environment\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`environment\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`mock\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`mock\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`project\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`project\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_group\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` DROP COLUMN \`name\``); | ||
await queryRunner.query(`ALTER TABLE \`api_data\` ADD \`name\` varchar(500) NOT NULL`); | ||
await queryRunner.query(`DROP TABLE \`shared\``); | ||
} | ||
|
||
} |
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,3 @@ | ||
export * from './login.dto'; | ||
export * from './logout.dto'; | ||
export * from './refresh.dto'; |
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,20 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { | ||
IsMobilePhone, | ||
IsNotEmpty, | ||
IsString, | ||
MinLength, | ||
} from 'class-validator'; | ||
|
||
export class LoginInfoDto { | ||
@ApiProperty({ description: '用户名' }) | ||
@IsString() | ||
@IsNotEmpty({ message: '用户名不能为空' }) | ||
username: string; | ||
|
||
@ApiProperty({ description: '密码' }) | ||
@IsNotEmpty({ message: '密码不能为空' }) | ||
@IsString() | ||
@MinLength(6) | ||
password: string; | ||
} |
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,8 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsString } from 'class-validator'; | ||
|
||
export class JwtLogoutDto { | ||
@ApiProperty() | ||
@IsString() | ||
refreshToken: string; | ||
} |
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,8 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsString } from 'class-validator'; | ||
|
||
export class JwtRefreshTokenDto { | ||
@ApiProperty() | ||
@IsString() | ||
refreshToken: string; | ||
} |
Oops, something went wrong.