Compare commits

..

No commits in common. "05dd8680da54b6684999836cbd418ea86dacd5b4" and "64e4525fcf13ab8529565e35e7dc39e3bd175711" have entirely different histories.

4 changed files with 0 additions and 121 deletions

View File

@ -188,27 +188,5 @@ namespace Marco.Pms.Model.Mapper
Description = bucket.Description Description = bucket.Description
}; };
} }
//Contact Note
public static ContactNote ToContactNoteFromCreateContactNoteDto(this CreateContactNoteDto noteDto, Guid tenantId, Guid employeeId)
{
return new ContactNote
{
Note = noteDto.Note,
ContactId = noteDto.ContactId,
CreatedAt = DateTime.UtcNow,
CreatedById = employeeId,
TenantId = tenantId
};
}
public static ContactNoteVM ToContactNoteVMFromContactNote(this ContactNote note)
{
return new ContactNoteVM
{
Id = note.Id,
Note = note.Note,
ContactId = note.ContactId
};
}
} }
} }

View File

@ -1,9 +0,0 @@
namespace Marco.Pms.Model.ViewModels.Directory
{
public class ContactNoteVM
{
public Guid Id { get; set; }
public string Note { get; set; } = string.Empty;
public Guid ContactId { get; set; }
}
}

View File

@ -99,73 +99,6 @@ namespace Marco.Pms.Services.Controllers
} }
} }
// -------------------------------- Contact Notes --------------------------------
[HttpPost("note")]
public async Task<IActionResult> CreateContactNote([FromBody] CreateContactNoteDto noteDto)
{
return Ok();
//var response = await _directoryHelper.CreateContactNote(noteDto);
//if (response.StatusCode == 200)
//{
//return Ok(response);
//}
//else if (response.StatusCode == 404)
//{
// return NotFound(response);
//}
//else
//{
// return BadRequest(response);
//}
}
[HttpGet("note/{ContactId}")]
public async Task<IActionResult> GetNoteListByContactId(Guid contactId)
{
var response = await _directoryHelper.GetNoteListByContactId(contactId);
if (response.StatusCode == 200)
{
return Ok(response);
}
else if (response.StatusCode == 404)
{
return NotFound(response);
}
else
{
return BadRequest(response);
}
}
[HttpPut("note/{id}")]
public async Task<IActionResult> UpdateContactNote(Guid id, [FromBody] UpdateContactNoteDto noteDto)
{
return Ok();
//var response = await _directoryHelper.UpdateContactNote(id, noteDto);
//if (response.StatusCode == 200)
//{
// return Ok(response);
//}
//else if (response.StatusCode == 404)
//{
// return NotFound(response);
//}
//else
//{
// return BadRequest(response);
//}
}
[HttpDelete("note/{id}")]
public async Task<IActionResult> DeleteContactNote(Guid id)
{
return Ok();
//var response = await _directoryHelper.DeleteContactNote(id);
//return Ok(response);
}
// -------------------------------- Bucket --------------------------------
[HttpGet("buckets")] [HttpGet("buckets")]
public async Task<IActionResult> GetBucketList() public async Task<IActionResult> GetBucketList()

View File

@ -624,29 +624,6 @@ namespace Marco.Pms.Services.Helpers
return ApiResponse<object>.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400); return ApiResponse<object>.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400);
} }
// -------------------------------- Contact Notes --------------------------------
public async Task<ApiResponse<object>> GetNoteListByContactId(Guid id)
{
Guid tenantId = _userHelper.GetTenantId();
var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
Contact? contact = await _context.Contacts.FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId);
if (contact != null)
{
List<ContactNote>? notes = await _context.ContactNotes.Where(n => n.ContactId == contact.Id && n.IsActive).ToListAsync();
List<ContactNoteVM>? noteVMs = new List<ContactNoteVM>();
foreach (var note in notes)
{
ContactNoteVM noteVM = note.ToContactNoteVMFromContactNote();
noteVMs.Add(noteVM);
}
_logger.LogInfo("{count} contact-notes record from contact {ContactId} fetched by Employee {EmployeeId}", noteVMs.Count, id, LoggedInEmployee.Id);
return ApiResponse<object>.SuccessResponse(noteVMs, $"{noteVMs.Count} contact-notes record fetched successfully", 200);
}
_logger.LogWarning("Employee with ID {LoggedInEmployeeId} attempted to fetch a list notes from contact with ID {ContactId}, but the contact was not found in the database.", LoggedInEmployee.Id, id);
return ApiResponse<object>.ErrorResponse("Contact not found", "Contact not found", 404);
}
// -------------------------------- Bucket -------------------------------- // -------------------------------- Bucket --------------------------------
public async Task<ApiResponse<object>> GetBucketList() public async Task<ApiResponse<object>> GetBucketList()