-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit da09071
Showing
59 changed files
with
9,507 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 🎨 editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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 @@ | ||
{ | ||
"extends": "./node_modules/mwts/", | ||
"ignorePatterns": ["node_modules", "dist", "test", "jest.config.js", "typings"], | ||
"env": { | ||
"jest": true | ||
} | ||
} |
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,18 @@ | ||
logs/ | ||
npm-debug.log | ||
yarn-error.log | ||
node_modules/ | ||
package-lock.json | ||
yarn.lock | ||
coverage/ | ||
dist/ | ||
.idea/ | ||
run/ | ||
.DS_Store | ||
*.sw* | ||
*.un~ | ||
.tsbuildinfo | ||
.tsbuildinfo.* | ||
#src/ | ||
#./src/**/*.local.ts | ||
config.local.ts |
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 @@ | ||
module.exports = { | ||
...require('mwts/.prettierrc.json') | ||
} |
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,30 @@ | ||
# my-midway-project | ||
|
||
## QuickStart | ||
|
||
<!-- add docs here for user --> | ||
|
||
see [midway docs][midway] for more detail. | ||
|
||
### Development | ||
|
||
```bash | ||
$ npm i | ||
$ npm run dev | ||
$ open http://localhost:7001/ | ||
``` | ||
|
||
### Deploy | ||
|
||
```bash | ||
$ npm start | ||
$ npm stop | ||
``` | ||
|
||
### npm scripts | ||
|
||
- Use `npm run lint` to check code style. | ||
- Use `npm test` to run unit test. | ||
|
||
|
||
[midway]: https://midwayjs.org |
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,30 @@ | ||
# my-midway-project | ||
|
||
## 快速入门 | ||
|
||
<!-- 在此次添加使用文档 --> | ||
|
||
如需进一步了解,参见 [midway 文档][midway]。 | ||
|
||
### 本地开发 | ||
|
||
```bash | ||
$ npm i | ||
$ npm run dev | ||
$ open http://localhost:7001/ | ||
``` | ||
|
||
### 部署 | ||
|
||
```bash | ||
$ npm start | ||
$ npm stop | ||
``` | ||
|
||
### 内置指令 | ||
|
||
- 使用 `npm run lint` 来做代码风格检查。 | ||
- 使用 `npm test` 来执行单元测试。 | ||
|
||
|
||
[midway]: https://midwayjs.org |
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,2 @@ | ||
const { Bootstrap } = require('@midwayjs/bootstrap'); | ||
Bootstrap.run(); |
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 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testPathIgnorePatterns: ['<rootDir>/test/fixtures'], | ||
coveragePathIgnorePatterns: ['<rootDir>/test/'], | ||
setupFilesAfterEnv: ['./jest.setup.js'] | ||
}; |
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 @@ | ||
jest.setTimeout(30000); |
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 @@ | ||
if [ $1 == "run" ];then | ||
npx mwtypeorm migration:run -d application/config/config.default.ts | ||
fi | ||
|
||
if [ $1 == "generate" ];then | ||
npx mwtypeorm migration:generate -d application/config/config.default.ts $2 | ||
fi |
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 { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class User1684998784938 implements MigrationInterface { | ||
name = 'User1684998784938'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
'CREATE TABLE `user` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `age` int NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('DROP TABLE `user`'); | ||
} | ||
} |
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 { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class User1684999468601 implements MigrationInterface { | ||
name = 'User1684999468601'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `gender` varchar(255) NOT NULL' | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `gender`'); | ||
} | ||
} |
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,37 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class User1685069789288 implements MigrationInterface { | ||
name = 'User1685069789288'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `delete_time` datetime(6) NULL' | ||
); | ||
await queryRunner.query('ALTER TABLE `user` CHANGE `id` `id` int NOT NULL'); | ||
await queryRunner.query('ALTER TABLE `user` DROP PRIMARY KEY'); | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `id`'); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `id` bigint NOT NULL PRIMARY KEY' | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `id`'); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `id` int NOT NULL AUTO_INCREMENT' | ||
); | ||
await queryRunner.query('ALTER TABLE `user` ADD PRIMARY KEY (`id`)'); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `id` `id` int NOT NULL AUTO_INCREMENT' | ||
); | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `delete_time`'); | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `update_time`'); | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `create_time`'); | ||
} | ||
} |
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 { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class User1685082490484 implements MigrationInterface { | ||
name = 'User1685082490484'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('ALTER TABLE `user` DROP PRIMARY KEY'); | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `id`'); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT' | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `id`'); | ||
await queryRunner.query('ALTER TABLE `user` ADD `id` bigint NOT NULL'); | ||
await queryRunner.query('ALTER TABLE `user` ADD PRIMARY KEY (`id`)'); | ||
} | ||
} |
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,27 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class User1685082956619 implements MigrationInterface { | ||
name = 'User1685082956619'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `id` `id` bigint NOT NULL' | ||
); | ||
await queryRunner.query('ALTER TABLE `user` DROP PRIMARY KEY'); | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `id`'); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `id` int NOT NULL PRIMARY KEY AUTO_INCREMENT' | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('ALTER TABLE `user` DROP COLUMN `id`'); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` ADD `id` bigint NOT NULL AUTO_INCREMENT' | ||
); | ||
await queryRunner.query('ALTER TABLE `user` ADD PRIMARY KEY (`id`)'); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `id` `id` bigint NOT NULL AUTO_INCREMENT' | ||
); | ||
} | ||
} |
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,51 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class User1685263894453 implements MigrationInterface { | ||
name = 'User1685263894453'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
"ALTER TABLE `user` CHANGE `id` `id` int NOT NULL AUTO_INCREMENT COMMENT '数据库主键,自增id'" | ||
); | ||
await queryRunner.query( | ||
"ALTER TABLE `user` CHANGE `create_time` `create_time` datetime(6) NOT NULL COMMENT '创建时间' DEFAULT CURRENT_TIMESTAMP(6)" | ||
); | ||
await queryRunner.query( | ||
"ALTER TABLE `user` CHANGE `update_time` `update_time` datetime(6) NOT NULL COMMENT '更新时间' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)" | ||
); | ||
await queryRunner.query( | ||
"ALTER TABLE `user` CHANGE `delete_time` `delete_time` datetime(6) NULL COMMENT '软删除字段'" | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `name` `name` varchar(255) NULL' | ||
); | ||
await queryRunner.query('ALTER TABLE `user` CHANGE `age` `age` int NULL'); | ||
await queryRunner.query( | ||
"ALTER TABLE `user` CHANGE `gender` `gender` varchar(255) NOT NULL DEFAULT '1'" | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `gender` `gender` varchar(255) NOT NULL' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `age` `age` int NOT NULL' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `name` `name` varchar(255) NOT NULL' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `delete_time` `delete_time` datetime(6) NULL' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `update_time` `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `create_time` `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)' | ||
); | ||
await queryRunner.query( | ||
'ALTER TABLE `user` CHANGE `id` `id` int NOT NULL AUTO_INCREMENT' | ||
); | ||
} | ||
} |
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,58 @@ | ||
{ | ||
"name": "mightyena", | ||
"version": "1.0.0", | ||
"description": "", | ||
"private": true, | ||
"dependencies": { | ||
"@midwayjs/bootstrap": "^3.0.0", | ||
"@midwayjs/core": "^3.0.0", | ||
"@midwayjs/decorator": "^3.0.0", | ||
"@midwayjs/typeorm": "3", | ||
"@midwayjs/validate": "^3.11.6", | ||
"@midwayjs/web": "^3.0.0", | ||
"dayjs": "^1.11.7", | ||
"egg": "^2.0.0", | ||
"egg-cors": "^2.2.3", | ||
"joi": "17.9.1", | ||
"mysql2": "^3.3.2", | ||
"qs": "^6.11.2", | ||
"typeorm": "^0.3.16" | ||
}, | ||
"devDependencies": { | ||
"@midwayjs/cli": "^2.0.0", | ||
"@midwayjs/egg-ts-helper": "^1.0.1", | ||
"@midwayjs/mock": "^3.0.0", | ||
"@types/jest": "^29.2.0", | ||
"@types/node": "14", | ||
"@types/qs": "^6.9.7", | ||
"cross-env": "^6.0.0", | ||
"egg-mock": "^3.26.0", | ||
"jest": "^29.2.2", | ||
"mwts": "^1.0.5", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "~4.8.0" | ||
}, | ||
"engines": { | ||
"node": ">=12.0.0" | ||
}, | ||
"scripts": { | ||
"start": "cross-env NODE_ENV=production node bootstrap.js", | ||
"dev": "cross-env ets && cross-env NODE_ENV=local midway-bin dev --ts", | ||
"test": "midway-bin test --ts", | ||
"cov": "midway-bin cov --ts", | ||
"lint": "mwts check", | ||
"lint:fix": "mwts fix", | ||
"ci": "npm run cov", | ||
"build": "midway-bin build -c" | ||
}, | ||
"midway-bin-clean": [ | ||
".vscode/.tsbuildinfo", | ||
"dist" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "" | ||
}, | ||
"author": "", | ||
"license": "MIT" | ||
} |
Oops, something went wrong.