diff --git a/README.md b/README.md index fafe77d..ac158af 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ Welcome to the Cricket Score API! This project is designed to provide real-time Our aim is to maintain high code coverage to ensure the quality of the project. Here are our current stats: [![codecov](https://codecov.io/gh/deveshsangwan/cricketScoreApi/graph/badge.svg?token=A3JMLLNTG4)](https://codecov.io/gh/deveshsangwan/cricketScoreApi) -![Functions](https://img.shields.io/badge/functions-96.07%25-brightgreen.svg?style=flat) -![Lines](https://img.shields.io/badge/lines-91.69%25-brightgreen.svg?style=flat) +![Functions](https://img.shields.io/badge/functions-92.98%25-brightgreen.svg?style=flat) +![Lines](https://img.shields.io/badge/lines-89.33%25-yellow.svg?style=flat) ## 🚀 Getting Started diff --git a/app/ts_src/LiveMatches/index.ts b/app/ts_src/LiveMatches/index.ts index c93e9b6..d95241d 100644 --- a/app/ts_src/LiveMatches/index.ts +++ b/app/ts_src/LiveMatches/index.ts @@ -70,14 +70,14 @@ export class LiveMatches { const MATCH_ID_LENGTH = 16; const existingMatches: Record = {}; const newMatches: Record = {}; - + $('.cb-col-100 .cb-col .cb-schdl').each((_, el) => { const matchUrl = $(el).find('.cb-lv-scr-mtch-hdr a').attr('href'); const matchName = $(el).find('.cb-billing-plans-text a').attr('title'); - + if (matchUrl && matchName) { const existingMatch = mongoData.find((item) => item.matchUrl === matchUrl); - + if (existingMatch) { existingMatches[existingMatch._id] = { matchUrl, matchName }; } else { @@ -86,11 +86,11 @@ export class LiveMatches { } } }); - + if (Object.keys(existingMatches).length === 0 && Object.keys(newMatches).length === 0) { throw new Error('No matches found'); } - + return [existingMatches, newMatches]; } } \ No newline at end of file diff --git a/app/ts_src/Token.ts b/app/ts_src/Token.ts index e5d0a2f..5b6f2e3 100644 --- a/app/ts_src/Token.ts +++ b/app/ts_src/Token.ts @@ -9,7 +9,7 @@ dotenv.config(); interface ClientCredentials { clientId: string; clientSecret: string; - } +} export class Token { private secret: string; @@ -28,16 +28,16 @@ export class Token { writeLogError([`${location} | error`, error]); throw new CustomError(error.message); } - + public generateToken(credentials: ClientCredentials): string | never { try { const { clientId, clientSecret } = credentials; - + if (clientId === this.clientId && clientSecret === this.clientSecret) { const payload = { clientId }; - + const token = jwt.sign(payload, this.secret, { algorithm: 'HS256', expiresIn: this.expiresIn }); return token; } else {