-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from boostcamp-2020/develop
3주차 배포
- Loading branch information
Showing
223 changed files
with
10,076 additions
and
1,795 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 |
---|---|---|
|
@@ -5,6 +5,7 @@ node_modules | |
|
||
# testing | ||
coverage | ||
storybook-static | ||
|
||
# production | ||
build | ||
|
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,4 @@ | ||
{ | ||
"presets": ["@babel/preset-typescript", "@babel/preset-env"] | ||
} | ||
|
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,11 @@ | ||
module.exports = { | ||
roots: ['<rootDir>/src'], | ||
testMatch: [ | ||
'**/__tests__/**/*.+(ts|tsx|js)', | ||
'**/?(*.)+(spec|test).+(ts|tsx|js)', | ||
], | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
testEnvironment: 'node', | ||
}; |
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,6 @@ | ||
export default { | ||
github: 'https://github.com/login/oauth/authorize?', | ||
gitCallback: '/login/oauth-callback', | ||
gitAccessToken: 'https://github.com/login/oauth/access_token', | ||
gitUser: 'https://api.github.com/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 |
---|---|---|
@@ -1,19 +1,29 @@ | ||
import Koa from 'koa'; | ||
import bodyParser from 'koa-bodyparser'; | ||
import routers from 'routers'; | ||
import cors from '@koa/cors'; | ||
import { connect as dbConnect } from './models'; | ||
import { connect as dbConnect } from 'models/database'; | ||
import { hostConfig } from 'config'; | ||
import Router from './routers'; | ||
import { corsOptions } from './config'; | ||
|
||
const app = new Koa(); | ||
|
||
dbConnect(); | ||
app.use(async (ctx, next) => { | ||
try { | ||
await next(); | ||
} catch (err) { | ||
err.status = err.status || 500; | ||
ctx.body = err.message; | ||
ctx.status = err.status; | ||
} | ||
}); | ||
app.use(cors(corsOptions)); | ||
|
||
app.use(bodyParser()); | ||
app.use(cors()); | ||
app.use(routers.routes()); | ||
app.use((ctx: Koa.Context) => { | ||
ctx.body = 'hello, Koa!'; | ||
}); | ||
app.use(Router.routes()); | ||
app.use(Router.allowedMethods()); | ||
|
||
app.listen(4000, () => { | ||
console.log('Listening to port 4000'); | ||
app.listen(hostConfig.backPort, () => { | ||
console.log(`Listening to port ${hostConfig.backPort}`); | ||
}); |
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,10 @@ | ||
import Koa from 'koa'; | ||
import * as accountService from 'services/account'; | ||
|
||
export const get = async (ctx: Koa.Context) => { | ||
const res = await accountService.getAccounts(); | ||
ctx.status = 200; | ||
ctx.response.body = res; | ||
}; | ||
|
||
export default { get }; |
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 Koa from 'koa'; | ||
import * as authService from 'services/auth'; | ||
import { getFrontUrl } from 'config'; | ||
|
||
export const githubAuthRequest = async (ctx: Koa.Context) => { | ||
const githubAuthUrl = await authService.getGithubURL(); | ||
ctx.status = 200; | ||
ctx.response.body = { githubAuthUrl }; | ||
}; | ||
|
||
export const getGithubAccessToken = async (ctx: Koa.Context) => { | ||
const { code } = ctx.query; | ||
const { token, user } = await authService.getGithubAccessToken(code); | ||
ctx.cookies.set('access_token', token, { | ||
httpOnly: true, | ||
maxAge: 1000 * 60 * 60 * 24, | ||
}); | ||
ctx.body = 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,38 @@ | ||
import { Context } from 'koa'; | ||
import { | ||
getCategories, | ||
postCategory, | ||
getCategoryStatistics, | ||
} from 'services/category'; | ||
|
||
const get = async (ctx: Context) => { | ||
const { accountObjId } = ctx.params; | ||
const categorisedType = await getCategories(accountObjId); | ||
ctx.status = 200; | ||
ctx.body = categorisedType; | ||
}; | ||
|
||
const getStatisticsInfo = async (ctx: Context) => { | ||
const { startDate, endDate } = ctx.query; | ||
const { accountObjId } = ctx.params; | ||
const statistics = await getCategoryStatistics( | ||
accountObjId, | ||
startDate, | ||
endDate, | ||
); | ||
ctx.body = statistics; | ||
}; | ||
|
||
const post = async (ctx: Context) => { | ||
const { type, title, color, accountObjId } = ctx.request.body; | ||
const res = await postCategory(type, title, color, accountObjId); | ||
if (res.success) { | ||
ctx.status = 200; | ||
ctx.body = res; | ||
} else { | ||
ctx.status = 401; | ||
ctx.body = res; | ||
} | ||
}; | ||
|
||
export default { getStatisticsInfo, get, post }; |
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 @@ | ||
import { Context } from 'koa'; | ||
import { getMethods } from 'services/method'; | ||
|
||
const get = async (ctx: Context) => { | ||
const { accountObjId } = ctx.params; | ||
const methods = await getMethods(accountObjId); | ||
ctx.status = 200; | ||
ctx.body = methods; | ||
}; | ||
|
||
export default { get }; |
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,11 @@ | ||
import Koa from 'koa'; | ||
import * as userService from 'services/user'; | ||
|
||
export const titleByAccountId = async (ctx: Koa.Context) => { | ||
const { accountId } = ctx.query; | ||
const title = await userService.titleByAccountId(accountId); | ||
ctx.status = 200; | ||
ctx.response.body = title; | ||
}; | ||
|
||
export default titleByAccountId; |
Oops, something went wrong.