Skip to content

Commit b2ca673

Browse files
committed
Add GetAll endpoint to UsersController and update HTTP requests to use dynamic user IDs
1 parent bdfb0ca commit b2ca673

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

Controllers/UsersController.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ public UsersController(MongoDbService mongoDbService)
1818
_mongoDbService = mongoDbService;
1919
}
2020

21+
// Returns all users (passwords stripped) for assignment dropdowns
22+
[HttpGet]
23+
public IActionResult GetAll()
24+
{
25+
var db = _mongoDbService.GetDatabase();
26+
var usersCollection = db.GetCollection<User>("user");
27+
var users = usersCollection.Find(_ => true).ToList();
28+
foreach (var u in users)
29+
{
30+
u.Password = string.Empty;
31+
}
32+
return Ok(users);
33+
}
34+
2135
// Returns the current user based on JWT
2236
[HttpGet("me")]
2337
public IActionResult Me()

Flowboard-Project-Management-System-Backend.http

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ Authorization: Bearer {{login.response.body.token}}
5555

5656
{
5757
"category": "design",
58-
"assignedTo": "690d04b90943671dbf22f65e",
59-
"title": "WHOOO WawdawdcdawNY",
58+
"assignedTo": "{{login.response.body.user.id}}",
59+
"title": "Pakyu Sam",
6060
"description": "TESTINGS POTAs.",
6161
"priority": "Important",
6262
"status": "to do",
6363
"startDate": "2025-11-06T09:00:00Z",
6464
"endDate": "2025-11-13T17:00:00Z",
65-
"createdBy": "690d04b90943671dbf22f65e",
65+
"createdBy": "{{login.response.body.user.id}}",
6666
"comments": [
6767
{
68-
"authorId": "690d04b90943671dbf22f65e",
68+
"authorId": "{{login.response.body.user.id}}",
6969
"text": "Initial task created",
7070
"createdAt": "2025-11-06T09:05:00Z"
7171
}

0 commit comments

Comments
 (0)