Skip to content

Commit ab4c795

Browse files
Merge pull request #1334 from Real-Dev-Squad/develop
dev to main sync merged on 28 Jul 2023 21:34 IST
2 parents 027db02 + b93a4a6 commit ab4c795

File tree

23 files changed

+1365
-835
lines changed

23 files changed

+1365
-835
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ module.exports = {
3030
// Prettier for formatting
3131
"prettier/prettier": "error",
3232
},
33-
ignorePatterns: ["public/*"],
33+
ignorePatterns: ["public/*", "dist/*"],
3434
};

.github/workflows/codeql.yml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ "develop", main ]
16+
branches: ["develop", main]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ "develop" ]
19+
branches: ["develop"]
2020
schedule:
21-
- cron: '15 19 * * 5'
21+
- cron: "15 19 * * 5"
2222

2323
jobs:
2424
analyze:
@@ -32,43 +32,42 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: [ 'javascript' ]
35+
language: ["javascript"]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3838

3939
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v3
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
4242

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
52-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53-
# queries: security-extended,security-and-quality
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
5451

55-
56-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
57-
# If this step fails, then you should remove it and run the build manually (see below)
58-
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v2
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
6054

61-
# ℹ️ Command-line programs to run using the OS shell.
62-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
55+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
56+
# If this step fails, then you should remove it and run the build manually (see below)
57+
- name: Autobuild
58+
uses: github/codeql-action/autobuild@v2
6359

64-
# If the Autobuild fails above, remove it and uncomment the following three lines.
65-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6662

67-
# - run: |
68-
# echo "Run, Build Application using script"
69-
# ./location_of_script_within_repo/buildscript.sh
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
7065

71-
- name: Perform CodeQL Analysis
72-
uses: github/codeql-action/analyze@v2
73-
with:
74-
category: "/language:${{matrix.language}}"
66+
# - run: |
67+
# echo "Run, Build Application using script"
68+
# ./location_of_script_within_repo/buildscript.sh
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v2
72+
with:
73+
category: "/language:${{matrix.language}}"

.github/workflows/test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
node-version: [18.x]
1919

2020
steps:
21-
- uses: actions/checkout@v3
22-
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v3
24-
with:
25-
node-version: ${{ matrix.node-version }}
26-
- run: yarn
27-
- run: yarn test
21+
- uses: actions/checkout@v3
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: yarn
27+
- run: yarn test

.mocharc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
* Info: https://mochajs.org/#configuring-mocha-nodejs
44
*/
55
module.exports = {
6-
timeout: '5000',
6+
timeout: "5000",
7+
extension: ["ts", "js"],
8+
require: "ts-node/register",
79
};

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Real Dev Squad API Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
<!--
@@ -11,12 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1112
<!-- Sample changelog
1213
## [Project Version] - YYYY-MM-DD
1314
14-
### Added
15+
### Added
1516
- Feature name added
1617
1718
### Changed
18-
### Deprecated
19+
### Deprecated
1920
### Removed
20-
### Fixed
21+
### Fixed
2122
### Security
2223
-->

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ yarn validate-setup
5454

5555
Head over to [TDD Tests Files List](scripts/tests/tdd-files-list.txt), and add the list of your new (or old) test files.
5656

57-
> You can use wildcard '*' in the filepaths
57+
> You can use wildcard '\*' in the filepaths
5858
5959
Run TDD in watch mode. Exiting this command will print the coverage report. Try to achieve 100% coverage.
6060

controllers/tasks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ const updateTaskStatus = async (req, res, next) => {
341341
}
342342
}
343343

344-
if (isUserStatusEnabled && req.body.status === TASK_STATUS.COMPLETED && req.body.percentCompleted === 100) {
344+
if (isUserStatusEnabled && req.body.status) {
345345
userStatusUpdate = await updateStatusOnTaskCompletion(userId);
346346
}
347347
return res.json({

docs/backendFlow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ Tests are written using:
242242
- `scripts` : For different scripts needed for development & others
243243
- `Dependencies` : Modules needed for the project to work/ be functional
244244
- `devDependencies` : Dependencies only needed for the devlopment purpose
245-
245+
246246
<br>
247247

248248
---

models/userStatus.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -331,22 +331,22 @@ const batchUpdateUsersStatus = async (users) => {
331331
const currentTimeStamp = new Date().getTime();
332332
const batch = firestore.batch();
333333
const summary = {
334-
totalUsers: users.length,
335-
totalUnprocessedUsers: 0,
336-
totalOnboardingUsersAltered: 0,
337-
totalOnboardingUsersUnAltered: 0,
338-
totalActiveUsersAltered: 0,
339-
totalActiveUsersUnAltered: 0,
340-
totalIdleUsersAltered: 0,
341-
totalIdleUsersUnAltered: 0,
334+
usersCount: users.length,
335+
unprocessedUsers: 0,
336+
onboardingUsersAltered: 0,
337+
onboardingUsersUnaltered: 0,
338+
activeUsersAltered: 0,
339+
activeUsersUnaltered: 0,
340+
idleUsersAltered: 0,
341+
idleUsersUnaltered: 0,
342342
};
343343

344344
for (const { userId, state } of users) {
345345
let latestStatusData;
346346
try {
347347
latestStatusData = await getUserStatus(userId);
348348
} catch (error) {
349-
summary.totalUnprocessedUsers++;
349+
summary.unprocessedUsers++;
350350
continue;
351351
}
352352
const { id, userStatusExists, data } = latestStatusData;
@@ -364,14 +364,14 @@ const batchUpdateUsersStatus = async (users) => {
364364
userId,
365365
currentStatus: statusToUpdate,
366366
};
367-
state === userState.ACTIVE ? summary.totalActiveUsersAltered++ : summary.totalIdleUsersAltered++;
367+
state === userState.ACTIVE ? summary.activeUsersAltered++ : summary.idleUsersAltered++;
368368
batch.set(newUserStatusRef, newUserStatusData);
369369
} else {
370370
const {
371371
currentStatus: { state: currentState, until },
372372
} = data;
373373
if (currentState === state) {
374-
currentState === userState.ACTIVE ? summary.totalActiveUsersUnAltered++ : summary.totalIdleUsersUnAltered++;
374+
currentState === userState.ACTIVE ? summary.activeUsersUnaltered++ : summary.idleUsersUnaltered++;
375375
continue;
376376
}
377377
if (currentState === userState.ONBOARDING) {
@@ -380,13 +380,13 @@ const batchUpdateUsersStatus = async (users) => {
380380
const updatedStatusData = {
381381
currentStatus: statusToUpdate,
382382
};
383-
summary.totalOnboardingUsersAltered++;
383+
summary.onboardingUsersAltered++;
384384
batch.update(docRef, updatedStatusData);
385385
} else {
386-
summary.totalOnboardingUsersUnAltered++;
386+
summary.onboardingUsersUnaltered++;
387387
}
388388
} else {
389-
state === userState.ACTIVE ? summary.totalActiveUsersAltered++ : summary.totalIdleUsersAltered++;
389+
state === userState.ACTIVE ? summary.activeUsersAltered++ : summary.idleUsersAltered++;
390390
const docRef = userStatusModel.doc(id);
391391
const updatedStatusData =
392392
currentState === userState.OOO

nyc.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module.exports = {
66
all: true,
77
"check-coverage": false, // Will be enabled after reaching 50% coverage: https://github.com/Real-Dev-Squad/website-backend/issues/493
8-
exclude: ["test/**", "mockdata/**", "docs/**", "public/**"],
8+
exclude: ["test/**", "mockdata/**", "docs/**", "public/**", "dist/**"],
99
reporter: ["text", "lcov", "text-summary"],
1010
reportDir: ".coverage",
1111
tempDir: ".coverage",

0 commit comments

Comments
 (0)