Fixed Confilt
This commit is contained in:
commit
dc9b696265
@ -10,8 +10,8 @@ namespace Marco.Pms.Model.Activities
|
||||
public long TaskAllocationId { get; set; }
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(TaskAllocationId))]
|
||||
public TaskAllocation TaskAllocation { get; set; }
|
||||
public TaskAllocation? TaskAllocation { get; set; }
|
||||
|
||||
public string ImagePath { get; set; }
|
||||
public string? ImagePath { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Marco.Pms.Model.Dtos.Attendance;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Marco.Pms.Model.Dtos.Attendance;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
namespace Marco.Pms.Model.AttendanceModule
|
||||
|
@ -2,9 +2,9 @@
|
||||
{
|
||||
public class JwtSettings
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Issuer { get; set; }
|
||||
public string Audience { get; set; }
|
||||
public string? Key { get; set; }
|
||||
public string? Issuer { get; set; }
|
||||
public string? Audience { get; set; }
|
||||
public int ExpiresInMinutes { get; set; }
|
||||
public int RefreshTokenExpiresInDays { get; set; }
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
{
|
||||
public DateTime AssignmentDate { get; set; }
|
||||
public double PlannedTask { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<int> TaskTeam { get; set; } //Employee Ids
|
||||
public string? Description { get; set; }
|
||||
public List<int>? TaskTeam { get; set; } //Employee Ids
|
||||
public int WorkItemId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Activities
|
||||
namespace Marco.Pms.Model.Dtos.Activities
|
||||
{
|
||||
public class CreateActivityMasterDto
|
||||
{
|
||||
public string ActivityName { get; set; }
|
||||
public string UnitOfMeasurement { get; set; }
|
||||
public string? ActivityName { get; set; }
|
||||
public string? UnitOfMeasurement { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
public long TaskAllocationId { get; set; }
|
||||
|
||||
public DateTime CommentDate { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,6 @@
|
||||
public long Id { get; set; }
|
||||
public double CompletedTask { get; set; }
|
||||
public DateTime ReportedDate { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,15 +5,15 @@ namespace Marco.Pms.Model.Dtos.Attendance
|
||||
public class RecordAttendanceDot
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
public int EmployeeID { get; set; }
|
||||
public int ProjectID { get; set; }
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public string? MarkTime { get; set; }
|
||||
public string Latitude { get; set; }
|
||||
public string Longitude { get; set; }
|
||||
public string? Latitude { get; set; }
|
||||
public string? Longitude { get; set; }
|
||||
|
||||
|
||||
public ATTENDANCE_MARK_TYPE Action { get; set; }
|
||||
|
@ -7,27 +7,27 @@ namespace Marco.Pms.Model.Dtos.Employees
|
||||
{
|
||||
public ApplicationUserDto() { }
|
||||
public int? Id { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public string? MiddleName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string Gender { get; set; }
|
||||
public string? Gender { get; set; }
|
||||
public DateTime? BirthDate { get; set; }
|
||||
public DateTime? JoiningDate { get; set; }
|
||||
|
||||
public string PermanentAddress { get; set; }
|
||||
public string CurrentAddress { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string? PermanentAddress { get; set; }
|
||||
public string? CurrentAddress { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
public string EmergencyPhoneNumber { get; set; }
|
||||
public string? EmergencyPhoneNumber { get; set; }
|
||||
|
||||
public string? AadharNumber { get; set; }
|
||||
|
||||
public string? PanNumber { get; set; }
|
||||
|
||||
public IFormFile? Photo { get; set; } // To store the captured photo
|
||||
public List<IFormFile> Documents { get; set; }
|
||||
public List<IFormFile>? Documents { get; set; }
|
||||
public string? ApplicationUserId { get; set; }
|
||||
|
||||
public Guid RoleId { get; set; }
|
||||
|
@ -1,19 +1,8 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
{
|
||||
public class AttendanceDto
|
||||
{
|
||||
public string Comment { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
public int EmployeeID { get; set; }
|
||||
public DateTime? InTime { get; set; }
|
||||
public DateTime? OutTime { get; set; }
|
||||
|
@ -1,30 +1,23 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
{
|
||||
public class CreateUserDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public string? MiddleName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string Gender { get; set; }
|
||||
public string? Gender { get; set; }
|
||||
public string? BirthDate { get; set; }
|
||||
public string JoiningDate { get; set; }
|
||||
public string? JoiningDate { get; set; }
|
||||
|
||||
public string? PermanentAddress { get; set; }
|
||||
public string? CurrentAddress { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
public string EmergencyPhoneNumber { get; set; }
|
||||
public string EmergencyContactPerson { get; set; }
|
||||
public string? EmergencyPhoneNumber { get; set; }
|
||||
public string? EmergencyContactPerson { get; set; }
|
||||
|
||||
public string? AadharNumber { get; set; }
|
||||
|
||||
@ -33,25 +26,25 @@ namespace Marco.Pms.Model.Dtos.Employees
|
||||
//public IFormFile? Photo { get; set; } // To store the captured photo
|
||||
//public List<IFormFile>? Documents { get; set; }
|
||||
|
||||
public string JobRoleId { get; set; }
|
||||
public string? JobRoleId { get; set; }
|
||||
|
||||
// public int TenantId { get; set; }
|
||||
}
|
||||
public class CreateQuickUserDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
|
||||
public string Gender { get; set; }
|
||||
public string? Gender { get; set; }
|
||||
|
||||
public string? CurrentAddress { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
public string EmergencyPhoneNumber { get; set; }
|
||||
public string EmergencyContactPerson { get; set; }
|
||||
public string? EmergencyPhoneNumber { get; set; }
|
||||
public string? EmergencyContactPerson { get; set; }
|
||||
|
||||
public string JobRoleId { get; set; }
|
||||
public string? JobRoleId { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
@ -11,6 +6,6 @@ namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
public class LoginDto
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,6 @@
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
public class LogoutDto
|
||||
{ public string RefreshToken { get; set; }
|
||||
{ public string? RefreshToken { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,5 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
@ -17,7 +9,7 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
[DisplayName("Building Name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public int ProjectId { get; set; }
|
||||
|
||||
|
@ -5,10 +5,10 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
public class BuildingVM
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public List<FloorsVM> Floors { get; set; }
|
||||
public List<FloorsVM>? Floors { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,15 +8,15 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
//public int Id { get; set; }
|
||||
[Required(ErrorMessage = "Project Name is required!")]
|
||||
[DisplayName("Project Name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
[DisplayName("Project Address")]
|
||||
[Required(ErrorMessage = "Project Address is required!")]
|
||||
public string ProjectAddress { get; set; }
|
||||
public string? ProjectAddress { get; set; }
|
||||
|
||||
|
||||
[DisplayName("Contact Person")]
|
||||
public string ContactPerson { get; set; }
|
||||
public string? ContactPerson { get; set; }
|
||||
|
||||
|
||||
public DateTime? StartDate { get; set; }
|
||||
|
@ -1,14 +1,5 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
@ -18,7 +9,7 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
|
||||
[Required]
|
||||
[DisplayName("Floor Name")]
|
||||
public string FloorName { get; set; }
|
||||
public string? FloorName { get; set; }
|
||||
|
||||
|
||||
public int BuildingId { get; set; }
|
||||
|
@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
@ -14,9 +9,9 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
|
||||
[Required]
|
||||
[DisplayName("Floor Name")]
|
||||
public string FloorName { get; set; }
|
||||
public string? FloorName { get; set; }
|
||||
|
||||
public List<WorkAreaVM> WorkAreas { get; set; }
|
||||
public List<WorkAreaVM>? WorkAreas { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
using Marco.Pms.Model.Projects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class InfraDot
|
||||
{
|
||||
|
@ -1,14 +1,5 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
@ -17,15 +8,15 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
public int Id { get; set; }
|
||||
[Required(ErrorMessage = "Project Name is required!")]
|
||||
[DisplayName("Project Name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
[DisplayName("Project Address")]
|
||||
[Required(ErrorMessage = "Project Address is required!")]
|
||||
public string ProjectAddress { get; set; }
|
||||
public string? ProjectAddress { get; set; }
|
||||
|
||||
|
||||
[DisplayName("Contact Person")]
|
||||
public string ContactPerson { get; set; }
|
||||
public string? ContactPerson { get; set; }
|
||||
|
||||
|
||||
public DateTime? StartDate { get; set; }
|
||||
|
@ -1,15 +1,8 @@
|
||||
using Marco.Pms.Model.Projects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class ProjectVM : ProjectDto
|
||||
{
|
||||
public List<BuildingVM> Buildings { get; set; }
|
||||
public List<BuildingVM>? Buildings { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,15 +8,15 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
public int Id { get; set; }
|
||||
[Required(ErrorMessage = "Project Name is required!")]
|
||||
[DisplayName("Project Name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
[DisplayName("Project Address")]
|
||||
[Required(ErrorMessage = "Project Address is required!")]
|
||||
public string ProjectAddress { get; set; }
|
||||
public string? ProjectAddress { get; set; }
|
||||
|
||||
|
||||
[DisplayName("Contact Person")]
|
||||
public string ContactPerson { get; set; }
|
||||
public string? ContactPerson { get; set; }
|
||||
|
||||
|
||||
public DateTime? StartDate { get; set; }
|
||||
|
@ -1,14 +1,5 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
@ -19,7 +10,7 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
|
||||
[Required]
|
||||
[DisplayName("Area Name")]
|
||||
public string AreaName { get; set; }
|
||||
public string? AreaName { get; set; }
|
||||
|
||||
public int FloorId { get; set; }
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
@ -14,9 +9,9 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
|
||||
[Required]
|
||||
[DisplayName("Area Name")]
|
||||
public string AreaName { get; set; }
|
||||
public string? AreaName { get; set; }
|
||||
|
||||
public List<WorkItemVM> WorkItems { get; set; }
|
||||
public List<WorkItemVM>? WorkItems { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,6 @@ namespace Marco.Pms.Model.Dtos.Project
|
||||
public class WorkItemVM
|
||||
{
|
||||
public int WorkItemId { get; set; }
|
||||
public WorkItem WorkItem { get; set; }
|
||||
public WorkItem? WorkItem { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
public class RefreshTokenDto
|
||||
{
|
||||
public string Token { get; set; }
|
||||
public string RefreshToken { get; set; }
|
||||
public string? Token { get; set; }
|
||||
public string? RefreshToken { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
public class RegisterDto
|
||||
{
|
||||
[Required]
|
||||
public string Username { get; set; }
|
||||
public string? Username { get; set; }
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
public string? Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(6)]
|
||||
public string Password { get; set; }
|
||||
public string? Password { get; set; }
|
||||
|
||||
[Compare("Password", ErrorMessage = "Passwords do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
public string? ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,13 @@ namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
public string? Email { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Token { get; set; }
|
||||
public string? Token { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(6)]
|
||||
public string NewPassword { get; set; }
|
||||
public string? NewPassword { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Roles
|
||||
{
|
||||
@ -11,13 +8,13 @@ namespace Marco.Pms.Model.Dtos.Roles
|
||||
[Required(ErrorMessage = "Role Name is required!")]
|
||||
[DisplayName("Name")]
|
||||
|
||||
public string Role { get; set; }
|
||||
public string? Role { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Role Description is required!")]
|
||||
[DisplayName("Description")]
|
||||
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public List<FeaturesPermissionDto> FeaturesPermission { get; set; } // Features assigned to this role
|
||||
public List<FeaturesPermissionDto>? FeaturesPermission { get; set; } // Features assigned to this role
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Roles
|
||||
namespace Marco.Pms.Model.Dtos.Roles
|
||||
{
|
||||
public class CreateJobRoleDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Roles
|
||||
@ -11,15 +10,15 @@ namespace Marco.Pms.Model.Dtos.Roles
|
||||
[Required(ErrorMessage = "Role Name is required!")]
|
||||
[DisplayName("Name")]
|
||||
|
||||
public string Role { get; set; }
|
||||
public string? Role { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Role Description is required!")]
|
||||
[DisplayName("Description")]
|
||||
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
|
||||
public List<FeaturesPermissionDto> FeaturesPermission { get; set; } // Features assigned to this role
|
||||
public List<FeaturesPermissionDto>? FeaturesPermission { get; set; } // Features assigned to this role
|
||||
}
|
||||
|
||||
public class FeaturesPermissionDto
|
||||
|
@ -1,15 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Roles
|
||||
namespace Marco.Pms.Model.Dtos.Roles
|
||||
{
|
||||
public class UpdateJobRoleDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
{
|
||||
public class EmailDot
|
||||
{
|
||||
public string ToEmail { get; set; }
|
||||
public string FromEmail { get; set; }
|
||||
public string MailBody { get; set; }
|
||||
public string MailSubject { get; set; }
|
||||
public string? ToEmail { get; set; }
|
||||
public string? FromEmail { get; set; }
|
||||
public string? MailBody { get; set; }
|
||||
public string? MailSubject { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Employees
|
||||
namespace Marco.Pms.Model.Employees
|
||||
{
|
||||
public class EmployeeDetails : Employee
|
||||
{
|
||||
|
@ -6,16 +6,16 @@ namespace Marco.Pms.Model.Employees
|
||||
public class EmployeeDocument
|
||||
{
|
||||
public Guid Id { get; set; } // Unique identifier for the document
|
||||
public string FileName { get; set; } // Original file name
|
||||
public string FilePath { get; set; } // Path to the stored file
|
||||
public string FileType { get; set; } // Type of the document (e.g., PDF, JPG)
|
||||
public string? FileName { get; set; } // Original file name
|
||||
public string? FilePath { get; set; } // Path to the stored file
|
||||
public string? FileType { get; set; } // Type of the document (e.g., PDF, JPG)
|
||||
public long FileSize { get; set; } // File size in bytes
|
||||
public DateTime UploadedAt { get; set; } // Timestamp of upload
|
||||
|
||||
public Guid EmployeeId { get; set; } // Foreign key to Employee
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(EmployeeId))]
|
||||
public Employee Employee { get; set; } // Navigation property to Employee
|
||||
public Employee? Employee { get; set; } // Navigation property to Employee
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.Entitlements
|
||||
{
|
||||
|
@ -2,8 +2,7 @@
|
||||
using Marco.Pms.Model.Dtos.Activities;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.ViewModels.Activities;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
|
||||
#nullable disable
|
||||
namespace Marco.Pms.Model.Mapper
|
||||
{
|
||||
public static class ActivitiesMapper
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Marco.Pms.Model.Dtos.Roles;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.ViewModels;
|
||||
|
||||
#nullable disable
|
||||
namespace Marco.Pms.Model.Mapper
|
||||
{
|
||||
public static class ApplicationRoleMapper
|
||||
|
@ -1,7 +1,5 @@
|
||||
using Marco.Pms.Model.Dtos.Employees;
|
||||
using Marco.Pms.Model.Dtos.Roles;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.ViewModels;
|
||||
|
||||
namespace Marco.Pms.Model.Mapper
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Marco.Pms.Model.Dtos.Roles;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.ViewModels;
|
||||
|
||||
namespace Marco.Pms.Model.Mapper
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Marco.Pms.Model.ViewModels.Activities;
|
||||
|
||||
namespace Marco.Pms.Model.Mapper
|
||||
{
|
||||
|
@ -25,9 +25,9 @@ namespace Marco.Pms.Model.Mapper
|
||||
{
|
||||
return new Project
|
||||
{
|
||||
ContactPerson = projectModel.ContactPerson,
|
||||
ProjectAddress = projectModel.ProjectAddress,
|
||||
Name = projectModel.Name,
|
||||
ContactPerson = projectModel.ContactPerson ?? "",
|
||||
ProjectAddress = projectModel.ProjectAddress ?? "",
|
||||
Name = projectModel.Name ?? "",
|
||||
EndDate = projectModel.EndDate,
|
||||
StartDate = projectModel.StartDate,
|
||||
TenantId = TenantId,
|
||||
@ -40,9 +40,9 @@ namespace Marco.Pms.Model.Mapper
|
||||
return new Project
|
||||
{
|
||||
Id = id,
|
||||
ContactPerson = projectModel.ContactPerson,
|
||||
ProjectAddress = projectModel.ProjectAddress,
|
||||
Name = projectModel.Name,
|
||||
ContactPerson = projectModel.ContactPerson ?? "",
|
||||
ProjectAddress = projectModel.ProjectAddress ?? "",
|
||||
Name = projectModel.Name ?? "",
|
||||
EndDate = projectModel.EndDate,
|
||||
StartDate = projectModel.StartDate,
|
||||
TenantId = TenantId,
|
||||
|
@ -7,12 +7,12 @@ namespace Marco.Pms.Model.Projects
|
||||
public class PhotoGallary
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public int ProjectId { get; set; }
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(ProjectId))]
|
||||
public Project? Project { get; set; }
|
||||
public string AddedBy { get; set; }
|
||||
public string? AddedBy { get; set; }
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(AddedBy))]
|
||||
public ApplicationUser? ApplicationUser { get; set; }
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.Projects
|
||||
{
|
||||
|
@ -1,14 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Activities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
|
||||
namespace Marco.Pms.Model.Projects
|
||||
{
|
||||
|
@ -11,18 +11,18 @@ namespace Marco.Pms.Model.Projects
|
||||
public int WorkAreaId { get; set; }
|
||||
[ForeignKey("WorkAreaId")]
|
||||
[ValidateNever]
|
||||
public WorkArea WorkArea { get; set; }
|
||||
public WorkArea? WorkArea { get; set; }
|
||||
public int WorkItemId { get; set; }
|
||||
[ForeignKey("WorkItemId")]
|
||||
[ValidateNever]
|
||||
public WorkItem WorkItem { get; set; }
|
||||
public WorkItem? WorkItem { get; set; }
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(TenantId))]
|
||||
public Tenant Tenant { get; set; }
|
||||
public Tenant? Tenant { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,5 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#nullable disable
|
||||
namespace Marco.Pms.Model.Providers
|
||||
{
|
||||
public sealed class TenantProvider
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#nullable disable
|
||||
namespace Marco.Pms.Model.Utilities
|
||||
{
|
||||
|
||||
|
@ -1,16 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Utilities
|
||||
namespace Marco.Pms.Model.Utilities
|
||||
{
|
||||
public class AuthResponse
|
||||
{
|
||||
public string AccessToken { get; set; }
|
||||
public string RefreshToken { get; set; }
|
||||
public string? AccessToken { get; set; }
|
||||
public string? RefreshToken { get; set; }
|
||||
public int ExpiresIn { get; set; }
|
||||
public object User { get; set; }
|
||||
public object? User { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ namespace Marco.Pms.Model.Utilities
|
||||
public class FileDetails
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public byte[] FileData { get; set; } // Byte array for the file
|
||||
public string FileName { get; set; }
|
||||
public string ContentType { get; set; }
|
||||
public byte[]? FileData { get; set; } // Byte array for the file
|
||||
public string? FileName { get; set; }
|
||||
public string? ContentType { get; set; }
|
||||
/// <summary>
|
||||
/// Name of the file as stored on disk
|
||||
/// </summary>
|
||||
public string StoredName { get; set; }
|
||||
public string? StoredName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Utilities
|
||||
namespace Marco.Pms.Model.Utilities
|
||||
{
|
||||
public class FileUploadModel
|
||||
{
|
||||
public string FileName { get; set; } // Name of the file (e.g., "image1.png")
|
||||
public string Base64Data { get; set; } // Base64-encoded string of the file
|
||||
public string ContentType { get; set; } // MIME type (e.g., "image/png", "application/pdf")
|
||||
public string? FileName { get; set; } // Name of the file (e.g., "image1.png")
|
||||
public string? Base64Data { get; set; } // Base64-encoded string of the file
|
||||
public string? ContentType { get; set; } // MIME type (e.g., "image/png", "application/pdf")
|
||||
public long FileSize { get; set; } // File size in bytes
|
||||
public string Description { get; set; } // Optional: Description or purpose of the file
|
||||
public string? Description { get; set; } // Optional: Description or purpose of the file
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@
|
||||
{
|
||||
public class SmtpSettings
|
||||
{
|
||||
public string SmtpServer { get; set; }
|
||||
public string? SmtpServer { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string SenderName { get; set; }
|
||||
public string SenderEmail { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string? SenderName { get; set; }
|
||||
public string? SenderEmail { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace Marco.Pms.Model.ViewModels.Activities
|
||||
|
||||
public int WorkItemId { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
public List<EmployeeVM> teamMembers { get; set; }
|
||||
public List<EmployeeVM>? teamMembers { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ namespace Marco.Pms.Model.ViewModels.Activities
|
||||
public long Id { get; set; }
|
||||
public long TaskAllocationId { get; set; }
|
||||
public DateTime CommentDate { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
public int CommentedBy { get; set; }
|
||||
public EmployeeVM? Employee { get; set; }
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace Marco.Pms.Model.ViewModels.Activities
|
||||
public int WorkItemId { get; set; }
|
||||
public WorkItem? WorkItem { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
public List<EmployeeVM> teamMembers { get; set; }
|
||||
public List<EmployeeVM>? teamMembers { get; set; }
|
||||
public List<CommentVM>? comments { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,6 @@ namespace Marco.Pms.Model.ViewModels.Activities
|
||||
public int WorkItemId { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
|
||||
public List<CommentVM> Comments { get; set; }
|
||||
public List<CommentVM>? Comments { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ namespace Marco.Pms.Model.ViewModels.Activities
|
||||
public double CompletedTask { get; set; }
|
||||
public DateTime? ReportedDate { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string AssignBy { get; set; }
|
||||
public WorkItem WorkItem { get; set; }
|
||||
public string Tenant { get; set; }
|
||||
public string? AssignBy { get; set; }
|
||||
public WorkItem? WorkItem { get; set; }
|
||||
public string? Tenant { get; set; }
|
||||
|
||||
public List<CommentVM> Comments { get; set; }
|
||||
public List<EmployeeVM> TeamMembers { get; set; }
|
||||
public List<CommentVM>? Comments { get; set; }
|
||||
public List<EmployeeVM>? TeamMembers { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
public class TasksVM
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string ActivityName { get; set; }
|
||||
public string? ActivityName { get; set; }
|
||||
public double TotalPlannedTask { get; set; }
|
||||
public double PlannedTask { get; set; }
|
||||
public double CompletedTask { get; set; }
|
||||
|
@ -3,7 +3,7 @@
|
||||
public class WorkItemVm
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ActivityName { get; set; }
|
||||
public string? ActivityName { get; set; }
|
||||
public double PlannedWork { get; set; }
|
||||
public double CompletedWork { get; set; }
|
||||
public DateTime TaskDate { get; set; }
|
||||
|
@ -1,20 +1,10 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
{
|
||||
public class ApplicationRolesVM
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Role { get; set; }
|
||||
public string Description { get; set; }
|
||||
public ICollection<FeaturePermissionVM> FeaturePermission { get; set; }
|
||||
public string? Role { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public ICollection<FeaturePermissionVM>? FeaturePermission { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
{
|
||||
public class EmployeeProfile
|
||||
{
|
||||
public EmployeeVM EmployeeInfo { get; set; }
|
||||
public string[] Projects { get; set; }
|
||||
public string[] FeaturePermissions { get; set; }
|
||||
public string[] Features { get; set; }
|
||||
public EmployeeVM? EmployeeInfo { get; set; }
|
||||
public string[]? Projects { get; set; }
|
||||
public string[]? FeaturePermissions { get; set; }
|
||||
public string[]? Features { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,20 +3,20 @@
|
||||
public class EmployeeVM
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public string? MiddleName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string Gender { get; set; }
|
||||
public string? Gender { get; set; }
|
||||
public DateTime? BirthDate { get; set; }
|
||||
public DateTime? JoiningDate { get; set; }
|
||||
public string PermanentAddress { get; set; }
|
||||
public string CurrentAddress { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string? PermanentAddress { get; set; }
|
||||
public string? CurrentAddress { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
public string EmergencyPhoneNumber { get; set; }
|
||||
public string EmergencyContactPerson { get; set; }
|
||||
public string? EmergencyPhoneNumber { get; set; }
|
||||
public string? EmergencyContactPerson { get; set; }
|
||||
|
||||
public string? AadharNumber { get; set; }
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
public string? ApplicationUserId { get; set; }
|
||||
|
||||
public int? JobRoleId { get; set; }
|
||||
public string JobRole { get; set; }
|
||||
public string? JobRole { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
{
|
||||
public class EmployeeRolesVM
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
public Guid RoleId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,4 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
{
|
||||
public class FeaturePermissionVM
|
||||
{
|
||||
@ -16,8 +7,8 @@ namespace Marco.Pms.Model.ViewModels
|
||||
|
||||
public Guid FeatureId { get; set; } // Foreign key to Feature
|
||||
|
||||
public string Name { get; set; } // Feature name
|
||||
public string Description { get; set; } // Feature description
|
||||
public string? Name { get; set; } // Feature name
|
||||
public string? Description { get; set; } // Feature description
|
||||
|
||||
public bool IsEnabled { get; set; } // Whether the feature is enabled for this role
|
||||
|
||||
|
@ -1,26 +1,17 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
{
|
||||
public class FeatureVM
|
||||
{
|
||||
public Guid Id { get; set; } // Unique identifier for the permission
|
||||
|
||||
public string Name { get; set; } // Feature name
|
||||
public string Description { get; set; } // Feature description
|
||||
public string? Name { get; set; } // Feature name
|
||||
public string? Description { get; set; } // Feature description
|
||||
public bool IsActive { get; set; }
|
||||
public int? ModuleId { get; set; }
|
||||
|
||||
public string? ModuleName { get; set; }
|
||||
public string? ModuleKey { get; set; }
|
||||
|
||||
public ICollection<FeaturePermissionVM> FeaturePermissions { get; set; }
|
||||
public ICollection<FeaturePermissionVM>? FeaturePermissions { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
{
|
||||
@ -12,6 +7,6 @@ namespace Marco.Pms.Model.ViewModels
|
||||
public Building? building { get; set; }
|
||||
public Floor? floor { get; set; }
|
||||
|
||||
public WorkArea workArea { get; set; }
|
||||
public WorkArea? workArea { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
public class JobRoleVM
|
||||
{
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ namespace Marco.Pms.Model.ViewModels
|
||||
{
|
||||
public class ProjectDetailsVM
|
||||
{
|
||||
public Project project { get; set; }
|
||||
public List<TaskAllocation> employeeAllocation { get; set; }
|
||||
public List<EmployeeDetails> employees { get; set; }
|
||||
public Project? project { get; set; }
|
||||
public List<TaskAllocation>? employeeAllocation { get; set; }
|
||||
public List<EmployeeDetails>? employees { get; set; }
|
||||
|
||||
public List<Building> buildings { get; set; }
|
||||
public List<Floor> floors { get; set; }
|
||||
public List<Building>? buildings { get; set; }
|
||||
public List<Floor>? floors { get; set; }
|
||||
|
||||
public List<WorkArea> workAreas { get; set; }
|
||||
public List<WorkItem> workItems { get; set; }
|
||||
public List<WorkArea>? workAreas { get; set; }
|
||||
public List<WorkItem>? workItems { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
namespace Marco.Pms.Model.ViewModels
|
||||
{
|
||||
|
||||
public class RolesVM
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Role { get; set; }
|
||||
public string? Role { get; set; }
|
||||
|
||||
public ICollection<FeaturePermissionVM> FeaturePermissions { get; set; }
|
||||
public ICollection<FeaturePermissionVM>? FeaturePermissions { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
|
||||
List<AttendanceLog> lstAttendance = await _context.AttendanceLogs.Where(c => c.AttendanceId == attendanceid && c.TenantId == TenantId).ToListAsync();
|
||||
|
||||
return Ok(ApiResponse<object>.SuccessResponse(lstAttendance, String.Format("{0} Attendance records fetched successfully", lstAttendance.Count), 200));
|
||||
return Ok(ApiResponse<object>.SuccessResponse(lstAttendance, System.String.Format("{0} Attendance records fetched successfully", lstAttendance.Count), 200));
|
||||
|
||||
}
|
||||
[HttpGet("log/employee/{employeeid}")]
|
||||
@ -276,8 +276,8 @@ namespace MarcoBMS.Services.Controllers
|
||||
if (recordAttendanceDot.MarkTime == null) return BadRequest(ApiResponse<object>.ErrorResponse("Invalid Mark Time", "Invalid Mark Time",400));
|
||||
|
||||
DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
||||
if (recordAttendanceDot.Comment == null) return BadRequest(ApiResponse<object>.ErrorResponse("Invalid Comment", "Invalid Comment", 400));
|
||||
|
||||
//if(recordAttendanceDot.Comment != null)
|
||||
if (attendance != null)
|
||||
{
|
||||
attendance.Comment = recordAttendanceDot.Comment;
|
||||
|
@ -43,30 +43,29 @@ namespace MarcoBMS.Services.Controllers
|
||||
{
|
||||
var user = await _context.ApplicationUsers.FirstOrDefaultAsync(u => u.Email == loginDto.Username || u.PhoneNumber == loginDto.Username);
|
||||
|
||||
if (user == null || !await _userManager.CheckPasswordAsync(user, loginDto.Password))
|
||||
if (user != null && await _userManager.CheckPasswordAsync(user, loginDto.Password))
|
||||
{
|
||||
return Unauthorized(ApiResponse<object>.ErrorResponse("Invalid username or password.", "Invalid username or password.", 401));
|
||||
//return Unauthorized("Invalid username or password.");
|
||||
if (!user.IsActive)
|
||||
{
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("User is In Active", "User is In Active", 400));
|
||||
}
|
||||
if (!user.EmailConfirmed)
|
||||
{
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Your email is not verified, Please verify your email", "Your email is not verified, Please verify your email", 400));
|
||||
}
|
||||
Employee emp = await _employeeHelper.GetEmployeeByApplicationUserID(user.Id);
|
||||
//var refreshToken = GenerateRefreshToken();
|
||||
if (user.UserName == null) return NotFound(ApiResponse<object>.ErrorResponse("UserName Not found", "UserName Not found", 404)); ;
|
||||
|
||||
var token = _refreshTokenService.GenerateJwtToken(user.UserName, emp.TenantId.ToString(), _jwtSettings);
|
||||
|
||||
var refreshToken = await _refreshTokenService.CreateRefreshToken(user.Id, emp.TenantId.ToString(), _jwtSettings);
|
||||
|
||||
return Ok(ApiResponse<object>.SuccessResponse(new { token = token, refreshToken = refreshToken }, "User logged in successfully.", 200));
|
||||
|
||||
}
|
||||
|
||||
if (!user.IsActive)
|
||||
{
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("User is In Active", "User is In Active", 400));
|
||||
//return BadRequest("User is In Active");
|
||||
}
|
||||
if (!user.EmailConfirmed)
|
||||
{
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Your email is not verified, Please verify your email", "Your email is not verified, Please verify your email", 400));
|
||||
//return BadRequest("Your email is not verified, Please verify your email");
|
||||
}
|
||||
Employee emp = await _employeeHelper.GetEmployeeByApplicationUserID(user.Id);
|
||||
//var refreshToken = GenerateRefreshToken();
|
||||
|
||||
var token = _refreshTokenService.GenerateJwtToken(user.UserName, emp.TenantId.ToString(), _jwtSettings);
|
||||
|
||||
var refreshToken = await _refreshTokenService.CreateRefreshToken(user.Id, emp.TenantId.ToString(), _jwtSettings);
|
||||
|
||||
return Ok(ApiResponse<object>.SuccessResponse(new { token = token, refreshToken = refreshToken }, "User logged in successfully.", 200));
|
||||
return Unauthorized(ApiResponse<object>.ErrorResponse("Invalid username or password.", "Invalid username or password.", 401));
|
||||
}
|
||||
|
||||
[HttpPost("logout")]
|
||||
@ -98,7 +97,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
catch (Exception ex)
|
||||
{
|
||||
// _logger.LogError(ex, "Error during logout");
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Internal server error", "Internal server error", 500));
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Internal server error", ex.Message, 500));
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,6 +119,8 @@ namespace MarcoBMS.Services.Controllers
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Invalid request.", "Invalid request.", 400));
|
||||
|
||||
Employee emp = await _employeeHelper.GetEmployeeByApplicationUserID(user.Id);
|
||||
|
||||
if (user.UserName == null) return NotFound(ApiResponse<object>.ErrorResponse("UserName Not found", "UserName Not found", 404));
|
||||
|
||||
var newJwtToken = _refreshTokenService.GenerateJwtToken(user.UserName, emp.TenantId.ToString(), _jwtSettings);
|
||||
var newRefreshToken = await _refreshTokenService.CreateRefreshToken(user.Id, emp.TenantId.ToString(), _jwtSettings);
|
||||
@ -137,6 +138,9 @@ namespace MarcoBMS.Services.Controllers
|
||||
/* SEND USER REGISTRATION MAIL*/
|
||||
var token = await _userManager.GeneratePasswordResetTokenAsync(user);
|
||||
var resetLink = $"{_configuration["AppSettings:WebFrontendUrl"]}/reset-password?token={WebUtility.UrlEncode(token)}";
|
||||
|
||||
if (user.Email == null) return NotFound(ApiResponse<object>.ErrorResponse("Email Not found", "Email Not found", 404));
|
||||
|
||||
await _emailSender.SendResetPasswordEmail(user.Email, "", resetLink);
|
||||
|
||||
|
||||
@ -199,7 +203,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
var user = await _userManager.FindByEmailAsync(emailDot.ToEmail);
|
||||
if (user == null)
|
||||
{
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("User not found.", "User not found.", 400));
|
||||
return NotFound(ApiResponse<object>.ErrorResponse("User not found.", "User not found.", 404));
|
||||
}
|
||||
|
||||
/* New User*/
|
||||
@ -217,6 +221,9 @@ namespace MarcoBMS.Services.Controllers
|
||||
var isTokenValid = await _userManager.VerifyUserTokenAsync(user, TokenOptions.DefaultProvider, "ResetPassword", token);
|
||||
|
||||
var resetLink = $"{_configuration["AppSettings:WebFrontendUrl"]}/reset-password?token={WebUtility.UrlEncode(token)}";
|
||||
|
||||
if (user.Email == null) return NotFound(ApiResponse<object>.ErrorResponse("Email Not found", "Email Not found", 404));
|
||||
|
||||
await _emailSender.SendResetPasswordEmail(user.Email, "", resetLink);
|
||||
|
||||
return Ok(ApiResponse<object>.SuccessResponse(new {}, "Password reset link sent.", 200));
|
||||
|
@ -57,7 +57,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
}
|
||||
int tenantId = GetTenantId();
|
||||
|
||||
var empRoles = _context.EmployeeRoleMappings.Where(c => c.EmployeeId == employeeId).Include(c => c.Role).Include(c => c.Employee).ToList();
|
||||
var empRoles = await _context.EmployeeRoleMappings.Where(c => c.EmployeeId == employeeId).Include(c => c.Role).Include(c => c.Employee).ToListAsync();
|
||||
if (empRoles.Any())
|
||||
{
|
||||
List<EmployeeRolesVM> roles = new List<EmployeeRolesVM>();
|
||||
@ -220,7 +220,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
// Create Employee record if missing
|
||||
//Employee newEmployee = GetNewEmployeeModel(model, TenantId, existingUser.Id);
|
||||
//_context.Employees.Add(newEmployee);
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("You cannot use this email", "You cannot use this email", 400));
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Email already exist", "Email already exist", 400));
|
||||
}
|
||||
|
||||
|
||||
@ -276,8 +276,8 @@ namespace MarcoBMS.Services.Controllers
|
||||
}
|
||||
return Ok(ApiResponse<object>.SuccessResponse("Success.",responsemessage, 200));
|
||||
}
|
||||
|
||||
private static Employee GetNewEmployeeModel(CreateUserDto model, int TenantId, string? ApplicationUserId)
|
||||
#nullable disable
|
||||
private static Employee GetNewEmployeeModel(CreateUserDto model, int TenantId, string ApplicationUserId)
|
||||
{
|
||||
var newEmployee = new Employee
|
||||
{
|
||||
@ -304,7 +304,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
return newEmployee;
|
||||
}
|
||||
|
||||
private static Employee GetUpdateEmployeeModel(CreateUserDto model, Employee existingEmployee, IdentityUser? existingIdentityUser = null)
|
||||
private static Employee GetUpdateEmployeeModel(CreateUserDto model, Employee existingEmployee, IdentityUser existingIdentityUser = null)
|
||||
{
|
||||
if (existingEmployee.ApplicationUserId == null && existingIdentityUser != null)
|
||||
{
|
||||
|
@ -20,6 +20,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
[HttpPost("fileupload")]
|
||||
public async Task<IActionResult> FileUploadDemo([FromForm] DemoEmployeeModel model)
|
||||
{
|
||||
if(model.ImageFile == null) {return BadRequest(ApiResponse<object>.ErrorResponse("Error.", "Error.", 400));}
|
||||
string imageName = await Saveimage(model.ImageFile);
|
||||
return Ok(ApiResponse<object>.SuccessResponse("Success.", "Success.", 200));
|
||||
}
|
||||
@ -71,7 +72,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
public string? EmployeeName { get; set; }
|
||||
public string? Occupation { get; set; }
|
||||
public string? ImageName { get; set; }
|
||||
public string ImageSrc { get; set; }
|
||||
public string? ImageSrc { get; set; }
|
||||
|
||||
public IFormFile? ImageFile { get; set; } // List to handle multiple files
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
@ -9,8 +11,8 @@ using Marco.Pms.Model.ViewModels;
|
||||
using Marco.Pms.Model.ViewModels.Employee;
|
||||
using MarcoBMS.Services.Helpers;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace MarcoBMS.Services.Controllers
|
||||
@ -22,18 +24,18 @@ namespace MarcoBMS.Services.Controllers
|
||||
{
|
||||
//private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly ApplicationDbContext _context;
|
||||
private ApplicationUser _applicationUser;
|
||||
//private ApplicationUser _applicationUser;
|
||||
// private readonly IProjectRepository _projectrepo;
|
||||
private readonly UserManager<IdentityUser> _userManager;
|
||||
//private readonly UserManager<IdentityUser> _userManager;
|
||||
private readonly UserHelper _userHelper;
|
||||
|
||||
|
||||
public ProjectController(UserManager<IdentityUser> userManager, ApplicationDbContext context, UserHelper userHelper)
|
||||
public ProjectController(ApplicationDbContext context, UserHelper userHelper)
|
||||
{
|
||||
//_unitOfWork = unitOfWork;
|
||||
_context = context;
|
||||
//_projectrepo = projectrepo;
|
||||
_userManager = userManager;
|
||||
//_userManager = userManager;
|
||||
_userHelper = userHelper;
|
||||
}
|
||||
[HttpGet("list")]
|
||||
@ -99,7 +101,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
}
|
||||
|
||||
var project = await _context.Projects.Where(c => c.TenantId == _userHelper.GetTenantId() && c.Id == id).SingleOrDefaultAsync();
|
||||
|
||||
if (project == null) return NotFound(ApiResponse<object>.ErrorResponse("Project not found", "Project not found", 404));
|
||||
return Ok(ApiResponse<object>.SuccessResponse(project, "Success.", 200));
|
||||
}
|
||||
|
||||
@ -129,47 +131,63 @@ namespace MarcoBMS.Services.Controllers
|
||||
{
|
||||
//var project = projects.Where(c => c.Id == id).SingleOrDefault();
|
||||
ProjectDetailsVM vm = await GetProjectViewModel(id, project);
|
||||
|
||||
|
||||
ProjectVM projectVM = new ProjectVM();
|
||||
projectVM.Id = vm.project.Id;
|
||||
projectVM.Name = vm.project.Name;
|
||||
projectVM.ProjectAddress = vm.project.ProjectAddress;
|
||||
projectVM.ContactPerson = vm.project.ContactPerson;
|
||||
projectVM.StartDate = vm.project.StartDate;
|
||||
projectVM.EndDate = vm.project.EndDate;
|
||||
projectVM.ProjectStatusId = vm.project.ProjectStatusId;
|
||||
if (vm.project != null) {
|
||||
projectVM.Id = vm.project.Id;
|
||||
projectVM.Name = vm.project.Name;
|
||||
projectVM.ProjectAddress = vm.project.ProjectAddress;
|
||||
projectVM.ContactPerson = vm.project.ContactPerson;
|
||||
projectVM.StartDate = vm.project.StartDate;
|
||||
projectVM.EndDate = vm.project.EndDate;
|
||||
projectVM.ProjectStatusId = vm.project.ProjectStatusId;
|
||||
}
|
||||
projectVM.Buildings = new List<BuildingVM>();
|
||||
foreach (Building build in vm.buildings)
|
||||
{
|
||||
BuildingVM buildVM = new BuildingVM() { Id = build.Id, Description = build.Description, Name = build.Name };
|
||||
buildVM.Floors = new List<FloorsVM>();
|
||||
foreach (Floor floorDto in vm.floors.Where(c => c.BuildingId == build.Id).ToList())
|
||||
if (vm.buildings != null) {
|
||||
foreach (Building build in vm.buildings)
|
||||
{
|
||||
FloorsVM floorVM = new FloorsVM() { FloorName = floorDto.FloorName, Id = floorDto.Id };
|
||||
floorVM.WorkAreas = new List<WorkAreaVM>();
|
||||
|
||||
foreach (WorkArea workAreaDto in vm.workAreas.Where(c => c.FloorId == floorVM.Id).ToList())
|
||||
BuildingVM buildVM = new BuildingVM() { Id = build.Id, Description = build.Description, Name = build.Name };
|
||||
buildVM.Floors = new List<FloorsVM>();
|
||||
if (vm.floors != null)
|
||||
{
|
||||
WorkAreaVM workAreaVM = new WorkAreaVM() { Id = workAreaDto.Id, AreaName = workAreaDto.AreaName, WorkItems = new List<WorkItemVM>() };
|
||||
|
||||
foreach (WorkItem workItemDto in vm.workItems.Where(c => c.WorkAreaId == workAreaDto.Id).ToList())
|
||||
foreach (Floor floorDto in vm.floors.Where(c => c.BuildingId == build.Id).ToList())
|
||||
{
|
||||
WorkItemVM workItemVM = new WorkItemVM() { WorkItemId = workItemDto.Id, WorkItem = workItemDto };
|
||||
workItemVM.WorkItem.WorkArea = null;
|
||||
workItemVM.WorkItem.ActivityMaster.Tenant = null;
|
||||
workItemVM.WorkItem.Tenant = null;
|
||||
FloorsVM floorVM = new FloorsVM() { FloorName = floorDto.FloorName, Id = floorDto.Id };
|
||||
floorVM.WorkAreas = new List<WorkAreaVM>();
|
||||
|
||||
if (vm.workAreas != null)
|
||||
{
|
||||
foreach (WorkArea workAreaDto in vm.workAreas.Where(c => c.FloorId == floorVM.Id).ToList())
|
||||
{
|
||||
WorkAreaVM workAreaVM = new WorkAreaVM() { Id = workAreaDto.Id, AreaName = workAreaDto.AreaName, WorkItems = new List<WorkItemVM>() };
|
||||
|
||||
if(vm.workItems != null)
|
||||
{
|
||||
foreach (WorkItem workItemDto in vm.workItems.Where(c => c.WorkAreaId == workAreaDto.Id).ToList())
|
||||
{
|
||||
WorkItemVM workItemVM = new WorkItemVM() { WorkItemId = workItemDto.Id, WorkItem = workItemDto };
|
||||
//workItemVM.WorkItem.WorkArea = null
|
||||
workItemVM.WorkItem.WorkArea = new WorkArea();
|
||||
//workItemVM.WorkItem.ActivityMaster.Tenant = null;
|
||||
workItemVM.WorkItem.ActivityMaster.Tenant = new Tenant();
|
||||
//workItemVM.WorkItem.Tenant = null;
|
||||
workItemVM.WorkItem.Tenant = new Tenant();
|
||||
|
||||
|
||||
|
||||
workAreaVM.WorkItems.Add(workItemVM);
|
||||
workAreaVM.WorkItems.Add(workItemVM);
|
||||
}
|
||||
}
|
||||
|
||||
floorVM.WorkAreas.Add(workAreaVM);
|
||||
}
|
||||
}
|
||||
|
||||
buildVM.Floors.Add(floorVM);
|
||||
}
|
||||
|
||||
floorVM.WorkAreas.Add(workAreaVM);
|
||||
}
|
||||
|
||||
buildVM.Floors.Add(floorVM);
|
||||
projectVM.Buildings.Add(buildVM);
|
||||
}
|
||||
projectVM.Buildings.Add(buildVM);
|
||||
}
|
||||
return Ok(ApiResponse<object>.SuccessResponse(projectVM, "Success.", 200));
|
||||
}
|
||||
@ -314,7 +332,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
|
||||
[HttpGet]
|
||||
[Route("employees/get/{projectid?}/{includeInactive?}")]
|
||||
public async Task<IActionResult> GetEmployeeByProjectID(int? projectid, bool? includeInactive = false)
|
||||
public async Task<IActionResult> GetEmployeeByProjectID(int? projectid, bool includeInactive = false)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
@ -403,13 +421,14 @@ namespace MarcoBMS.Services.Controllers
|
||||
if (projectAllocationDot != null)
|
||||
{
|
||||
int TenentID = GetTenantId();
|
||||
List<object>? result = new List<object>();
|
||||
|
||||
foreach (var item in projectAllocationDot)
|
||||
{
|
||||
try
|
||||
{
|
||||
ProjectAllocation projectAllocation = item.ToProjectAllocationFromProjectAllocationDto(TenentID);
|
||||
ProjectAllocation projectAllocationFromDb = await _context.ProjectAllocations.Where(c => c.EmployeeId == projectAllocation.EmployeeId
|
||||
ProjectAllocation? projectAllocationFromDb = await _context.ProjectAllocations.Where(c => c.EmployeeId == projectAllocation.EmployeeId
|
||||
&& c.ProjectId == projectAllocation.ProjectId
|
||||
&& c.ReAllocationDate == null
|
||||
&& c.TenantId == TenentID).SingleOrDefaultAsync();
|
||||
@ -433,7 +452,18 @@ namespace MarcoBMS.Services.Controllers
|
||||
_context.Entry(projectAllocationFromDb).Property(e => e.IsActive).IsModified = true;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var result1 = new
|
||||
{
|
||||
Id = projectAllocationFromDb.Id,
|
||||
EmployeeId = projectAllocation.EmployeeId,
|
||||
JobRoleId = projectAllocation.JobRoleId,
|
||||
IsActive = projectAllocation.IsActive,
|
||||
ProjectId = projectAllocation.ProjectId,
|
||||
AllocationDate = projectAllocation.AllocationDate,
|
||||
ReAllocationDate = projectAllocation.ReAllocationDate,
|
||||
TenantId = projectAllocation.TenantId
|
||||
};
|
||||
result.Add(result1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -448,7 +478,8 @@ namespace MarcoBMS.Services.Controllers
|
||||
return Ok(ApiResponse<object>.ErrorResponse(ex.Message,ex, 400));
|
||||
}
|
||||
}
|
||||
return Ok(ApiResponse<object>.SuccessResponse(null, "Data saved successfully.", 200));
|
||||
|
||||
return Ok(ApiResponse<object>.SuccessResponse(result, "Data saved successfully", 200));
|
||||
|
||||
}
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Invalid details.", "Work Item Details are not valid." , 400));
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Azure;
|
||||
using System.Data;
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Dtos.Roles;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
@ -10,9 +10,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Data;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
#nullable disable
|
||||
namespace MarcoBMS.Services.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
|
@ -67,14 +67,18 @@ namespace MarcoBMS.Services.Controllers
|
||||
var response = taskAllocation.ToAssignTaskVMFromTaskAllocation();
|
||||
|
||||
var teamMembers = new List<TaskMembers> { };
|
||||
foreach (var teamMember in assignTask.TaskTeam) {
|
||||
var result = new TaskMembers
|
||||
if (assignTask.TaskTeam != null)
|
||||
{
|
||||
foreach (var teamMember in assignTask.TaskTeam)
|
||||
{
|
||||
TaskAllocationId = taskAllocation.Id,
|
||||
EmployeeId = teamMember,
|
||||
TenantId = tenantId,
|
||||
};
|
||||
teamMembers.Add(result);
|
||||
var result = new TaskMembers
|
||||
{
|
||||
TaskAllocationId = taskAllocation.Id,
|
||||
EmployeeId = teamMember,
|
||||
TenantId = tenantId,
|
||||
};
|
||||
teamMembers.Add(result);
|
||||
}
|
||||
}
|
||||
_context.TaskMembers.AddRange(teamMembers);
|
||||
await _context.SaveChangesAsync();
|
||||
@ -109,13 +113,17 @@ namespace MarcoBMS.Services.Controllers
|
||||
if (taskAllocation == null) {
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("No such task has been allocated.", "No such task has been allocated.", 400));
|
||||
}
|
||||
if(taskAllocation.CompletedTask != 0)
|
||||
if(taskAllocation.WorkItem != null)
|
||||
{
|
||||
taskAllocation.WorkItem.CompletedWork -= taskAllocation.CompletedTask;
|
||||
if (taskAllocation.CompletedTask != 0)
|
||||
{
|
||||
taskAllocation.WorkItem.CompletedWork -= taskAllocation.CompletedTask;
|
||||
}
|
||||
taskAllocation.ReportedDate = reportTask.ReportedDate;
|
||||
taskAllocation.CompletedTask = reportTask.CompletedTask;
|
||||
taskAllocation.WorkItem.CompletedWork += reportTask.CompletedTask;
|
||||
}
|
||||
taskAllocation.ReportedDate = reportTask.ReportedDate;
|
||||
taskAllocation.CompletedTask = reportTask.CompletedTask;
|
||||
taskAllocation.WorkItem.CompletedWork += reportTask.CompletedTask;
|
||||
|
||||
|
||||
var comment = reportTask.ToCommentFromReportTaskDto(tenantId,Employee.Id);
|
||||
|
||||
|
@ -3,18 +3,19 @@ using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Mapper;
|
||||
using Marco.Pms.Model.ViewModels.Employee;
|
||||
using MarcoBMS.Services.Service;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Intrinsics.Arm;
|
||||
|
||||
namespace MarcoBMS.Services.Helpers
|
||||
{
|
||||
public class EmployeeHelper
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
public EmployeeHelper(ApplicationDbContext context)
|
||||
private readonly ILoggingService _logger;
|
||||
public EmployeeHelper(ApplicationDbContext context, ILoggingService logger)
|
||||
{
|
||||
_context = context;
|
||||
_logger = logger;
|
||||
}
|
||||
public async Task<Employee> GetEmployeeByID(int EmployeeID)
|
||||
{
|
||||
@ -28,11 +29,12 @@ namespace MarcoBMS.Services.Helpers
|
||||
{
|
||||
var result = await _context.Employees.Where(c => c.ApplicationUserId == ApplicationUserID).ToListAsync();
|
||||
|
||||
return await _context.Employees.Where(c => c.ApplicationUserId == ApplicationUserID).SingleOrDefaultAsync();
|
||||
return await _context.Employees.Where(c => c.ApplicationUserId == ApplicationUserID).SingleOrDefaultAsync() ?? new Employee { };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
_logger.LogError("{Error}", ex.Message);
|
||||
return new Employee();
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,6 +66,7 @@ namespace MarcoBMS.Services.Helpers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("{Error}", ex.Message);
|
||||
return new List<EmployeeVM>();
|
||||
}
|
||||
}
|
||||
@ -94,6 +97,7 @@ namespace MarcoBMS.Services.Helpers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("{Error}", ex.Message);
|
||||
return new List<EmployeeVM>();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Dtos.Employees;
|
||||
using System.Security.Claims;
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace MarcoBMS.Services.Helpers
|
||||
{
|
||||
@ -39,8 +37,9 @@ namespace MarcoBMS.Services.Helpers
|
||||
public async Task<Employee> GetCurrentEmployeeAsync()
|
||||
{
|
||||
var user = await GetCurrentUserAsync();
|
||||
if (user == null) return new Employee { };
|
||||
var Employee = await _context.Employees.FirstOrDefaultAsync(e => e.ApplicationUserId == user.Id);
|
||||
return Employee;
|
||||
return Employee ?? new Employee { };
|
||||
}
|
||||
|
||||
public async Task<object?> GetCurrentUserProfileAsync()
|
||||
@ -58,16 +57,7 @@ namespace MarcoBMS.Services.Helpers
|
||||
|
||||
public async Task<IdentityUser?> GetRegisteredUser(string email)
|
||||
{
|
||||
//IdentityUser? user = await _userManager.Users
|
||||
// .FirstOrDefaultAsync(u => u.Email == model.Email || u.PhoneNumber == model.PhoneNumber);
|
||||
|
||||
|
||||
IdentityUser? user = await _userManager.FindByEmailAsync(email);
|
||||
//if (user == null)
|
||||
//{
|
||||
// user = await _userManager.Find(model.Email);
|
||||
|
||||
//}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
public async Task Invoke(HttpContext context)
|
||||
{
|
||||
if (context.User.Identity.IsAuthenticated)
|
||||
if (context.User.Identity != null && context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
var tenantId = context.User.FindFirst("tenantId")?.Value;
|
||||
if (tenantId == null)
|
||||
|
@ -27,45 +27,33 @@ builder.Host.UseSerilog((context, config) =>
|
||||
#region CORS Settings
|
||||
|
||||
// Add services
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("DevCorsPolicy", policy =>
|
||||
{
|
||||
policy.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader();
|
||||
});
|
||||
});
|
||||
|
||||
//var corsSettings = builder.Configuration.GetSection("Cors");
|
||||
//var allowedOrigins = corsSettings.GetValue<string>("AllowedOrigins")?.Split(',');
|
||||
//var allowedMethods = corsSettings.GetValue<string>("AllowedMethods")?.Split(',');
|
||||
//var allowedHeaders = corsSettings.GetValue<string>("AllowedHeaders")?.Split(',');
|
||||
|
||||
//builder.Services.AddCors(options =>
|
||||
//{
|
||||
// options.AddPolicy("Policy", policy =>
|
||||
// options.AddPolicy("DevCorsPolicy", policy =>
|
||||
// {
|
||||
// if (allowedOrigins != null)
|
||||
// {
|
||||
// policy.WithOrigins(allowedOrigins)
|
||||
// .WithMethods(allowedMethods)
|
||||
// .WithHeaders(allowedHeaders);
|
||||
// }
|
||||
// });
|
||||
// options.AddPolicy("AllowAll", policy =>
|
||||
// {
|
||||
// if (allowedOrigins != null)
|
||||
// {
|
||||
// policy.AllowAnyOrigin()
|
||||
// .AllowAnyMethod()
|
||||
// .AllowAnyHeader();
|
||||
|
||||
// }
|
||||
// policy.AllowAnyOrigin()
|
||||
// .AllowAnyMethod()
|
||||
// .AllowAnyHeader();
|
||||
// });
|
||||
//});
|
||||
|
||||
#endregion
|
||||
var corsSettings = builder.Configuration.GetSection("Cors");
|
||||
var allowedOrigins = corsSettings.GetValue<string>("AllowedOrigins")?.Split(',');
|
||||
var allowedMethods = corsSettings.GetValue<string>("AllowedMethods")?.Split(',');
|
||||
var allowedHeaders = corsSettings.GetValue<string>("AllowedHeaders")?.Split(',');
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("Policy", policy =>
|
||||
{
|
||||
if (allowedOrigins != null && allowedMethods != null && allowedHeaders != null)
|
||||
{
|
||||
policy.WithOrigins(allowedOrigins)
|
||||
.WithMethods(allowedMethods)
|
||||
.WithHeaders(allowedHeaders);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
@ -107,7 +95,7 @@ builder.Services.AddTransient<IEmailSender, EmailSender>();
|
||||
builder.Services.AddIdentity<IdentityUser, IdentityRole>().AddEntityFrameworkStores<ApplicationDbContext>().AddDefaultTokenProviders();
|
||||
|
||||
|
||||
string connString = builder.Configuration.GetConnectionString("DefaultConnectionString");
|
||||
string? connString = builder.Configuration.GetConnectionString("DefaultConnectionString");
|
||||
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
{
|
||||
@ -136,24 +124,27 @@ builder.Services.AddSingleton<ILoggingService, LoggingService>();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
var jwtSettings = builder.Configuration.GetSection("Jwt").Get<JwtSettings>();
|
||||
builder.Services.AddAuthentication(options =>
|
||||
if(jwtSettings != null && jwtSettings.Key != null)
|
||||
{
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
})
|
||||
.AddJwtBearer(options =>
|
||||
{
|
||||
options.TokenValidationParameters = new TokenValidationParameters
|
||||
builder.Services.AddAuthentication(options =>
|
||||
{
|
||||
ValidateIssuer = true,
|
||||
ValidateAudience = true,
|
||||
ValidateLifetime = true,
|
||||
ValidateIssuerSigningKey = true,
|
||||
ValidIssuer = jwtSettings.Issuer,
|
||||
ValidAudience = jwtSettings.Audience,
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSettings.Key))
|
||||
};
|
||||
});
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
})
|
||||
.AddJwtBearer(options =>
|
||||
{
|
||||
options.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
ValidateIssuer = true,
|
||||
ValidateAudience = true,
|
||||
ValidateLifetime = true,
|
||||
ValidateIssuerSigningKey = true,
|
||||
ValidIssuer = jwtSettings.Issuer,
|
||||
ValidAudience = jwtSettings.Audience,
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSettings.Key))
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
builder.Services.AddSingleton(jwtSettings);
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace MarcoBMS.Services.Service
|
||||
{
|
||||
void LogInfo(string? message, params object[]? args);
|
||||
void LogWarning(string? message, params object[]? args);
|
||||
void LogError(Exception? ex, string? message, params object[]? args);
|
||||
void LogError(string? message, params object[]? args);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,23 +11,42 @@ namespace MarcoBMS.Services.Service
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void LogError(Exception? ex, string? message, params object[]? args)
|
||||
public void LogError(string? message, params object[]? args)
|
||||
{
|
||||
using (LogContext.PushProperty("Error", ex))
|
||||
using (LogContext.PushProperty("LogLevel", "Error"))
|
||||
_logger.LogError(message, args);
|
||||
}
|
||||
if (args != null)
|
||||
{
|
||||
_logger.LogError(message, args);
|
||||
}
|
||||
else {
|
||||
_logger.LogError(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogInfo(string? message, params object[]? args)
|
||||
{
|
||||
using (LogContext.PushProperty("LogLevel", "Information"))
|
||||
_logger.LogInformation(message, args);
|
||||
if (args != null)
|
||||
{
|
||||
_logger.LogInformation(message, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogWarning(string? message, params object[]? args)
|
||||
{
|
||||
using (LogContext.PushProperty("LogLevel", "Warning"))
|
||||
_logger.LogWarning(message,args);
|
||||
if (args != null)
|
||||
{
|
||||
_logger.LogWarning(message, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,30 +1,27 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Authentication;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SharpCompress.Common;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
|
||||
#nullable disable
|
||||
namespace MarcoBMS.Services.Service
|
||||
{
|
||||
public class RefreshTokenService
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly IMemoryCache _cache; // For optional JWT blacklisting
|
||||
private readonly ILoggingService _logger;
|
||||
|
||||
|
||||
public RefreshTokenService(ApplicationDbContext context, IMemoryCache cache)
|
||||
public RefreshTokenService(ApplicationDbContext context, IMemoryCache cache, ILoggingService logger)
|
||||
{
|
||||
_context = context;
|
||||
_cache = cache;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string GenerateJwtToken(string username, string tenantId, JwtSettings _jwtSettings)
|
||||
@ -94,13 +91,14 @@ namespace MarcoBMS.Services.Service
|
||||
return strToken;
|
||||
}catch(Exception ex)
|
||||
{
|
||||
_logger.LogError("{Error}", ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<RefreshToken> GetRefreshToken(string token)
|
||||
{
|
||||
return await _context.RefreshTokens.FirstOrDefaultAsync(rt => rt.Token == token && !rt.IsRevoked && !rt.IsUsed);
|
||||
return await _context.RefreshTokens.FirstOrDefaultAsync(rt => rt.Token == token && !rt.IsRevoked && !rt.IsUsed) ?? new RefreshToken();
|
||||
}
|
||||
|
||||
public async Task MarkRefreshTokenAsUsed(RefreshToken refreshToken)
|
||||
|
@ -10,7 +10,7 @@
|
||||
"Override": {
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
|
||||
"Microsoft.AspNetCore.Mvc.Infrastructure": "Warning",
|
||||
"Microsoft.AspNetCore.Mvc.Infrastructure": "Warning"
|
||||
//"Serilog.AspNetCore.RequestLoggingMiddleware": "Warning"
|
||||
}
|
||||
},
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
"ConnectionStrings": {
|
||||
// "DefaultConnectionString": "Server=103.50.160.45;User ID=marcowvh_admin;Password=Marcoemp@123;Database=marcowvh_empattendanceci",
|
||||
"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2",
|
||||
"DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS2"
|
||||
//"DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS1"
|
||||
},
|
||||
"AppSettings": {
|
||||
|
@ -1,12 +1,4 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Utility
|
||||
namespace Marco.Pms.Utility
|
||||
{
|
||||
public class SessionUtil
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user