diff --git a/Marco.Pms.Model/Directory/Bucket.cs b/Marco.Pms.Model/Directory/Bucket.cs index 0d382c5..028b428 100644 --- a/Marco.Pms.Model/Directory/Bucket.cs +++ b/Marco.Pms.Model/Directory/Bucket.cs @@ -1,5 +1,4 @@ -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Directory { @@ -7,9 +6,6 @@ namespace Marco.Pms.Model.Directory { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; - public Guid CreatedByID { get; set; } - public Employee? CreatedBy { get; set; } - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string Description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Model/Directory/Contact.cs b/Marco.Pms.Model/Directory/Contact.cs index ecdd622..87d7698 100644 --- a/Marco.Pms.Model/Directory/Contact.cs +++ b/Marco.Pms.Model/Directory/Contact.cs @@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Directory public class Contact : TenantRelation { public Guid Id { get; set; } - //public Guid? ProjectId { get; set; } + public Guid? ProjectId { get; set; } public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Organization { get; set; } = string.Empty; diff --git a/Marco.Pms.Model/Directory/ContactTagMapping.cs b/Marco.Pms.Model/Directory/ContactTagMapping.cs index 91c2835..a3d7e9e 100644 --- a/Marco.Pms.Model/Directory/ContactTagMapping.cs +++ b/Marco.Pms.Model/Directory/ContactTagMapping.cs @@ -5,7 +5,7 @@ public Guid Id { get; set; } public Guid ContactId { get; set; } public Contact? Contact { get; set; } - public Guid ContactTagId { get; set; } + public Guid ContactTagtId { get; set; } public ContactTagMaster? ContactTag { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs index 0c02457..ba0918d 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateBucketDto.cs @@ -2,7 +2,7 @@ { public class CreateBucketDto { - public string Name { get; set; } = string.Empty; - public string Description { get; set; } = string.Empty; + public string name { get; set; } = string.Empty; + public string description { get; set; } = string.Empty; } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs index 577f405..42937c0 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactDto.cs @@ -2,15 +2,14 @@ { public class CreateContactDto { - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public List? BucketIds { get; set; } - public Guid? ContactCategoryId { get; set; } + public Guid ContactCategoryId { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? Tags { get; set; } + public List? TagIds { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs index 654890a..e33cdb6 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactEmailDto.cs @@ -4,6 +4,7 @@ { public string? Label { get; set; } public string? EmailAddress { get; set; } + public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs index a72ac3d..dc97881 100644 --- a/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/CreateContactPhoneDto.cs @@ -4,5 +4,6 @@ { public string? Label { get; set; } public string? PhoneNumber { get; set; } + public Guid? ContactId { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs index c648db0..7c93cce 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactDto.cs @@ -3,7 +3,7 @@ public class UpdateContactDto { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } @@ -12,6 +12,6 @@ public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } - public List? Tags { get; set; } + public List? TagIds { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs index 186f5b3..8ece036 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactEmailDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactEmailDto { - public Guid? Id { get; set; } + public Guid Id { get; set; } public string? Label { get; set; } public string? EmailAddress { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs index ff0ec23..1ddfb14 100644 --- a/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs +++ b/Marco.Pms.Model/Dtos/Directory/UpdateContactPhoneDto.cs @@ -2,7 +2,7 @@ { public class UpdateContactPhoneDto { - public Guid? Id { get; set; } + public Guid Id { get; set; } public string? Label { get; set; } public string? PhoneNumber { get; set; } public Guid? ContactId { get; set; } diff --git a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs index 2fec4ae..ad91ca7 100644 --- a/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/CreateContactTagDto.cs @@ -3,6 +3,5 @@ public class CreateContactTagDto { public string? Name { get; set; } - public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs index e97ece6..0406a6c 100644 --- a/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs +++ b/Marco.Pms.Model/Dtos/Master/UpdateContactTagDto.cs @@ -4,6 +4,5 @@ { public Guid Id { get; set; } public string? Name { get; set; } - public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Mapper/DirectoryMapper.cs b/Marco.Pms.Model/Mapper/DirectoryMapper.cs index 4732542..41fa9c5 100644 --- a/Marco.Pms.Model/Mapper/DirectoryMapper.cs +++ b/Marco.Pms.Model/Mapper/DirectoryMapper.cs @@ -8,31 +8,29 @@ namespace Marco.Pms.Model.Mapper { public static class DirectoryMapper { - public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId, Guid employeeId) + public static Contact ToContactFromCreateContactDto(this CreateContactDto createContactDto, Guid tenantId) { return new Contact { + ProjectId = createContactDto.ProjectId, Name = createContactDto.Name ?? string.Empty, ContactCategoryId = createContactDto.ContactCategoryId, Description = createContactDto.Description ?? string.Empty, Organization = createContactDto?.Organization ?? string.Empty, Address = createContactDto != null ? createContactDto.Address : string.Empty, - CreatedById = employeeId, - CreatedAt = DateTime.UtcNow, TenantId = tenantId }; } - public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId, Contact contact) + public static Contact ToContactFromUpdateContactDto(this UpdateContactDto updateContactDto, Guid tenantId) { return new Contact { Id = updateContactDto.Id, + ProjectId = updateContactDto.ProjectId, Name = updateContactDto.Name ?? string.Empty, ContactCategoryId = updateContactDto.ContactCategoryId, - CreatedAt = contact.CreatedAt, - CreatedById = contact.CreatedById, Description = updateContactDto.Description ?? string.Empty, Organization = updateContactDto?.Organization ?? string.Empty, Address = updateContactDto != null ? updateContactDto.Address : string.Empty, @@ -44,27 +42,14 @@ namespace Marco.Pms.Model.Mapper return new ContactVM { Id = contact.Id, + ProjectId = contact.ProjectId, Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, + ContactType = contact.ContactCategory != null ? contact.ContactCategory.ToContactTypeVMFromContactTypeMaster() : new ContactCategoryVM(), Description = contact.Description ?? string.Empty, Organization = contact.Organization ?? string.Empty, Address = contact.Address ?? string.Empty }; } - public static ContactProfileVM ToContactProfileVMFromContact(this Contact contact) - { - return new ContactProfileVM - { - Id = contact.Id, - Name = contact.Name, - ContactCategory = contact.ContactCategory != null ? contact.ContactCategory.ToContactCategoryVMFromContactCategoryMaster() : null, - Description = contact.Description ?? string.Empty, - Organization = contact.Organization ?? string.Empty, - Address = contact.Address ?? string.Empty, - CreatedAt = contact.CreatedAt, - CreatedBy = contact.CreatedBy != null ? contact.CreatedBy.ToBasicEmployeeVMFromEmployee() : null - }; - } //Contact Phone Mapper public static ContactPhone ToContactPhoneFromCreateContactPhoneDto(this CreateContactPhoneDto createContactPhoneDto, Guid tenantId, Guid contactId) @@ -81,7 +66,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactPhone { - Id = updateContactPhoneDto.Id ?? Guid.Empty, + Id = updateContactPhoneDto.Id, Label = updateContactPhoneDto.Label ?? string.Empty, PhoneNumber = updateContactPhoneDto.PhoneNumber ?? string.Empty, ContactId = contactId, @@ -114,7 +99,7 @@ namespace Marco.Pms.Model.Mapper { return new ContactEmail { - Id = updateContactEmailDto.Id ?? Guid.Empty, + Id = updateContactEmailDto.Id, Label = updateContactEmailDto.Label ?? string.Empty, EmailAddress = updateContactEmailDto.EmailAddress ?? string.Empty, ContactId = contactId, @@ -148,7 +133,6 @@ namespace Marco.Pms.Model.Mapper { Id = updateContactTagDto.Id, Name = updateContactTagDto.Name ?? string.Empty, - Description = updateContactTagDto.Description ?? string.Empty, TenantId = tenantId }; } @@ -157,7 +141,6 @@ namespace Marco.Pms.Model.Mapper return new ContactTagVM { Id = contactTag.Id, - Description = contactTag.Description ?? string.Empty, Name = contactTag.Name ?? string.Empty, }; } @@ -191,51 +174,5 @@ namespace Marco.Pms.Model.Mapper Description = contactType.Description ?? string.Empty, }; } - - // Bucket - public static BucketVM ToBucketVMFromBucket(this Bucket bucket) - { - return new BucketVM - { - Id = bucket.Id, - Name = bucket.Name, - Description = bucket.Description, - CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null - }; - } - public static AssignBucketVM ToAssignBucketVMFromBucket(this Bucket bucket) - { - return new AssignBucketVM - { - Id = bucket.Id, - Name = bucket.Name, - Description = bucket.Description, - CreatedBy = bucket.CreatedBy != null ? bucket.CreatedBy.ToBasicEmployeeVMFromEmployee() : null - }; - } - - //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, - CreatedAt = note.CreatedAt, - CreatedBy = note.Createdby != null ? note.Createdby.ToBasicEmployeeVMFromEmployee() : null - }; - } } } diff --git a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs index d394f73..6d6f82e 100644 --- a/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs +++ b/Marco.Pms.Model/ViewModels/Directory/ContactVM.cs @@ -5,12 +5,11 @@ namespace Marco.Pms.Model.ViewModels.Directory public class ContactVM { public Guid Id { get; set; } - public List? ProjectIds { get; set; } + public Guid? ProjectId { get; set; } public string? Name { get; set; } public List? ContactPhones { get; set; } public List? ContactEmails { get; set; } - public ContactCategoryVM? ContactCategory { get; set; } - public List? BucketIds { get; set; } + public ContactCategoryVM? ContactType { get; set; } public string? Description { get; set; } public string? Organization { get; set; } public string? Address { get; set; } diff --git a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs index 321b669..2cb6f8a 100644 --- a/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs +++ b/Marco.Pms.Model/ViewModels/Master/ContactTagVM.cs @@ -4,6 +4,5 @@ { public Guid Id { get; set; } public string? Name { get; set; } - public string? Description { get; set; } } }