-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
34 lines (29 loc) · 1.08 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { AllQuestionsCount } from './models-old/allQuestionsCount'
import { QuestionsResponse } from './models-old/response'
import { LeetProfileService } from './services/leetprofile.service'
import YAML from 'yamljs';
export function getSwaggerYaml(swaggerFilePath: string) {
return YAML.load(`${swaggerFilePath}/docs/swagger.yaml`)
}
export async function getLeetQuestionsCount(req: any, res: { send: (arg0: QuestionsResponse) => void }) {
let questionsResponse: QuestionsResponse
const questions: AllQuestionsCount = await LeetProfileService.getAllQuestionsCount()
if (questions == null) {
questionsResponse = {
isError: true,
error: {
errorCode: 404,
errorMessage: "No leetcode questions found!"
},
questions: null
}
res.send(questionsResponse)
} else {
questionsResponse = {
isError: false,
questions: questions.allQuestionsCount
}
res.send(questionsResponse)
}
}
export { User as UserRequests } from './requests/user'