-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from chenxidev1129/6-add-some-tables-for-task-m…
…anagement 6 add some tables for task management
- Loading branch information
Showing
55 changed files
with
2,608 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using taskmaster_api.Data.DTOs; | ||
using taskmaster_api.Services.Interface; | ||
|
||
namespace taskmaster_api.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
[Authorize] | ||
public class ActivityLogController : ApplicationControllerBase | ||
{ | ||
private readonly IActivityLogService _activityLogService; | ||
|
||
public ActivityLogController(IActivityLogService activityLogService) | ||
{ | ||
_activityLogService = activityLogService; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult GetAllActivityLogs() | ||
{ | ||
return ToHttpResult<List<ActivityLogDto>>(_activityLogService.GetAllActivityLogs()); | ||
} | ||
|
||
[HttpGet("{id}")] | ||
public IActionResult GetActivityLog(int id) | ||
{ | ||
return ToHttpResult<ActivityLogDto>(_activityLogService.GetActivityLogById(id)); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult CreateActivityLog(ActivityLogDto activityLogDto) | ||
{ | ||
return ToHttpResult<ActivityLogDto>(_activityLogService.CreateActivityLog(activityLogDto)); | ||
} | ||
|
||
[HttpPut("{id}")] | ||
public IActionResult UpdateActivityLog(int id, ActivityLogDto activityLogDto) | ||
{ | ||
return ToHttpResult<ActivityLogDto>(_activityLogService.UpdateActivityLog(id, activityLogDto)); | ||
} | ||
|
||
[HttpDelete("{id}")] | ||
public IActionResult DeleteActivityLog(int id) | ||
{ | ||
return ToHttpResult(_activityLogService.DeleteActivityLog(id)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using taskmaster_api.Data.DTOs; | ||
using taskmaster_api.Services.Interface; | ||
|
||
namespace taskmaster_api.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
[Authorize] | ||
public class AttachmentController : ApplicationControllerBase | ||
{ | ||
private readonly IAttachmentService _attachmentService; | ||
|
||
public AttachmentController(IAttachmentService attachmentService) | ||
{ | ||
_attachmentService = attachmentService; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult GetAllAttachments() | ||
{ | ||
return ToHttpResult<List<AttachmentDto>>(_attachmentService.GetAllAttachments()); | ||
} | ||
|
||
[HttpGet("{id}")] | ||
public IActionResult GetAttachment(int id) | ||
{ | ||
return ToHttpResult<AttachmentDto>(_attachmentService.GetAttachmentById(id)); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult CreateAttachment(AttachmentDto attachmentDto) | ||
{ | ||
return ToHttpResult<AttachmentDto>(_attachmentService.CreateAttachment(attachmentDto)); | ||
} | ||
|
||
[HttpPut("{id}")] | ||
public IActionResult UpdateAttachment(int id, AttachmentDto attachmentDto) | ||
{ | ||
return ToHttpResult<AttachmentDto>(_attachmentService.UpdateAttachment(id, attachmentDto)); | ||
} | ||
|
||
[HttpDelete("{id}")] | ||
public IActionResult DeleteAttachment(int id) | ||
{ | ||
return ToHttpResult(_attachmentService.DeleteAttachment(id)); | ||
} | ||
|
||
[HttpPost("upload")] | ||
public IActionResult Upload([FromForm] AttachmentUploadRequest request) | ||
{ | ||
return ToHttpResult(_attachmentService.UploadFile(request)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using taskmaster_api.Data.DTOs; | ||
using taskmaster_api.Services; | ||
using taskmaster_api.Services.Interface; | ||
|
||
namespace taskmaster_api.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
[Authorize] | ||
public class CommentController : ApplicationControllerBase | ||
{ | ||
private readonly ICommentService _commentService; | ||
|
||
public CommentController(ICommentService commentService) | ||
{ | ||
_commentService = commentService; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult GetAllComments() | ||
{ | ||
return ToHttpResult<List<CommentDto>>(_commentService.GetAllComments()); | ||
} | ||
|
||
[HttpGet("{id}")] | ||
public IActionResult GetComment(int id) | ||
{ | ||
return ToHttpResult<CommentDto>(_commentService.GetCommentById(id)); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult CreateComment(CommentDto commentDto) | ||
{ | ||
return ToHttpResult<CommentDto>(_commentService.CreateComment(commentDto)); | ||
} | ||
|
||
[HttpPut("{id}")] | ||
public IActionResult UpdateComment(int id, CommentDto commentDto) | ||
{ | ||
return ToHttpResult<CommentDto>(_commentService.UpdateComment(id, commentDto)); | ||
} | ||
|
||
[HttpDelete("{id}")] | ||
public IActionResult DeleteComment(int id) | ||
{ | ||
return ToHttpResult(_commentService.DeleteComment(id)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using taskmaster_api.Data.DTOs; | ||
using taskmaster_api.Services.Interface; | ||
|
||
namespace taskmaster_api.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
[Authorize] | ||
public class NotificationController : ApplicationControllerBase | ||
{ | ||
private readonly INotificationService _notificationService; | ||
|
||
public NotificationController(INotificationService notificationService) | ||
{ | ||
_notificationService = notificationService; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult GetAllNotifications() | ||
{ | ||
return ToHttpResult<List<NotificationDto>>(_notificationService.GetAllNotifications()); | ||
} | ||
|
||
[HttpGet("{id}")] | ||
public IActionResult GetNotification(int id) | ||
{ | ||
return ToHttpResult<NotificationDto>(_notificationService.GetNotificationById(id)); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult CreateNotification(NotificationDto notificationDto) | ||
{ | ||
return ToHttpResult<NotificationDto>(_notificationService.CreateNotification(notificationDto)); | ||
} | ||
|
||
[HttpPut("{id}")] | ||
public IActionResult UpdateNotification(int id, NotificationDto notificationDto) | ||
{ | ||
return ToHttpResult<NotificationDto>(_notificationService.UpdateNotification(id, notificationDto)); | ||
} | ||
|
||
[HttpDelete("{id}")] | ||
public IActionResult DeleteNotification(int id) | ||
{ | ||
return ToHttpResult(_notificationService.DeleteNotification(id)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using taskmaster_api.Data.DTOs; | ||
using taskmaster_api.Services.Interface; | ||
|
||
namespace taskmaster_api.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
[Authorize] | ||
public class SettingController : ApplicationControllerBase | ||
{ | ||
private readonly ISettingService _settingService; | ||
|
||
public SettingController(ISettingService settingService) | ||
{ | ||
_settingService = settingService; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult GetAllSettings() | ||
{ | ||
return ToHttpResult<List<SettingDto>>(_settingService.GetAllSettings()); | ||
} | ||
|
||
[HttpGet("{id}")] | ||
public IActionResult GetSetting(int id) | ||
{ | ||
return ToHttpResult<SettingDto>(_settingService.GetSettingById(id)); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult CreateSetting(SettingDto settingDto) | ||
{ | ||
return ToHttpResult<SettingDto>(_settingService.CreateSetting(settingDto)); | ||
} | ||
|
||
[HttpPut("{id}")] | ||
public IActionResult UpdateSetting(int id, SettingDto settingDto) | ||
{ | ||
return ToHttpResult<SettingDto>(_settingService.UpdateSetting(id, settingDto)); | ||
} | ||
|
||
[HttpDelete("{id}")] | ||
public IActionResult DeleteSetting(int id) | ||
{ | ||
return ToHttpResult(_settingService.DeleteSetting(id)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using taskmaster_api.Data.DTOs; | ||
using taskmaster_api.Services.Interface; | ||
|
||
namespace taskmaster_api.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class TagController : ApplicationControllerBase | ||
{ | ||
private readonly ITagService _tagService; | ||
|
||
public TagController(ITagService tagService) | ||
{ | ||
_tagService = tagService; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult GetAllTags() | ||
{ | ||
return ToHttpResult<List<TagDto>>(_tagService.GetAllTags()); | ||
} | ||
|
||
[HttpGet("{id}")] | ||
public IActionResult GetTag(int id) | ||
{ | ||
return ToHttpResult<TagDto>(_tagService.GetTagById(id)); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult CreateTag(TagDto tagDto) | ||
{ | ||
return ToHttpResult<TagDto>(_tagService.CreateTag(tagDto)); | ||
} | ||
|
||
[HttpPut("{id}")] | ||
public IActionResult UpdateTag(int id, TagDto tagDto) | ||
{ | ||
return ToHttpResult<TagDto>(_tagService.UpdateTag(id, tagDto)); | ||
} | ||
|
||
[HttpDelete("{id}")] | ||
public IActionResult DeleteTag(int id) | ||
{ | ||
return ToHttpResult(_tagService.DeleteTag(id)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using taskmaster_api.Data.DTOs.Interface; | ||
using taskmaster_api.Data.Entities; | ||
using taskmaster_api.Utilities; | ||
|
||
namespace taskmaster_api.Data.DTOs | ||
{ | ||
public class ActivityLogDto : IDto<ActivityLogEntity> | ||
{ | ||
public int? Id { get; set; } | ||
public string UserId { get; set; } | ||
public string Action { get; set; } | ||
public DateTime CreatedAt { get; set; } | ||
|
||
public ActivityLogDto() | ||
{ | ||
if (!Id.HasValue) | ||
{ | ||
CreatedAt = DateTime.UtcNow; | ||
} | ||
} | ||
|
||
public ActivityLogEntity ToEntity() | ||
{ | ||
return EntityHelpers.ToEntity<ActivityLogDto, ActivityLogEntity>(this); | ||
} | ||
} | ||
} |
Oops, something went wrong.