-
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.
Merge pull request #4 from GRI-G/develop
update 1.0.4
- Loading branch information
Showing
11 changed files
with
374 additions
and
522 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 |
---|---|---|
@@ -1,74 +1,7 @@ | ||
"user strict"; | ||
|
||
export type eventType = { | ||
body: { [k: string]: string } | string; | ||
headers: { | ||
Host: string; | ||
Connection: string; | ||
"sec-ch-ua": string; | ||
"sec-ch-ua-mobile": string; | ||
"Upgrade-Insecure-Requests": string; | ||
"User-Agent": string; | ||
Accept: string; | ||
"Sec-Fetch-Site": string; | ||
"Sec-Fetch-Mode": string; | ||
"Sec-Fetch-Dest": string; | ||
"Accept-Encoding": string; | ||
"Accept-Language": string; | ||
}; | ||
httpMethod: string; | ||
isBase64Encoded: boolean; | ||
multiValueHeaders: { | ||
Host: Array<string>; | ||
Connection: Array<string>; | ||
"sec-ch-ua": Array<string>; | ||
"sec-ch-ua-mobile": Array<string>; | ||
"Upgrade-Insecure-Requests": Array<string>; | ||
"User-Agent": Array<string>; | ||
Accept: Array<string>; | ||
"Sec-Fetch-Site": Array<string>; | ||
"Sec-Fetch-Mode": Array<string>; | ||
"Sec-Fetch-Dest": Array<string>; | ||
"Accept-Encoding": Array<string>; | ||
"Accept-Language": Array<string>; | ||
}; | ||
multiValueQueryStringParameters: { [k: string]: string }; | ||
path: string; | ||
pathParameters: { [k: string]: string }; | ||
queryStringParameters: { [k: string]: string }; | ||
requestContext: { | ||
accountId: string; | ||
apiId: string; | ||
authorizer: { [k: string]: string }; | ||
domainName: string; | ||
domainPrefix: string; | ||
extendedRequestId: string; | ||
httpMethod: string; | ||
identity: { | ||
accessKey: null; | ||
accountId: string; | ||
apiKey: string; | ||
apiKeyId: string; | ||
caller: string; | ||
cognitoAuthenticationProvider: string; | ||
cognitoAuthenticationType: string; | ||
cognitoIdentityId: string; | ||
cognitoIdentityPoolId: string; | ||
principalOrgId: any; | ||
sourceIp: string; | ||
user: string; | ||
userAgent: string; | ||
userArn: string; | ||
}; | ||
path: string; | ||
protocol: string; | ||
requestId: string; | ||
requestTime: string; | ||
requestTimeEpoch: BigInt; | ||
resourceId: string; | ||
resourcePath: string; | ||
stage: string; | ||
}; | ||
resource: string; | ||
stageVariables: boolean; | ||
export type Response = { | ||
statusCode: number; | ||
body: string; | ||
headers: Object; | ||
}; |
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
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { UserModel } from "../model/users"; | ||
|
||
export const getKindOfGenaration: Function = async () => { | ||
return await UserModel.aggregate([ | ||
const a = await UserModel.aggregate([ | ||
{ $match: { generation: { $exists: true } } }, | ||
// count grouping status | ||
{ $group: { _id: "$generation", count: { $sum: 1 } } }, | ||
]); | ||
return a; | ||
}; |
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,17 @@ | ||
import * as mongoose from "mongoose"; | ||
|
||
export const connectMongoDB: Function = (next: (...args: any[]) => any) => { | ||
return async (...args: any[]) => { | ||
const db = await mongoose.connect(process.env.MongoDBUrl ?? "", { | ||
useFindAndModify: true, | ||
useNewUrlParser: true, | ||
useCreateIndex: true, | ||
useUnifiedTopology: true, | ||
}); | ||
const result = await next(...args); | ||
if (result) { | ||
db.disconnect(); | ||
} | ||
return result; | ||
}; | ||
}; |
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,18 +1,12 @@ | ||
import * as mongoose from "mongoose"; | ||
import { CodeModel } from "../src/model/code"; | ||
import { connectMongoDB } from "../src/util/db"; | ||
|
||
export const deleteRemainCode: Function = async (): Promise<void> => { | ||
const db = await mongoose.connect(process.env.MongoDBUrl ?? "", { | ||
useFindAndModify: true, | ||
useNewUrlParser: true, | ||
useCreateIndex: true, | ||
useUnifiedTopology: true, | ||
}); | ||
|
||
var dateTime = new Date(); | ||
dateTime.setMinutes(dateTime.getMinutes() - 5); | ||
await CodeModel.deleteMany({ createdAt: { $lte: dateTime } }); | ||
console.log("사용되지않는 코드들 제거 완료"); | ||
db.disconnect(); | ||
return; | ||
}; | ||
export const deleteRemainCode: Function = connectMongoDB( | ||
async (): Promise<void> => { | ||
var dateTime = new Date(); | ||
dateTime.setMinutes(dateTime.getMinutes() - 5); | ||
await CodeModel.deleteMany({ createdAt: { $lte: dateTime } }); | ||
console.log("사용되지않는 코드들 제거 완료"); | ||
return; | ||
}, | ||
); |
Oops, something went wrong.