Skip to content

Commit 2123224

Browse files
Merge pull request #5 from chenxidev1129/3-add-task-crud-endpoints
add task endpoints
2 parents f2725a1 + 9639e5f commit 2123224

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

taskmaster-api/Controllers/AuthController.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace taskmaster_api.Controllers
77
{
88
[Route("api/[controller]")]
99
[ApiController]
10+
[AllowAnonymous]
1011
public class AuthController : ApplicationControllerBase
1112
{
1213
private readonly IAuthService _authService;
@@ -17,21 +18,18 @@ public AuthController(IAuthService authService)
1718
}
1819

1920
[HttpPost("login")]
20-
[AllowAnonymous]
2121
public IActionResult Login(LoginDto loginDto)
2222
{
2323
return ToHttpResult<LoginResponseDto>(_authService.Login(loginDto));
2424
}
2525

2626
[HttpPost("register")]
27-
[AllowAnonymous]
2827
public IActionResult Register(RegisterDto registerDto)
2928
{
3029
return ToHttpResult<RegisterDto>(_authService.Register(registerDto));
3130
}
3231

3332
[HttpPost("register-admin")]
34-
[AllowAnonymous]
3533
public IActionResult RegisterAdmin(RegisterDto registerDto)
3634
{
3735
return ToHttpResult<RegisterDto>(_authService.RegisterAdmin(registerDto));

taskmaster-api/Controllers/TaskController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using Microsoft.AspNetCore.Mvc;
1+
using Microsoft.AspNetCore.Authorization;
2+
using Microsoft.AspNetCore.Mvc;
23
using taskmaster_api.Data.DTOs;
4+
using taskmaster_api.Data.Models;
35
using taskmaster_api.Services.Interface;
46

57
namespace taskmaster_api.Controllers
68
{
79
[Route("api/[controller]")]
810
[ApiController]
11+
[Authorize]
912
public class TaskController : ApplicationControllerBase
1013
{
1114
private readonly ITaskService _taskService;

taskmaster-api/Data/DTOs/TaskDto.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class TaskDto : IDto<TaskEntity>
1010
public string Title { get; set; }
1111
public string Description { get; set; }
1212
public DateTime DueDate { get; set; }
13+
public string Status { get; set; }
1314

1415
public TaskEntity ToEntity()
1516
{

taskmaster-api/Data/Entities/TaskEntity.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class TaskEntity : IEntity<TaskDto>
1717

1818
public DateTime DueDate { get; set; }
1919

20+
public string Status { get; set; }
21+
2022
public TaskDto ToDto()
2123
{
2224
return EntityHelpers.ToDto<TaskEntity, TaskDto>(this);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace taskmaster_api.Data.Models
2+
{
3+
public static class TaskStatus
4+
{
5+
public const string Open = "Open";
6+
public const string InProgress = "InProgress";
7+
public const string Completed = "Complete";
8+
}
9+
}

0 commit comments

Comments
 (0)