Compare commits

..

No commits in common. "173b23f7d3392f80834f2a5a3fe443994e1c831f" and "481b01a53fe4693d815b57353d97f7399d6b046b" have entirely different histories.

7 changed files with 1 additions and 141 deletions

View File

@ -3,6 +3,5 @@
public class CreateContactTagDto
{
public string? Name { get; set; }
public string? Description { get; set; }
}
}

View File

@ -4,6 +4,5 @@
{
public Guid Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
}
}

View File

@ -125,7 +125,6 @@ namespace Marco.Pms.Model.Mapper
return new ContactTagMaster
{
Name = createContactTagDto.Name ?? string.Empty,
Description = createContactTagDto.Description ?? string.Empty,
TenantId = tenantId
};
}
@ -135,7 +134,6 @@ namespace Marco.Pms.Model.Mapper
{
Id = updateContactTagDto.Id,
Name = updateContactTagDto.Name ?? string.Empty,
Description = updateContactTagDto.Description ?? string.Empty,
TenantId = tenantId
};
}
@ -144,7 +142,6 @@ namespace Marco.Pms.Model.Mapper
return new ContactTagVM
{
Id = contactTag.Id,
Description = contactTag.Description ?? string.Empty,
Name = contactTag.Name ?? string.Empty,
};
}

View File

@ -4,6 +4,5 @@
{
public Guid Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
}
}

View File

@ -9,7 +9,6 @@ using Marco.Pms.Model.Utilities;
using Marco.Pms.Model.ViewModels.Activities;
using Marco.Pms.Model.ViewModels.Forum;
using Marco.Pms.Model.ViewModels.Master;
using Marco.Pms.Services.Helpers;
using MarcoBMS.Services.Helpers;
using MarcoBMS.Services.Service;
using Microsoft.AspNetCore.Authorization;
@ -26,13 +25,11 @@ namespace Marco.Pms.Services.Controllers
private readonly ApplicationDbContext _context;
private readonly UserHelper _userHelper;
private readonly ILoggingService _logger;
private readonly MasterHelper _masterHelper;
public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger, MasterHelper masterHelper)
public MasterController(ApplicationDbContext context, UserHelper userHelper, ILoggingService logger)
{
_context = context;
_userHelper = userHelper;
_logger = logger;
_masterHelper = masterHelper;
}
// -------------------------------- Activity --------------------------------
@ -670,81 +667,5 @@ namespace Marco.Pms.Services.Controllers
return NotFound(ApiResponse<object>.ErrorResponse("Work category not found", "Work category not found", 404));
}
}
// -------------------------------- Contact Category --------------------------------
[HttpGet("contact-categories")]
public async Task<IActionResult> GetContactCategoryMasterList()
{
return Ok();
}
[HttpGet("contact-category/{id})")]
public async Task<IActionResult> GetContactCategoryMaster(Guid id)
{
return Ok();
}
[HttpPost("contact-category")]
public async Task<IActionResult> CreateContactCategoryMaster([FromBody] CreateContactCategoryDto contactCategoryDto)
{
var response = await _masterHelper.CreateContactCategory(contactCategoryDto);
if (response.StatusCode == 200)
{
return Ok(response);
}
else if (response.StatusCode == 409)
{
return Conflict(response);
}
else
{
return BadRequest(response);
}
}
[HttpPost("contact-category/edit/{id}")]
public async Task<IActionResult> UpdateContactCategoryMaster(Guid id, [FromBody] UpdateContactCategoryDto updateContactCategoryDto)
{
return Ok();
}
[HttpDelete("contact-category/{id}")]
public async Task<IActionResult> DeletecontactCategoryMaster(Guid id)
{
return Ok();
}
// -------------------------------- Contact Category --------------------------------
[HttpGet("contact-tags")]
public async Task<IActionResult> GetContactTagMasterList()
{
return Ok();
}
[HttpGet("contact-tag/{id})")]
public async Task<IActionResult> GetContactTagMaster(Guid id)
{
return Ok();
}
[HttpPost("contact-tag")]
public async Task<IActionResult> CreateContactTagMaster([FromBody] CreateContactTagDto contactTagDto)
{
return Ok();
}
[HttpPost("contact-tag/edit/{id}")]
public async Task<IActionResult> UpdateContactTagMaster(Guid id, [FromBody] UpdateContactTagDto updateContactTagDto)
{
return Ok();
}
[HttpDelete("contact-tag/{id}")]
public async Task<IActionResult> DeletecontactTagMaster(Guid id)
{
return Ok();
}
}
}

View File

@ -1,54 +0,0 @@
using Marco.Pms.DataAccess.Data;
using Marco.Pms.Model.Directory;
using Marco.Pms.Model.Dtos.Master;
using Marco.Pms.Model.Mapper;
using Marco.Pms.Model.Utilities;
using Marco.Pms.Model.ViewModels.Master;
using MarcoBMS.Services.Helpers;
using MarcoBMS.Services.Service;
using Microsoft.EntityFrameworkCore;
namespace Marco.Pms.Services.Helpers
{
public class MasterHelper
{
private readonly ApplicationDbContext _context;
private readonly ILoggingService _logger;
private readonly UserHelper _userHelper;
public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper)
{
_context = context;
_logger = logger;
_userHelper = userHelper;
}
// -------------------------------- Contact Category --------------------------------
public async Task<ApiResponse<object>> CreateContactCategory(CreateContactCategoryDto contactCategoryDto)
{
Guid tenantId = _userHelper.GetTenantId();
var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
if (contactCategoryDto != null)
{
ContactCategoryMaster? existingContactCategory = await _context.ContactCategoryMasters.FirstOrDefaultAsync(c => c.TenantId == tenantId && c.Name.ToLower() == (contactCategoryDto.Name != null ? contactCategoryDto.Name.ToLower() : ""));
if (existingContactCategory == null)
{
ContactCategoryMaster contactCategory = contactCategoryDto.ToContactCategoryMasterFromCreateContactCategoryDto(tenantId);
_context.ContactCategoryMasters.Add(contactCategory);
await _context.SaveChangesAsync();
ContactCategoryVM categoryVM = contactCategory.ToContactCategoryVMFromContactCategoryMaster();
_logger.LogInfo("Employee ID {LoggedInEmployeeId} created a contact category {ContactCategoryId}.", LoggedInEmployee.Id, contactCategory.Id);
return ApiResponse<object>.SuccessResponse(categoryVM, "Category Created Successfully", 200);
}
_logger.LogWarning("Employee ID {LoggedInEmployeeId} attempted to create an existing contact category.", LoggedInEmployee.Id);
return ApiResponse<object>.ErrorResponse("Category already existed", "Category already existed", 409);
}
_logger.LogWarning("Employee with ID {LoggedInEmployeeId} sended empty payload", LoggedInEmployee.Id);
return ApiResponse<object>.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400);
}
// -------------------------------- Contact Tag --------------------------------
// -------------------------------- Bucket --------------------------------
}
}

View File

@ -132,7 +132,6 @@ builder.Services.AddScoped<RolesHelper>();
builder.Services.AddScoped<EmployeeHelper>();
builder.Services.AddScoped<ProjectsHelper>();
builder.Services.AddScoped<DirectoryHelper>();
builder.Services.AddScoped<MasterHelper>();
builder.Services.AddSingleton<ILoggingService, LoggingService>();