Skip to content

Commit 308a53c

Browse files
committed
2 parents c189b1f + ba2d4f9 commit 308a53c

File tree

94 files changed

+1348
-1314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1348
-1314
lines changed

.deepsource.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ name = "javascript"
66
[analyzers.meta]
77
environment = ["nodejs"]
88

9-
[[analyzers]]
10-
name = "python"
11-
12-
[analyzers.meta]
13-
runtime_version = "3.x.x"
14-
159
[[analyzers]]
1610
name = "test-coverage"
1711

1812
[[analyzers]]
1913
name = "sql"
2014

2115
[[analyzers]]
22-
name = "secrets"
16+
name = "secrets"
17+
18+
[[transformers]]
19+
name = "prettier"
20+
21+
[[transformers]]
22+
name = "standardjs"

config/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
const PORT = process.env.PORT || 3000;
2-
export default PORT;
1+
const PORT = process.env.PORT || 3000
2+
export default PORT

config/cryptography.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const saltRounds = process.env.saltRounds || 5;
1+
const saltRounds = process.env.saltRounds || 5
22

3-
module.exports = saltRounds;
3+
module.exports = saltRounds

firebaseCP/authentication.js

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { auth, firebase } from "../config/firebase.js";
2-
import Firestore from "./firestore.js";
1+
import { auth, firebase } from '../config/firebase.js'
2+
import Firestore from './firestore.js'
33

44
/**
55
* Class representing authentication functionalities.
@@ -10,32 +10,34 @@ export class Authentication {
1010
* @param {object} userData - The user data to create the user.
1111
* @returns {Promise<[boolean, string]>} - A tuple indicating success status and the user ID.
1212
*/
13-
async createUser(userData) {
13+
async createUser (userData) {
1414
try {
15-
const userRecord = await auth.createUser(userData);
16-
return [true, userRecord.uid];
15+
const userRecord = await auth.createUser(userData)
16+
return [true, userRecord.uid]
1717
// return userRecord.uid;
1818
} catch (error) {
19-
return [false, error.message];
19+
return [false, error.message]
2020
}
2121
}
22-
verificationEmail(email) {
23-
return auth.generateEmailVerificationLink(email);
22+
23+
verificationEmail (email) {
24+
return auth.generateEmailVerificationLink(email)
2425
}
26+
2527
/**
2628
* Logs in the user with the provided email and password.
2729
* @param {string} email - The user's email.
2830
* @param {string} password - The user's password.
2931
* @returns {Promise<[boolean, string]>} - A tuple indicating success status and the user ID.
3032
*/
31-
async loginUser(email, password) {
33+
async loginUser (email, password) {
3234
try {
3335
const userRecord = await firebase
3436
.auth()
35-
.signInWithEmailAndPassword(email, password);
36-
return [true, userRecord.user.uid];
37+
.signInWithEmailAndPassword(email, password)
38+
return [true, userRecord.user.uid]
3739
} catch (error) {
38-
return [false, error.message];
40+
return [false, error.message]
3941
}
4042
}
4143

@@ -45,12 +47,12 @@ export class Authentication {
4547
* @param {object} updateUserData - The data to update the user with.
4648
* @returns {Promise<[boolean, object]>} - A tuple indicating success status and the updated user data.
4749
*/
48-
async updateUser(uid, updateUserData) {
50+
async updateUser (uid, updateUserData) {
4951
try {
50-
const userRecord = await auth.updateUser(uid, updateUserData);
51-
return [true, userRecord.toJSON()];
52+
const userRecord = await auth.updateUser(uid, updateUserData)
53+
return [true, userRecord.toJSON()]
5254
} catch (error) {
53-
return [false, error.message];
55+
return [false, error.message]
5456
}
5557
}
5658

@@ -59,12 +61,12 @@ export class Authentication {
5961
* @param {string} uid - The user ID to retrieve.
6062
* @returns {Promise<[boolean, object]>} - A tuple indicating success status and the retrieved user data.
6163
*/
62-
async getUser(uid) {
64+
async getUser (uid) {
6365
try {
64-
const user = await auth.getUser(uid);
65-
return [true, user];
66+
const user = await auth.getUser(uid)
67+
return [true, user]
6668
} catch (error) {
67-
return [false, error.message];
69+
return [false, error.message]
6870
}
6971
}
7072

@@ -73,50 +75,50 @@ export class Authentication {
7375
* @param {string} uid - The user ID to delete.
7476
* @returns {Promise<[boolean, string]>} - A tuple indicating success status and the deleted user ID.
7577
*/
76-
async deleteUser(uid) {
78+
async deleteUser (uid) {
7779
try {
78-
await auth.deleteUser(uid);
79-
return [true, uid];
80+
await auth.deleteUser(uid)
81+
return [true, uid]
8082
} catch (error) {
81-
return [false, error.message];
83+
return [false, error.message]
8284
}
8385
}
8486

85-
async createPhoneVerification(phoneNumber) {
87+
async createPhoneVerification (phoneNumber) {
8688
const request = await auth.createSessionCookie(phoneNumber, {
87-
expiresIn: 3600,
88-
});
89-
return request;
89+
expiresIn: 3600
90+
})
91+
return request
9092
}
9193

92-
async verityPhoneVerification(verificationId, otp) {
93-
const userCreds = await auth.verifySessionCookie(verificationId, otp);
94-
return userCreds;
94+
async verityPhoneVerification (verificationId, otp) {
95+
const userCreds = await auth.verifySessionCookie(verificationId, otp)
96+
return userCreds
9597
}
9698

97-
async resetPassword(email) {
98-
const request = await auth.sendPasswordResetEmail(email);
99-
return request;
99+
async resetPassword (email) {
100+
const request = await auth.sendPasswordResetEmail(email)
101+
return request
100102
}
101103

102-
async getUsers() {
103-
const listUsersResult = await auth.listUsers();
104+
async getUsers () {
105+
const listUsersResult = await auth.listUsers()
104106
const users = await Promise.all(
105107
listUsersResult.users.map(async (userRecord) => {
106108
// Additional async operation to read user data from Firestore
107-
let userData;
109+
let userData
108110
try {
109-
const fs = await Firestore("users", userRecord.uid);
110-
userData = fs.read();
111+
const fs = await Firestore('users', userRecord.uid)
112+
userData = fs.read()
111113
} catch {
112-
userData = { false: "No user data found" };
114+
userData = { false: 'No user data found' }
113115
}
114116
return {
115117
...userRecord, // Include default user data
116-
...userData, // Include additional user data from Firestore
117-
};
118+
...userData // Include additional user data from Firestore
119+
}
118120
})
119-
);
120-
return users;
121+
)
122+
return users
121123
}
122124
}

0 commit comments

Comments
 (0)