Skip to content

Commit a1268b5

Browse files
committed
Standardise to use camelCase instead of snake_case
1 parent 0af5af7 commit a1268b5

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

collab-service/app/controller/collab-controller.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {
22
createRoom,
3-
get_roomID,
3+
getRoomId,
44
heartbeat,
5-
get_all_rooms,
5+
getAllRooms,
66
} from "../model/repository.js";
77
import crypto from "crypto";
88

99
// Create a room between two users
10-
export async function create_room(req, res) {
10+
export async function createRoom(req, res) {
1111
const { user1, user2 } = req.body;
1212

1313
if (!user1 || !user2) {
@@ -29,14 +29,14 @@ export async function create_room(req, res) {
2929
}
3030

3131
// Get room ID by user
32-
export async function get_room_by_user(req, res) {
32+
export async function getRoomByUser(req, res) {
3333
const { user } = req.params;
3434

3535
if (!user) {
3636
return res.status(400).json({ error: "User is required" });
3737
}
3838

39-
const room = await get_roomID(user);
39+
const room = await getRoomId(user);
4040

4141
if (room) {
4242
res.status(200).json(room);
@@ -46,7 +46,7 @@ export async function get_room_by_user(req, res) {
4646
}
4747

4848
// Update heartbeat for a room
49-
export async function update_heartbeat(req, res) {
49+
export async function updateHeartbeat(req, res) {
5050
const { roomId } = req.params;
5151

5252
if (!roomId) {
@@ -63,8 +63,8 @@ export async function update_heartbeat(req, res) {
6363
}
6464

6565
// Get all rooms
66-
export async function get_all_rooms_controller(req, res) {
67-
const rooms = await get_all_rooms();
66+
export async function getAllRoomsController(req, res) {
67+
const rooms = await getAllRooms();
6868

6969
if (rooms) {
7070
res.status(200).json(rooms);

collab-service/app/model/repository.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function createRoom(user1, user2, roomId) {
2323
}
2424
}
2525

26-
export async function get_roomID(user) {
26+
export async function getRoomId(user) {
2727
try {
2828
const room = await UsersSession.findOne({ users: user });
2929
return room;
@@ -45,7 +45,7 @@ export async function heartbeat(roomId) {
4545
}
4646
}
4747

48-
export async function get_all_rooms() {
48+
export async function getAllRooms() {
4949
try {
5050
const rooms = await UsersSession.find({});
5151
return rooms;
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import express from "express";
22
import {
3-
create_room,
4-
get_room_by_user,
5-
update_heartbeat,
6-
get_all_rooms_controller,
3+
createRoom,
4+
getRoomByUser,
5+
updateHeartbeat,
6+
getAllRoomsController,
77
} from "../controller/collab-controller.js";
88

99
const router = express.Router();
1010

11-
router.post("/create-room", create_room);
11+
router.post("/create-room", createRoom);
1212

13-
router.get("/user/:user", get_room_by_user);
13+
router.get("/user/:user", getRoomByUser);
1414

15-
router.patch("/heartbeat/:roomId", update_heartbeat);
15+
router.patch("/heartbeat/:roomId", updateHeartbeat);
1616

17-
router.get("/rooms", get_all_rooms_controller);
17+
router.get("/rooms", getAllRoomsController);
1818

1919
export default router;

0 commit comments

Comments
 (0)