-
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
1 parent
918ac62
commit acd978c
Showing
180 changed files
with
11,590 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,40 @@ | ||
name: Deploy to AWS Lambda | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Package Lambda function | ||
run: zip -r lambda.zip . | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
- name: Deploy to Lambda tikkle_dev | ||
if: github.ref == 'refs/heads/develop' | ||
run: | | ||
aws lambda update-function-code --function-name tikkle_dev --zip-file fileb://lambda.zip | ||
- name: Deploy to Lambda tikkle | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
aws lambda update-function-code --function-name tikkle --zip-file fileb://lambda.zip |
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,8 @@ | ||
/README.TOOLKIT.md | ||
/reqs/ | ||
/.aws-sam/ | ||
/.vscode/ | ||
/samconfig.toml | ||
/template.yaml | ||
/.DS_Store | ||
tikkle-c9666-firebase-adminsdk-knplx-fcb6d4f595.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 @@ | ||
tests/* |
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 @@ | ||
{ | ||
"printWidth": 200 | ||
} |
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,31 @@ | ||
const { ActionFunnelLogManager } = require("./features/ActionFunnelLogManager"); | ||
const { DBManager } = require("./db"); | ||
exports.actionFunnelLogger = async (req, res, next) => { | ||
const db = new DBManager(); | ||
await db.openTransaction(); | ||
try { | ||
const user_id = req.id; | ||
|
||
const funnel_log_manager = await ActionFunnelLogManager.createActionFunnelLogManager({ user_id, db }); | ||
|
||
// console.error(req.path); | ||
// console.error(req.method); | ||
// console.error(req.route); | ||
if (req.route == "/post_product_list") { | ||
if (req.body.search == null || req.body.search == undefined || req.body.search == "") { | ||
await funnel_log_manager.logControllInterface(req.route); | ||
} else { | ||
await funnel_log_manager.logControllInterface("/post_product_search"); | ||
} | ||
} else { | ||
await funnel_log_manager.logControllInterface(req.route); | ||
} | ||
await db.commitTransaction(); | ||
} catch (error) { | ||
await db.rollbackTransaction(); | ||
//return invalid when token is invalid | ||
console.error(`🚨 error -> ⚡️ actionFunnelLogger : 🐞${error}`); | ||
} | ||
|
||
next(); | ||
}; |
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,49 @@ | ||
const { checkToken } = require("token.js"); | ||
|
||
exports.authtoken = async (req, res, next) => { | ||
const headers = req.headers; | ||
const authorization = headers.authorization; | ||
const [accessToken, refreshToken] = authorization.split(","); | ||
|
||
//-------- check token & get user id --------------------------------------------------------------------------------------// | ||
|
||
let tokenCheck; | ||
let returnBody; | ||
let id; | ||
|
||
try { | ||
tokenCheck = await checkToken(accessToken, refreshToken); | ||
returnBody = JSON.parse(tokenCheck.body); | ||
id = returnBody.tokenData.id; | ||
} catch (error) { | ||
//return invalid when token is invalid | ||
console.log("authtoken 에서 에러가 발생했습니다."); | ||
const return_body = { | ||
success: false, | ||
detail_code: "99", | ||
message: "login again", | ||
returnToken: null, | ||
}; | ||
return res.status(401).send(return_body); | ||
} | ||
|
||
//return invalid when token is invalid | ||
if (tokenCheck.statusCode !== 200) { | ||
console.log("authtoken 에서 에러가 발생했습니다."); | ||
const return_body = { | ||
success: false, | ||
detail_code: "99", | ||
message: "login again", | ||
returnToken: null, | ||
}; | ||
return res.status(401).send(return_body); | ||
} | ||
|
||
const returnToken = returnBody.accessToken; | ||
|
||
//-------- sucess result --------------------------------------------------------------------------------------// | ||
|
||
req.id = id; | ||
req.returnToken = returnToken; | ||
next(); | ||
}; |
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,86 @@ | ||
const mysql = require("mysql2/promise"); | ||
const { getDatabaseCredentials } = require("db.js"); | ||
|
||
class DBManager { | ||
/** | ||
* @description 트랜잭션을 열고, connection을 반환한다. | ||
* @returns {Promise<Connection>} | ||
* @memberof DBManager | ||
* @example | ||
* const db = new DBManager(); | ||
* await db.openTransaction(); | ||
* try { | ||
* const result = await db.executeQuery(sql, params); | ||
* await db.commitTransaction(); | ||
* } | ||
* catch(err) { | ||
* await db.rollbackTransaction(); | ||
* } | ||
*/ | ||
async openTransaction() { | ||
const credentials = await getDatabaseCredentials(); | ||
console.log(credentials); | ||
this.connection = await mysql.createConnection(credentials); | ||
await this.connection.beginTransaction(); | ||
} | ||
/** | ||
* @description 쿼리를 실행한다. | ||
* @returns {Promise<Connection>} | ||
* @memberof DBManager | ||
* @example | ||
* const db = new DBManager(); | ||
* await db.openTransaction(); | ||
* try { | ||
* const result = await db.executeQuery(sql, params); | ||
* await db.commitTransaction(); | ||
* } | ||
* catch(err) { | ||
* await db.rollbackTransaction(); | ||
* } | ||
*/ | ||
async executeQuery(sql, params) { | ||
const [rows] = await this.connection.execute(sql, params); | ||
return rows; | ||
} | ||
/** | ||
* @description 트랜잭션을 커밋하고, connection을 종료한다. | ||
* @returns {Promise<Connection>} | ||
* @memberof DBManager | ||
* @example | ||
* const db = new DBManager(); | ||
* await db.openTransaction(); | ||
* try { | ||
* const result = await db.executeQuery(sql, params); | ||
* await db.commitTransaction(); | ||
* } | ||
* catch(err) { | ||
* await db.rollbackTransaction(); | ||
* } | ||
*/ | ||
async commitTransaction() { | ||
console.log("commit"); | ||
await this.connection.commit(); | ||
await this.connection.end(); | ||
} | ||
/** | ||
* @description 트랜잭션을 롤백하고, connection을 종료한다. | ||
* @returns {Promise<Connection>} | ||
* @memberof DBManager | ||
* @example | ||
* const db = new DBManager(); | ||
* await db.openTransaction(); | ||
* try { | ||
* const result = await db.executeQuery(sql, params); | ||
* await db.commitTransaction(); | ||
* } | ||
* catch(err) { | ||
* await db.rollbackTransaction(); | ||
* } | ||
*/ | ||
async rollbackTransaction() { | ||
await this.connection.rollback(); | ||
await this.connection.end(); | ||
} | ||
} | ||
|
||
module.exports = { DBManager }; |
Binary file not shown.
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,12 @@ | ||
{ | ||
"resource": "/apple_login_test", | ||
"path": "/apple_login_test", | ||
"httpMethod": "POST", | ||
"headers": { | ||
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjcsImlhdCI6MTcwMzczMjc5MywiZXhwIjo5MDAwMDAwMDAxNzAzNzMzMDAwLCJpc3MiOiJMaUZvbGkifQ.XKvRcbkWP9a4J-lfDvcZ6O01patJzvuS1n11d4VPtBQ,eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjcsImlhdCI6MTcwMzczMjc5MywiZXhwIjoxNzA2MzI0NzkzLCJpc3MiOiJMaUZvbGkifQ.6Pox2D4qm0ABi_w2AjY8hbkbIDODR8arDi7p9pNs12g" | ||
}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"productId": 7 | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/get_auth_checkToken", | ||
"path": "/get_auth_checkToken", | ||
"httpMethod": "GET", | ||
"headers": { | ||
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjcsImlhdCI6MTcwMzczMjc5MywiZXhwIjo5MDAwMDAwMDAxNzAzNzMzMDAwLCJpc3MiOiJMaUZvbGkifQ.XKvRcbkWP9a4J-lfDvcZ6O01patJzvuS1n11d4VPtBQ,eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjcsImlhdCI6MTcwMzczMjc5MywiZXhwIjoxNzA2MzI0NzkzLCJpc3MiOiJMaUZvbGkifQ.6Pox2D4qm0ABi_w2AjY8hbkbIDODR8arDi7p9pNs12g" | ||
}, | ||
"queryStringParameters": null, | ||
"body": {} | ||
} |
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,8 @@ | ||
{ | ||
"resource": "/get_auth_event", | ||
"path": "/get_auth_event", | ||
"httpMethod": "GET", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": {} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_version", | ||
"path": "/post_auth_version", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"os": "ios", | ||
"version": "1.0.12" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_IdDuplicationCheck", | ||
"path": "/post_auth_IdDuplicationCheck", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"inputId": "sup1214" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_IdDuplicationCheck", | ||
"path": "/post_auth_IdDuplicationCheck", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"inputId": "supasdfasdfsadfsadfsadfsadfsdfasdfsdfsadfasdfsadfarevrbveargaenlbjrelvjnrvjeaborunevjsevnaskjevbaeosijvnsaoevnsejvn1214" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_IdDuplicationCheck", | ||
"path": "/post_auth_IdDuplicationCheck", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"inputId": "su" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_appleLogin", | ||
"path": "/post_auth_appleLogin", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"apple_id": "000724.0c2036c2d27b4f239826ac8af3fb9de0.0402" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_appleRegister", | ||
"path": "/post_auth_appleRegister", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"apple_id": "000724.0c2036c2d27b4f239826ac8af3fb9de0.0402", | ||
"phone": "01041286666" | ||
} | ||
} |
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,16 @@ | ||
{ | ||
"resource": "/post_auth_loginKakao", | ||
"path": "/post_auth_loginKakao", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"name": "12eff", | ||
"birthday": "2007-08-22", | ||
"phone": "01044444444", | ||
"gender": "male", | ||
"source_tikkling_id": "34", | ||
"kakao_email": "Ddddd@dddd", | ||
"kakao_image": "https://asdasdasdasd" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_phoneCheck", | ||
"path": "/post_auth_phoneCheck", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"phone": "01011111111" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_phoneCheck", | ||
"path": "/post_auth_phoneCheck", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"phone": "01012347778" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_phoneCheck", | ||
"path": "/post_auth_phoneCheck", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"phone": "010-1234-7778" | ||
} | ||
} |
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 @@ | ||
{ | ||
"resource": "/post_auth_registerUser", | ||
"path": "/post_auth_registerUser", | ||
"httpMethod": "POST", | ||
"headers": {}, | ||
"queryStringParameters": null, | ||
"body": { | ||
"name": "12e", | ||
"birthday": "2007-08-22", | ||
"nick": "12111", | ||
"phone": "01053783522", | ||
"gender": "male", | ||
"source_tikkling_id": "293" | ||
} | ||
} |
Oops, something went wrong.