Skip to content

Commit 4d72b8d

Browse files
committed
Updated authorisation
1 parent 6a1b385 commit 4d72b8d

Some content is hidden

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

47 files changed

+3795
-5
lines changed

Controllers/CategoryController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace MARKETPLACEAPI.Controllers;
99
[ApiController]
1010
[Produces("application/json")]
1111
[Consumes("application/json")]
12-
[Authorize]
1312
[Route("api/categories/[controller]")]
1413
public class CategoryController : ControllerBase
1514
{
@@ -36,6 +35,7 @@ public async Task<ActionResult<Category>> Get(string id, [FromHeader] string use
3635
}
3736

3837
[HttpPost]
38+
[Authorize]
3939

4040
public async Task<IActionResult> Post(CategoryCreateDto newCategory)
4141
{
@@ -50,6 +50,7 @@ public async Task<IActionResult> Post(CategoryCreateDto newCategory)
5050
}
5151

5252
[HttpPatch("{id:length(24)}")]
53+
[Authorize]
5354
public async Task<IActionResult> Update(string id, CategoryUpdateDto updatedCategory)
5455
{
5556
var category = await _categoryService.GetAsync(id);
@@ -69,6 +70,7 @@ public async Task<IActionResult> Update(string id, CategoryUpdateDto updatedCate
6970
}
7071

7172
[HttpDelete("{id:length(24)}")]
73+
[Authorize]
7274
public async Task<IActionResult> Delete(string id)
7375
{
7476
var category = await _categoryService.GetAsync(id);

Controllers/NftController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace MARKETPLACEAPI.Controllers;
99
[ApiController]
1010
[Produces("application/json")]
1111
[Consumes("application/json")]
12-
[Authorize]
1312
[Route("api/user/[controller]")]
1413
public class NftController : ControllerBase
1514
{
@@ -45,6 +44,7 @@ public async Task<ActionResult<NftDto>> Get(string id)
4544
}
4645

4746
[HttpPost]
47+
[Authorize]
4848
public async Task<IActionResult> Post(NftCreateDto newNft)
4949
{
5050
var userId = HttpContext.Request.Headers["userId"].ToString();
@@ -65,6 +65,7 @@ public async Task<IActionResult> Post(NftCreateDto newNft)
6565
}
6666

6767
[HttpPatch("{id:length(24)}")]
68+
[Authorize]
6869
public async Task<IActionResult> Update(string id, NftUpdateDto updatedNft)
6970
{
7071
var nft = await _nftService.GetAsync(id);
@@ -86,6 +87,7 @@ public async Task<IActionResult> Update(string id, NftUpdateDto updatedNft)
8687
}
8788

8889
[HttpDelete("{id:length(24)}")]
90+
[Authorize]
8991
public async Task<IActionResult> Delete(string id)
9092
{
9193
var nft = await _nftService.GetAsync(id);

Controllers/ProjectController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace MARKETPLACEAPI.Controllers;
99
[ApiController]
1010
[Produces("application/json")]
1111
[Consumes("application/json")]
12-
[Authorize]
1312
[Route("api/projects/[controller]")]
1413
public class ProjectController : ControllerBase
1514
{
@@ -57,6 +56,7 @@ public async Task<ActionResult<ProjectDto>> Get(string id)
5756
}
5857

5958
[HttpPost]
59+
[Authorize]
6060
public async Task<IActionResult> Post(ProjectCreateDto newProject)
6161
{
6262
var userId = HttpContext.Request.Headers["userId"].ToString();
@@ -89,6 +89,7 @@ public async Task<IActionResult> Post(ProjectCreateDto newProject)
8989
}
9090

9191
[HttpPatch("{id:length(24)}")]
92+
[Authorize]
9293
public async Task<IActionResult> Update(string id, UpdateProjectDto updatedProject)
9394
{
9495

Controllers/ProjectDetailController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace MARKETPLACEAPI.Controllers;
99
[ApiController]
1010
[Produces("application/json")]
1111
[Consumes("application/json")]
12-
[Authorize]
1312
[Route("api/project-details/[controller]")]
1413
public class ProjectDetailController : ControllerBase
1514
{
@@ -36,6 +35,7 @@ public async Task<ActionResult<ProjectDetail>> Get(string id)
3635
}
3736

3837
[HttpPost]
38+
[Authorize]
3939
public async Task<IActionResult> Post(ProjectDetailCreateDto newProjectDetail)
4040
{
4141
var existingProjectDetail = await _projectDetailService.GetProjectDetailsByProjectId(newProjectDetail.projectId!);
@@ -63,6 +63,7 @@ public async Task<IActionResult> Post(ProjectDetailCreateDto newProjectDetail)
6363
}
6464

6565
[HttpPatch("{id:length(24)}")]
66+
[Authorize]
6667
public async Task<IActionResult> Update(string id, ProjectDetailCreateDto updatedProjectDetail)
6768
{
6869
var projectDetail = await _projectDetailService.GetAsync(id);
@@ -88,6 +89,7 @@ public async Task<IActionResult> Update(string id, ProjectDetailCreateDto update
8889
}
8990

9091
[HttpDelete("{id:length(24)}")]
92+
[Authorize]
9193
public async Task<IActionResult> Delete(string id)
9294
{
9395
var projectDetail = await _projectDetailService.GetAsync(id);

Controllers/ProjectUpdateController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace MARKETPLACEAPI.Controllers;
99
[ApiController]
1010
[Produces("application/json")]
1111
[Consumes("application/json")]
12-
[Authorize]
1312
[Route("api/project-updates/[controller]")]
1413
public class ProjectUpdateController : ControllerBase
1514
{
@@ -36,6 +35,7 @@ public async Task<ActionResult<ProjectUpdate>> Get(string id)
3635
}
3736

3837
[HttpPost]
38+
[Authorize]
3939
public async Task<IActionResult> Post(ProjectUpdateCreateDto newProjectUpdate)
4040
{
4141
var projectUpdate = new ProjectUpdate
@@ -50,6 +50,7 @@ public async Task<IActionResult> Post(ProjectUpdateCreateDto newProjectUpdate)
5050
}
5151

5252
[HttpPatch("{id:length(24)}")]
53+
[Authorize]
5354
public async Task<IActionResult> Update(string id, ProjectUpdateCreateDto updatedProjectUpdate)
5455
{
5556

@@ -71,6 +72,7 @@ public async Task<IActionResult> Update(string id, ProjectUpdateCreateDto update
7172
}
7273

7374
[HttpDelete("{id:length(24)}")]
75+
[Authorize]
7476
public async Task<IActionResult> Delete(string id)
7577
{
7678
var projectUpdate = await _projectUpdateService.GetAsync(id);
1.61 MB
Binary file not shown.
84.2 KB
Binary file not shown.
151 KB
Binary file not shown.
34.5 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)