Skip to content

Commit

Permalink
feat: add new data seed
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidZORO committed May 21, 2020
1 parent aec4913 commit 434b6a8
Show file tree
Hide file tree
Showing 28 changed files with 991 additions and 1,081 deletions.
7 changes: 1 addition & 6 deletions packages/_leaa-common/src/entrys/user.entity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Index, Entity, Column, JoinTable, ManyToMany } from 'typeorm';
import { Exclude, Expose } from 'class-transformer';
import { Exclude } from 'class-transformer';

import { Base, Role, Permission, Address, Attachment } from '@leaa/common/src/entrys';

Expand All @@ -10,11 +10,6 @@ export class User extends Base {
@Column({ type: 'varchar', length: 64, nullable: true, default: '' })
name?: string;

@Expose()
get fullName(): string {
return `${this.name} ------------ `;
}

// @Column({ type: 'varchar', length: 32, unique: true })
@Column({ type: 'varchar', length: 32, default: '', nullable: true })
phone?: string;
Expand Down
7 changes: 7 additions & 0 deletions packages/_leaa-common/src/interfaces/permission.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ declare const permissionSlug: [
'auth.list-read',
'auth.item-delete',
// --------------------
'oauth.list-read',
//
'oauth.item-read',
'oauth.item-create',
'oauth.item-update',
'oauth.item-delete',
// --------------------
'action.list-read',
//
'action.item-read',
Expand Down
2 changes: 1 addition & 1 deletion packages/leaa-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"---------------------------------------------------------------------- DEV ----": "----",
"dev-tsnodedev": "NODE_ENV=development ts-node-dev --respawn --transpileOnly --ignore-watch node_modules -r tsconfig-paths/register ./src/main.ts",
"dev": "NODE_ENV=development yarn dev-tsnodedev",
"seed": "NODE_ENV=development ts-node-dev --respawn --transpileOnly -r tsconfig-paths/register ./src/seed.ts",
"seed": "NODE_ENV=development ts-node-dev --respawn --transpileOnly -r tsconfig-paths/register src/modules/seed/seed.command.ts",
"clear": "rimraf _build",
"---------------------------------------------------------------------- PROD ----": "----",
"prod": "NODE_ENV=production ts-node-dev --respawn --transpileOnly -r tsconfig-paths/register ./src/main.ts",
Expand Down
239 changes: 0 additions & 239 deletions packages/leaa-api/src/modules/auth/auth-local.service.ts

This file was deleted.

88 changes: 6 additions & 82 deletions packages/leaa-api/src/modules/auth/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,91 +1,15 @@
import { Controller, Get, Post, Req, Res, Body, Param, HttpCode, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';

import { AuthGithubService } from '@leaa/api/src/modules/auth/auth-github.service';
import { AuthLocalService } from '@leaa/api/src/modules/auth/auth-local.service';
import {
IResponse,
IRequestGithubCallback,
IMiniprogramCloudFnResult,
IRequest,
ICrudRequest,
} from '@leaa/api/src/interfaces';
import { Permissions } from '@leaa/api/src/decorators';
import { Controller, Post, Req, Body, HttpCode } from '@nestjs/common';
import { AuthService } from '@leaa/api/src/modules/auth/auth.service';
import { ICrudRequest } from '@leaa/api/src/interfaces';
import { AuthLoginInput } from '@leaa/common/src/dtos/auth';
import { CrudController, Crud, ParsedRequest, ParsedBody } from '@nestjsx/crud';
import { Company, Auth } from '@leaa/common/src/entrys';
import { CompanyService } from '@leaa/api/src/modules/company/company.service';
import { crudConfig } from '@leaa/api/src/configs';
import { JwtGuard, PermissionsGuard } from '@leaa/api/src/guards';

// @Crud({
// ...crudConfig,
// model: {
// type: Auth,
// },
// })
@Controller('/auth')
// export class UserController {
// export class UserController {
// @UseGuards(JwtGuard)
export class AuthController {
constructor(public authLocalService: AuthLocalService) {}
constructor(public authService: AuthService) {}

@HttpCode(200)
@Post('/login')
@Post('login')
async login(@Req() req: ICrudRequest, @Body() body: AuthLoginInput): Promise<any> {
return this.authLocalService.login(req, body);
return this.authService.login(req, body);
}

// //
// // wechat
// @Get('/wechat/verify')
// async wechatVerify(@Req() req: IRequest): Promise<any> {
// return this.authWechatService.verifySignature(req);
// }
//
// @HttpCode(200)
// @Post('/wechat/session')
// async wechatSession(@Req() req: IRequest, @Body() body: { code: string }): Promise<any> {
// return this.authWechatService.getMiniProgramSession(req, body);
// }
//
// @HttpCode(200)
// @Post('/wechat/decrypt-data')
// async wechatDecryptData(
// @Req() req: IRequest,
// @Body() body: { encryptedData: string; iv: string; sessionKey: string; platform: string },
// ): Promise<any> {
// return this.authWechatService.wechatDecryptData(req, body);
// }
//
// @Get('/wechat/login')
// async wechatLogin(@Req() req: IRequest, @Res() res: IResponse): Promise<any> {
// return this.authWechatService.wechatLogin(req, res);
// }
//
// @Get('/wechat/callback')
// async wechatCallback(@Req() req: IRequest, @Res() res: IResponse): Promise<any> {
// return this.authWechatService.wechatCallback(req, res);
// }
//
// //
// // miniprogram
// @HttpCode(200)
// @Post('/miniprogram/login')
// async miniprogramLogin(@Body() data: IMiniprogramCloudFnResult): Promise<any> {
// return this.authMiniprogramService.miniprogramLogin(data);
// }
//
// //
// // github
// @UseGuards(AuthGuard('github'))
// @Get('/github/login')
// async githubLogin() {}
//
// @UseGuards(AuthGuard('github'))
// @Get('/github/callback')
// async githubCallback(@Req() req: IRequestGithubCallback, @Res() res: IResponse): Promise<any> {
// return this.authGithubService.githubCallback(req, res);
// }
}

0 comments on commit 434b6a8

Please sign in to comment.