Skip to content

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
deveshsangwan committed Mar 24, 2024
1 parent 94b9338 commit 24d5878
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions app/ts_src/LiveMatches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ export class LiveMatches {
const MATCH_ID_LENGTH = 16;
const existingMatches: Record<string, MatchData> = {};
const newMatches: Record<string, MatchData> = {};

$('.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 {
Expand All @@ -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];
}
}
8 changes: 4 additions & 4 deletions app/ts_src/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dotenv.config();
interface ClientCredentials {
clientId: string;
clientSecret: string;
}
}

export class Token {
private secret: string;
Expand All @@ -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 {
Expand Down

0 comments on commit 24d5878

Please sign in to comment.