Skip to content

Commit

Permalink
feat: 일부 기능 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
zerosial committed Jan 15, 2024
1 parent 4b2c288 commit 4ef6000
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 2 deletions.
42 changes: 42 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@nestjs/jwt": "10.1.0",
"@nestjs/passport": "10.0.0",
"@nestjs/platform-express": "10.1.0",
"@nestjs/serve-static": "^4.0.0",
"@nestjs/swagger": "7.1.2",
"@prisma/client": "^5.0.0",
"bcrypt": "5.1.0",
Expand All @@ -85,6 +86,7 @@
"@types/chance": "1.1.3",
"@types/express": "4.17.17",
"@types/jest": "^29.5.3",
"@types/multer": "^1.4.11",
"@types/node": "^20.3.1",
"@types/supertest": "2.0.12",
"@typescript-eslint/eslint-plugin": "^5.59.11",
Expand Down
1 change: 0 additions & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { AuthModule } from './auth/auth.module';
import { UsersModule } from './users/users.module';
import { PostsModule } from './posts/posts.module';
import config from './common/configs/config';

@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true, load: [config] }),
Expand Down
16 changes: 16 additions & 0 deletions src/common/configs/multerConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { diskStorage } from 'multer';
import { extname } from 'path';

// multer 설정
export const multerConfig = {
storage: diskStorage({
destination: './uploads', // 저장 위치
filename: (req, file, cb) => {
const randomName = Array(32)
.fill(null)
.map(() => Math.round(Math.random() * 16).toString(16))
.join('');
cb(null, `${randomName}${extname(file.originalname)}`); // 파일명
},
}),
};
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async function bootstrap() {
.build();
const document = SwaggerModule.createDocument(app, options);

// vercel 배포 시 스웨거 css 강제 인풋설정
SwaggerModule.setup(swaggerConfig.path || 'api', app, document, {
customSiteTitle: 'Pinemarket API',
customfavIcon:
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default async () => {
["./users/dto/response-user-dto"]: await import("./users/dto/response-user-dto"),
["./users/models/user.model"]: await import("./users/models/user.model")
};
return { "@nestjs/swagger/plugin": { "models": [[import("./posts/dto/pagenation-query.dto"), { "PaginationQueryDto": { page: { required: false, type: () => Number, default: 1, minimum: 1 }, limit: { required: false, type: () => Number, default: 10, minimum: 1 }, query: { required: false, type: () => String }, orderBy: { required: false, type: () => String }, direction: { required: false, type: () => Object, default: "asc" } } }]], "controllers": [[import("./app.controller"), { "AppController": { "getHello": { type: String }, "getHelloName": { type: String } } }], [import("./auth/auth.controller"), { "AuthController": { "signup": {}, "login": {}, "refreshToken": { type: t["./auth/models/token.model"].Token }, "getUser": { type: Object } } }], [import("./users/users.controller"), { "UserController": { "getProfile": { type: t["./users/dto/response-user-dto"].UserResponseDto }, "updateUser": { type: Object }, "changePassword": { type: Object } } }], [import("./posts/posts.controller"), { "PostsController": { "createPost": { type: Object }, "getPublishedPosts": {}, "getUserPosts": { type: [Object] }, "getPost": { type: Object } } }]] }, "@nestjs/graphql/plugin": { "models": [[import("./auth/dto/signup.input"), { "SignupInput": { email: {}, password: {}, firstname: { nullable: true }, lastname: { nullable: true } } }], [import("./auth/models/token.model"), { "Token": { accessToken: {}, refreshToken: {} } }], [import("./common/models/base.model"), { "BaseModel": { id: {}, createdAt: {}, updatedAt: {} } }], [import("./posts/models/post.model"), { "Post": { title: {}, content: { nullable: true }, published: {}, author: { nullable: true } } }], [import("./users/models/user.model"), { "User": { email: {}, firstname: { nullable: true }, lastname: { nullable: true }, role: {}, posts: { nullable: true } } }], [import("./auth/models/auth.model"), { "Auth": { user: { type: () => t["./users/models/user.model"].User } } }], [import("./auth/dto/login.input"), { "LoginInput": { email: {}, password: {} } }], [import("./auth/dto/refresh-token.input"), { "RefreshTokenInput": { token: {} } }], [import("./users/dto/change-password.input"), { "ChangePasswordInput": { oldPassword: {}, newPassword: {} } }], [import("./users/dto/update-user.input"), { "UpdateUserInput": { firstname: { nullable: true }, lastname: { nullable: true } } }], [import("./posts/dto/createPost.input"), { "CreatePostInput": { content: {}, title: {} } }], [import("./common/pagination/pagination.args"), { "PaginationArgs": { skip: { nullable: true, type: () => Number }, after: { nullable: true, type: () => String }, before: { nullable: true, type: () => String }, first: { nullable: true, type: () => Number }, last: { nullable: true, type: () => Number } } }], [import("./posts/args/post-id.args"), { "PostIdArgs": { postId: { type: () => String } } }], [import("./posts/args/user-id.args"), { "UserIdArgs": { userId: { type: () => String } } }], [import("./common/pagination/page-info.model"), { "PageInfo": { endCursor: { nullable: true }, hasNextPage: {}, hasPreviousPage: {}, startCursor: { nullable: true } } }], [import("./posts/models/post-connection.model"), { "PostConnection": {} }], [import("./posts/dto/post-order.input"), { "PostOrder": { field: {} } }]] } };
return { "@nestjs/swagger/plugin": { "models": [[import("./posts/dto/pagenation-query.dto"), { "PaginationQueryDto": { page: { required: false, type: () => Number, default: 1, minimum: 1 }, limit: { required: false, type: () => Number, default: 10, minimum: 1 }, query: { required: false, type: () => String }, orderBy: { required: false, type: () => String }, direction: { required: false, type: () => Object, default: "asc" } } }]], "controllers": [[import("./app.controller"), { "AppController": { "getHello": { type: String }, "getHelloName": { type: String } } }], [import("./auth/auth.controller"), { "AuthController": { "signup": {}, "login": {}, "refreshToken": { type: t["./auth/models/token.model"].Token }, "getUser": { type: Object } } }], [import("./users/users.controller"), { "UserController": { "getProfile": { type: t["./users/dto/response-user-dto"].UserResponseDto }, "updateUser": { type: Object }, "changePassword": { type: Object } } }], [import("./posts/posts.controller"), { "PostsController": { "createPost": { type: Object }, "getPublishedPosts": {}, "getUserPosts": { type: [Object] }, "getPost": { type: Object } } }]] }, "@nestjs/graphql/plugin": { "models": [[import("./auth/dto/signup.input"), { "SignupInput": { email: {}, password: {}, firstname: { nullable: true }, lastname: { nullable: true } } }], [import("./auth/models/token.model"), { "Token": { accessToken: {}, refreshToken: {} } }], [import("./common/models/base.model"), { "BaseModel": { id: {}, createdAt: {}, updatedAt: {} } }], [import("./posts/models/post.model"), { "Post": { title: {}, content: { nullable: true }, published: {}, imgUrl: { nullable: true }, author: { nullable: true } } }], [import("./users/models/user.model"), { "User": { email: {}, username: { nullable: true }, role: {}, posts: { nullable: true } } }], [import("./auth/models/auth.model"), { "Auth": { user: { type: () => t["./users/models/user.model"].User } } }], [import("./auth/dto/login.input"), { "LoginInput": { email: {}, password: {} } }], [import("./auth/dto/refresh-token.input"), { "RefreshTokenInput": { token: {} } }], [import("./users/dto/change-password.input"), { "ChangePasswordInput": { oldPassword: {}, newPassword: {} } }], [import("./users/dto/update-user.input"), { "UpdateUserInput": { username: { nullable: true } } }], [import("./posts/dto/createPost.input"), { "CreatePostInput": { content: {}, title: {}, imgUrl: {} } }], [import("./common/pagination/pagination.args"), { "PaginationArgs": { skip: { nullable: true, type: () => Number }, after: { nullable: true, type: () => String }, before: { nullable: true, type: () => String }, first: { nullable: true, type: () => Number }, last: { nullable: true, type: () => Number } } }], [import("./posts/args/post-id.args"), { "PostIdArgs": { postId: { type: () => String } } }], [import("./posts/args/user-id.args"), { "UserIdArgs": { userId: { type: () => String } } }], [import("./common/pagination/page-info.model"), { "PageInfo": { endCursor: { nullable: true }, hasNextPage: {}, hasPreviousPage: {}, startCursor: { nullable: true } } }], [import("./posts/models/post-connection.model"), { "PostConnection": {} }], [import("./posts/dto/post-order.input"), { "PostOrder": { field: {} } }]] } };
};

0 comments on commit 4ef6000

Please sign in to comment.