Skip to content

Commit

Permalink
[SWEP-78] 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaeunnn committed Feb 7, 2025
1 parent 70ab8f9 commit 9a462c3
Show file tree
Hide file tree
Showing 58 changed files with 1,815 additions and 682 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,4 @@ dist
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# json api 키 값
sweepicai-*.json

.pnp.*
6 changes: 6 additions & 0 deletions .idea/.gitignore

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

12 changes: 12 additions & 0 deletions .idea/dataSources.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

8 changes: 8 additions & 0 deletions .idea/sweepic-Server.iml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

2 changes: 1 addition & 1 deletion @types/environment.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace NodeJS {
interface ProcessEnv extends NodeJS.ProcessEnv {
export interface ProcessEnv extends NodeJS.ProcessEnv {
PORT: string;
DATABASE_URL: string;
EXPRESS_SESSION_SECRET: string;
Expand Down
2 changes: 1 addition & 1 deletion @types/express.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ declare global {
}): this;
}
}
}
}
15 changes: 13 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import tsParser from '@typescript-eslint/parser';

export default [
{
ignores: ['node_modules', 'dist', 'build', 'tsconfig.json'],
ignores: ['node_modules', 'scripts', 'tsconfig.json', 'eslint.config.js'],
},
{
files: ['**/*.ts', '**/*.js'],
Expand All @@ -12,7 +12,7 @@ export default [
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
//project: './tsconfig.json', // tsconfig.json 경로 추가
project: './tsconfig.json', // tsconfig.json 경로 추가
},
},
plugins: {
Expand All @@ -22,6 +22,17 @@ export default [
semi: ['error', 'always'],
quotes: ['error', 'single'],
'@typescript-eslint/no-namespace': 'off', // namespace 허용
'@typescript-eslint/no-explicit-any': 'warn', // 명시적 any 사용 경고
'no-unused-vars': 'error', // 사용하지 않는 변수는 에러
'no-console': 'warn', // console 사용 경고
'prefer-const': 'warn', // let 대신 const 사용 권장
'prefer-template': 'warn', // 문자열 연결 대신 템플릿 리터럴 사용 권장
'no-shadow': 'warn', // 외부 변수와 중복 변수 선언 경고
eqeqeq: ['error', 'always'], // == 대신 === 사용 권장
'no-duplicate-imports': 'error', // 중복 import 경고
'no-var': 'error', // var 사용 금지
'no-undef': 'error', // 선언되지 않은 변수 사용 금지
'no-const-assign': 'error', // const 재할당 금지
},
},
];
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"build": "tsx scripts/build.ts",
"start": "node dist/app.cjs",
"lint": "gts lint",
"clean": "gts clean",
"compile": "tsc",
"fix": "gts fix",
"prepare": "yarn run compile",
"pretest": "yarn run compile",
"posttest": "yarn run lint",
"swagger": "tsx swagger/swagger.ts",
"tsoa-swagger": "tsoa spec -c ./config/tsoa.json",
"tsoa-routes": "tsoa routes -c ./config/tsoa.json"
"tsoa-routes": "tsoa routes -c ./config/tsoa.json",
"clean": "gts clean"
},
"author": "",
"license": "ISC",
Expand Down Expand Up @@ -59,7 +59,7 @@
"@types/express-session": "^1.18.1",
"@types/multer": "^1.4.12",
"@types/multer-s3": "^3.0.3",
"@types/node": "^22.10.3",
"@types/node": "^22.7.5",
"@types/passport": "^1.0.17",
"@types/passport-google-oauth20": "^2.0.16",
"@types/passport-kakao": "^1.0.3",
Expand Down
31 changes: 17 additions & 14 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@ import express, {
NextFunction,
ErrorRequestHandler,
} from 'express';
import process from 'process';
import swaggerUiExpress from 'swagger-ui-express';
import {memoFolderRouter} from './routers/memo.router.js';
import {RegisterRoutes} from './routers/tsoaRoutes.js';
import {challengeRouter} from './routers/challenge.router.js';
import {authRouter} from './routers/auth.routers.js';
import {userRouter} from './routers/user.router.js';
import passport from 'passport';
import session from 'express-session';
import {PrismaSessionStore} from '@quixo3/prisma-session-store';
import {prisma} from './db.config.js';
import swaggerDocumentOne from '../swagger/openapi.json' assert {type: 'json'};
import swaggerDocumentTwo from '../swagger/swagger.json' assert {type: 'json'};
import {BaseError} from './errors.js';
import swaggerDocument from '../swagger/openapi.json' assert {type: 'json'};
import { sessionAuthMiddleware } from './auth.config.js';
import {sessionAuthMiddleware} from './auth.config.js';
import cookieParser from 'cookie-parser';
import {ValidateError} from 'tsoa';
import { labelDetectionController } from './controllers/tags-ai.controller.js';
import {labelDetectionController} from './controllers/tags-ai.controller.js';

// routers
import {memoFolderRouter} from './routers/memo.router.js';
import {RegisterRoutes} from './routers/tsoaRoutes.js';
import {challengeRouter} from './routers/challenge.router.js';
import {authRouter} from './routers/auth.routers.js';
import {userRouter} from './routers/user.router.js';
import {tagRouter} from './routers/tag.router.js';
import {myPageRouter} from './routers/mypage.routers.js';

dotenv.config();

Expand All @@ -34,7 +38,7 @@ const port = process.env.PORT;
app.use(cors());
app.use(express.static('public'));
app.use(express.json());
app.use(express.urlencoded({extended: false}));
app.use(express.urlencoded({extended: false}));
app.use(cookieParser());

// Swagger Docs
Expand Down Expand Up @@ -109,7 +113,10 @@ app.use(sessionAuthMiddleware);
app.use('/onboarding', userRouter);
app.use('/memo', memoFolderRouter);
app.use('/challenge', challengeRouter);
app.use('/user/mypage', myPageRouter);
app.use('/tag', tagRouter);
app.post('/image/ai', labelDetectionController);

RegisterRoutes(app);

app.get('/', (req: Request, res: Response) => {
Expand Down Expand Up @@ -146,8 +153,6 @@ const errorHandler: ErrorRequestHandler = (err, req, res, next) => {
success: null,
});
}

console.error('Unexpected error:', err);
res.status(500).json({
resultType: 'FAIL',
error: {
Expand All @@ -161,6 +166,4 @@ const errorHandler: ErrorRequestHandler = (err, req, res, next) => {

app.use(errorHandler);
// Start server
app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
});
app.listen(port, () => {});
Loading

0 comments on commit 9a462c3

Please sign in to comment.