diff --git a/ContactAppCore/Api/ContactController.cs b/ContactAppCore/Api/ContactController.cs index 61ad7bc..b58b661 100644 --- a/ContactAppCore/Api/ContactController.cs +++ b/ContactAppCore/Api/ContactController.cs @@ -1,112 +1,100 @@ -using ContactAppCore.Data; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ContactAppCore.Data; using ContactAppCore.Helpers; using ContactAppCore.ViewModel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -namespace ContactAppCore.Api -{ +namespace ContactAppCore.Api { + [Route("api/[controller]")] [ApiController] [AllowAnonymous] - public class ContactController : ControllerBase - { + public class ContactController : ControllerBase { private IContactRepository contactRepository; - public ContactController(IContactRepository contactRepository) - { + public ContactController(IContactRepository contactRepository) { this.contactRepository = contactRepository; } [HttpGet("Area/{id}")] - public async Task GetArea(int id) - { + public async Task GetArea(int id) { var area = await contactRepository.ReadAsync(c => c.Areas.Include(a => a.Offices).Where(o => o.IsActive).SingleOrDefault(o => o.Id == id)); - return new AreaInformation(area, true, false, "", null); + return new AreaInformation(area, true, "", null); } [HttpGet("AreaCode/{id}")] - public async Task GetAreaCode(string id) - { + public async Task GetAreaCode(string id) { var area = await contactRepository.ReadAsync(c => c.Areas.Include(a => a.Offices).Where(a => a.IsActive).SingleOrDefault(a => a.InternalCode == id)); - return new AreaInformation(area, true, false, "", null); + return new AreaInformation(area, true, "", null); } [HttpGet("AreaCode/External/{id}")] - public async Task GetAreaCodeExternal(string id) - { + public async Task GetAreaCodeExternal(string id) { var area = await contactRepository.ReadAsync(c => c.Areas.Include(a => a.Offices).Where(a => a.IsActive && !a.InternalOnly).SingleOrDefault(a => a.InternalCode == id)); - return new AreaInformation(area, false, false, "", null); + return new AreaInformation(area, false, "", null); } [HttpGet("Area/External/{id}")] - public async Task GetAreaExternal(int id) - { + public async Task GetAreaExternal(int id) { var area = await contactRepository.ReadAsync(c => c.Areas.Include(a => a.Offices).Where(o => o.IsActive && !o.InternalOnly).SingleOrDefault(o => o.Id == id)); - return new AreaInformation(area, false, false, "", null); + return new AreaInformation(area, false, "", null); } [HttpGet("Office/{id}")] - public async Task GetOffice(int id) - { + public async Task GetOffice(int id) { var office = await contactRepository.ReadAsync(c => c.Offices.Include(a => a.Area).Where(o => o.IsActive).SingleOrDefault(o => o.Id == id)); return new OfficeInformation(office); } [HttpGet("OfficeCode/{id}")] - public async Task GetOfficeCode(string id) - { + public async Task GetOfficeCode(string id) { var office = await contactRepository.ReadAsync(c => c.Offices.Include(a => a.Area).Where(o => o.IsActive).SingleOrDefault(o => o.InternalCode == id)); return new OfficeInformation(office); } [HttpGet("Search/Areas")] - public async Task> SearchAreas(string search = "", string areafilter = "", string officefilter = "", bool isCovid = false) - { + public async Task> SearchAreas(string search = "", string areafilter = "", string officefilter = "") { var areaType = FilterHelper.TranslateArea(areafilter); var officeType = FilterHelper.TranslateOffice(officefilter); var areas = await contactRepository.ReadAsync(c => c.Areas.Include(a => a.Offices).Where(a => a.IsActive && (search == "" || a.Title.Contains(search) || a.SearchTerms.Contains(search) || a.Audience.Contains(search) || a.Offices.Any(o => o.Title.Contains(search)) || a.Offices.Any(o => o.SearchTerms.Contains(search)) || a.Offices.Any(o => o.Audience.Contains(search))) - && (areaType == null || a.AreaType == areaType) && (a.Offices.Any(o => o.CovidSupport) || !isCovid)) + && (areaType == null || a.AreaType == areaType)) .OrderBy(a => a.InternalOrder).ThenBy(a => a.Title)); - return areas.ToList().Select(a => new AreaInformation(a, true, isCovid, search, officeType)); + return areas.ToList().Select(a => new AreaInformation(a, true, search, officeType)); } [HttpGet("Search/Areas/External")] - public async Task> SearchAreasExternal(string search = "", string areafilter = "", string officefilter = "", bool isCovid = false) - { + public async Task> SearchAreasExternal(string search = "", string areafilter = "", string officefilter = "") { var areaType = FilterHelper.TranslateArea(areafilter); var officeType = FilterHelper.TranslateOffice(officefilter); var areas = await contactRepository.ReadAsync(c => c.Areas.Include(a => a.Offices).Where(a => a.IsActive && !a.InternalOnly && (search == "" || a.Title.Contains(search) || a.SearchTerms.Contains(search) || a.Audience.Contains(search) || a.Offices.Any(o => o.Title.Contains(search)) || a.Offices.Any(o => o.SearchTerms.Contains(search)) || a.Offices.Any(o => o.Audience.Contains(search))) - && (areaType == null || a.AreaType == areaType) && (a.Offices.Any(o => o.CovidSupport) || !isCovid)) + && (areaType == null || a.AreaType == areaType)) .OrderBy(a => a.InternalOrder).ThenBy(a => a.Title)); - return areas.ToList().Select(a => new AreaInformation(a, false, isCovid, search, officeType)); + return areas.ToList().Select(a => new AreaInformation(a, false, search, officeType)); } [HttpGet("Search/Offices")] - public async Task> SearchOffices(string search = "", string areafilter = "", string officefilter = "", bool isCovid = false) - { + public async Task> SearchOffices(string search = "", string areafilter = "", string officefilter = "") { var areaType = FilterHelper.TranslateArea(areafilter); var officeType = FilterHelper.TranslateOffice(officefilter); var offices = await contactRepository.ReadAsync(c => c.Offices.Include(a => a.Area).Where(o => o.IsActive && (search == "" || o.Title.Contains(search) || o.SearchTerms.Contains(search) || o.Audience.Contains(search) || o.Area.Title.Contains(search) || o.Area.SearchTerms.Contains(search) || o.Area.Audience.Contains(search)) && (areaType == null || o.Area.AreaType == areaType) - && (officeType == null || o.OfficeType == officeType) && (o.CovidSupport || !isCovid)) + && (officeType == null || o.OfficeType == officeType)) .OrderBy(o => o.Title)); return offices.ToList().Select(o => new OfficeInformation(o)); } [HttpGet("Search/Offices/ByArea")] - public async Task> SearchOfficesByArea(int areaId, string search = "", string officefilter = "") - { + public async Task> SearchOfficesByArea(int areaId, string search = "", string officefilter = "") { var officeType = FilterHelper.TranslateOffice(officefilter); var offices = await contactRepository.ReadAsync(c => c.Offices.Include(a => a.Area).Where(o => o.IsActive && (search == "" || o.Title.Contains(search) || o.SearchTerms.Contains(search) || o.Audience.Contains(search) || @@ -118,8 +106,7 @@ public async Task> SearchOfficesByArea(int areaId } [HttpGet("Search/Offices/ByAreaCode")] - public async Task> SearchOfficesByArea(string search, string areaCode, string officefilter) - { + public async Task> SearchOfficesByArea(string search, string areaCode, string officefilter) { var officeType = FilterHelper.TranslateOffice(officefilter); var offices = await contactRepository.ReadAsync(c => c.Offices.Include(a => a.Area).Where(o => o.IsActive && (search == "" || o.Title.Contains(search) || o.SearchTerms.Contains(search) || o.Audience.Contains(search) || diff --git a/ContactAppCore/Api/EditOfficeController.cs b/ContactAppCore/Api/EditOfficeController.cs index 834073b..91aad16 100644 --- a/ContactAppCore/Api/EditOfficeController.cs +++ b/ContactAppCore/Api/EditOfficeController.cs @@ -1,47 +1,41 @@ -using ContactAppCore.Data; +using System.Linq; +using System.Threading.Tasks; +using ContactAppCore.Data; using ContactAppCore.Data.Models; using ContactAppCore.Helpers; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using System.Linq; -using System.Threading.Tasks; // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -namespace ContactAppCore.Api -{ +namespace ContactAppCore.Api { + [Route("api/[controller]")] [ApiController] - public class EditOfficeController : ControllerBase - { + public class EditOfficeController : ControllerBase { private IContactRepository contactRepository; private SecurityHelper securityHelper; - public EditOfficeController(IContactRepository contactRepository, SecurityHelper securityHelper) - { + public EditOfficeController(IContactRepository contactRepository, SecurityHelper securityHelper) { this.contactRepository = contactRepository; this.securityHelper = securityHelper; } [HttpGet("{id}")] - public async Task Get(int id) - { - if (!securityHelper.AllowOffice(User, id)) - { + public async Task Get(int id) { + if (!securityHelper.AllowOffice(User, id)) { return default; } return await contactRepository.ReadAsync(c => c.Offices.Include(o => o.Area).SingleOrDefault(o => o.Id == id)); } [HttpPost("Update")] - public async Task Update([FromBody] dynamic json) - { - var jsonObject = (dynamic)JObject.Parse(json.ToString()); + public async Task Update([FromBody] dynamic json) { + var jsonObject = (dynamic) JObject.Parse(json.ToString()); int id = int.Parse(jsonObject.id.ToString()); - if (!securityHelper.AllowOffice(User, id)) - { + if (!securityHelper.AllowOffice(User, id)) { return default; } @@ -49,8 +43,7 @@ public async Task Update([FromBody] dynamic json) var isAreaAdmin = securityHelper.AllowArea(User, originalObject.AreaId); await LogHelper.CreateLog(contactRepository, "Editing Area " + originalObject.AreaId.ToString(), User.Identity.Name, JsonConvert.SerializeObject(originalObject), json.ToString()); - return await contactRepository.UpdateAsync(new Office - { + return await contactRepository.UpdateAsync(new Office { Id = id, AreaId = originalObject.AreaId, Title = jsonObject.title, @@ -89,8 +82,7 @@ public async Task Update([FromBody] dynamic json) InternalCode = jsonObject.internalcode, InternalOrder = isAreaAdmin ? jsonObject.internalorder : originalObject.InternalOrder, IsActive = JsonHelper.TranslateBoolean(jsonObject.isactive), - InternalOnly = isAreaAdmin ? JsonHelper.TranslateBoolean(jsonObject.internalonly) : originalObject.InternalOnly, - CovidSupport = JsonHelper.TranslateBoolean(jsonObject.covidsupport) + InternalOnly = isAreaAdmin ? JsonHelper.TranslateBoolean(jsonObject.internalonly) : originalObject.InternalOnly }); } } diff --git a/ContactAppCore/Data/Models/Office.cs b/ContactAppCore/Data/Models/Office.cs index 6c5a09d..f040b04 100644 --- a/ContactAppCore/Data/Models/Office.cs +++ b/ContactAppCore/Data/Models/Office.cs @@ -46,8 +46,6 @@ public Office(string title, int areaId) { public string City { get; set; } - public bool CovidSupport { get; set; } - public string Email { get; set; } public string ExternalUrl { get; set; } diff --git a/ContactAppCore/Migrations/20231107155125_RemoveCovid.Designer.cs b/ContactAppCore/Migrations/20231107155125_RemoveCovid.Designer.cs new file mode 100644 index 0000000..500776e --- /dev/null +++ b/ContactAppCore/Migrations/20231107155125_RemoveCovid.Designer.cs @@ -0,0 +1,687 @@ +// +using System; +using ContactAppCore.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace ContactAppCore.Migrations +{ + [DbContext(typeof(ContactContext))] + [Migration("20231107155125_RemoveCovid")] + partial class RemoveCovid + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.8") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("ContactAppCore.Data.Models.Area", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AllowBeta") + .HasColumnType("bit"); + + b.Property("AllowPeople") + .HasColumnType("bit"); + + b.Property("AreaType") + .HasColumnType("int"); + + b.Property("Audience") + .HasColumnType("nvarchar(max)"); + + b.Property("ExternalUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("InternalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("InternalNotes") + .HasColumnType("nvarchar(max)"); + + b.Property("InternalOnly") + .HasColumnType("bit"); + + b.Property("InternalOrder") + .HasColumnType("int"); + + b.Property("InternalUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("PeopleRefreshUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("PictureHeight") + .HasColumnType("int"); + + b.Property("PictureHeightMinimum") + .HasColumnType("int"); + + b.Property("PictureWidth") + .HasColumnType("int"); + + b.Property("PictureWidthMinimum") + .HasColumnType("int"); + + b.Property("SearchTerms") + .HasColumnType("nvarchar(max)"); + + b.Property("SignatureExtension") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Areas"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.EmployeeActivity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EmployeeProfileId") + .HasColumnType("int"); + + b.Property("InternalOrder") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.Property("YearEnded") + .HasColumnType("nvarchar(max)"); + + b.Property("YearStarted") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeProfileId"); + + b.ToTable("EmployeeActivities"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.EmployeeLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("EmployeeProfileId") + .HasColumnType("int"); + + b.Property("InternalOrder") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeProfileId"); + + b.ToTable("EmployeeLinks"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.EmployeeProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Biography") + .HasColumnType("nvarchar(max)"); + + b.Property("CVUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsInExperts") + .HasColumnType("bit"); + + b.Property("IsPhoneHidden") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("ListedNameFirst") + .HasColumnType("nvarchar(max)"); + + b.Property("ListedNameLast") + .HasColumnType("nvarchar(max)"); + + b.Property("OfficeInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("PhotoUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("PreferredName") + .HasColumnType("nvarchar(max)"); + + b.Property("PreferredNameLast") + .HasColumnType("nvarchar(max)"); + + b.Property("PreferredPronouns") + .HasColumnType("nvarchar(max)"); + + b.Property("PrimaryProfile") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("EmployeeProfiles"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.ExternalLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AreaId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("OfficeId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("ExternalLinks"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.JobProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Biography") + .HasColumnType("nvarchar(max)"); + + b.Property("Category") + .HasColumnType("nvarchar(max)"); + + b.Property("EmployeeProfileId") + .HasColumnType("int"); + + b.Property("InternalOrder") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("OfficeId") + .HasColumnType("int"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeProfileId"); + + b.HasIndex("OfficeId"); + + b.ToTable("JobProfiles"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.JobProfileTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("JobProfileId") + .HasColumnType("int"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("JobProfileId"); + + b.ToTable("JobProfileTags"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Log", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NetId") + .HasColumnType("nvarchar(max)"); + + b.Property("NewData") + .HasColumnType("nvarchar(max)"); + + b.Property("OldData") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Logs"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Office", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Address") + .HasColumnType("nvarchar(max)"); + + b.Property("AreaId") + .HasColumnType("int"); + + b.Property("Audience") + .HasColumnType("nvarchar(max)"); + + b.Property("Building") + .HasColumnType("nvarchar(max)"); + + b.Property("BuildingCode") + .HasColumnType("nvarchar(max)"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("ExternalUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursFridayEnd") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursFridayStart") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursIncludeHolidayMessage") + .HasColumnType("bit"); + + b.Property("HoursMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursMondayEnd") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursMondayStart") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursSaturdayEnd") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursSaturdayStart") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursSundayEnd") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursSundayStart") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursThursdayEnd") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursThursdayStart") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursTuesdayEnd") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursTuesdayStart") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursWednesdayEnd") + .HasColumnType("nvarchar(max)"); + + b.Property("HoursWednesdayStart") + .HasColumnType("nvarchar(max)"); + + b.Property("InternalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("InternalNotes") + .HasColumnType("nvarchar(max)"); + + b.Property("InternalOnly") + .HasColumnType("bit"); + + b.Property("InternalOrder") + .HasColumnType("int"); + + b.Property("InternalUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("OfficeType") + .HasColumnType("int"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Room") + .HasColumnType("nvarchar(max)"); + + b.Property("SearchTerms") + .HasColumnType("nvarchar(max)"); + + b.Property("TicketUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("ZipCode") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AreaId"); + + b.ToTable("Offices"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AreaId") + .HasColumnType("int"); + + b.Property("CanEditAllPeopleInUnit") + .HasColumnType("bit"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsFullAdmin") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("OfficeId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AreaId"); + + b.HasIndex("OfficeId"); + + b.ToTable("People"); + + b.HasData( + new + { + Id = -1, + CanEditAllPeopleInUnit = false, + IsActive = true, + IsFullAdmin = true, + LastUpdated = new DateTime(2023, 11, 7, 9, 51, 24, 548, DateTimeKind.Local).AddTicks(7065), + Title = "jonker@illinois.edu" + }, + new + { + Id = -2, + CanEditAllPeopleInUnit = false, + IsActive = true, + IsFullAdmin = true, + LastUpdated = new DateTime(2023, 11, 7, 9, 51, 24, 553, DateTimeKind.Local).AddTicks(5769), + Title = "rbwatson@illinois.edu" + }); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("OfficeId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("OfficeId"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.EmployeeActivity", b => + { + b.HasOne("ContactAppCore.Data.Models.EmployeeProfile", "EmployeeProfile") + .WithMany("EmployeeActivities") + .HasForeignKey("EmployeeProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EmployeeProfile"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.EmployeeLink", b => + { + b.HasOne("ContactAppCore.Data.Models.EmployeeProfile", null) + .WithMany("EmployeeLinks") + .HasForeignKey("EmployeeProfileId"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.JobProfile", b => + { + b.HasOne("ContactAppCore.Data.Models.EmployeeProfile", "EmployeeProfile") + .WithMany("Jobs") + .HasForeignKey("EmployeeProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ContactAppCore.Data.Models.Office", "Office") + .WithMany("JobProfiles") + .HasForeignKey("OfficeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EmployeeProfile"); + + b.Navigation("Office"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.JobProfileTag", b => + { + b.HasOne("ContactAppCore.Data.Models.JobProfile", null) + .WithMany("Tags") + .HasForeignKey("JobProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Office", b => + { + b.HasOne("ContactAppCore.Data.Models.Area", "Area") + .WithMany("Offices") + .HasForeignKey("AreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Area"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Person", b => + { + b.HasOne("ContactAppCore.Data.Models.Area", null) + .WithMany("Admins") + .HasForeignKey("AreaId"); + + b.HasOne("ContactAppCore.Data.Models.Office", null) + .WithMany("Admins") + .HasForeignKey("OfficeId"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Tag", b => + { + b.HasOne("ContactAppCore.Data.Models.Office", null) + .WithMany("Tags") + .HasForeignKey("OfficeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Area", b => + { + b.Navigation("Admins"); + + b.Navigation("Offices"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.EmployeeProfile", b => + { + b.Navigation("EmployeeActivities"); + + b.Navigation("EmployeeLinks"); + + b.Navigation("Jobs"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.JobProfile", b => + { + b.Navigation("Tags"); + }); + + modelBuilder.Entity("ContactAppCore.Data.Models.Office", b => + { + b.Navigation("Admins"); + + b.Navigation("JobProfiles"); + + b.Navigation("Tags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ContactAppCore/Migrations/20231107155125_RemoveCovid.cs b/ContactAppCore/Migrations/20231107155125_RemoveCovid.cs new file mode 100644 index 0000000..6c0d113 --- /dev/null +++ b/ContactAppCore/Migrations/20231107155125_RemoveCovid.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ContactAppCore.Migrations +{ + public partial class RemoveCovid : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CovidSupport", + table: "Offices"); + + migrationBuilder.UpdateData( + table: "People", + keyColumn: "Id", + keyValue: -2, + column: "LastUpdated", + value: new DateTime(2023, 11, 7, 9, 51, 24, 553, DateTimeKind.Local).AddTicks(5769)); + + migrationBuilder.UpdateData( + table: "People", + keyColumn: "Id", + keyValue: -1, + column: "LastUpdated", + value: new DateTime(2023, 11, 7, 9, 51, 24, 548, DateTimeKind.Local).AddTicks(7065)); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CovidSupport", + table: "Offices", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.UpdateData( + table: "People", + keyColumn: "Id", + keyValue: -2, + column: "LastUpdated", + value: new DateTime(2023, 10, 19, 9, 30, 30, 35, DateTimeKind.Local).AddTicks(1398)); + + migrationBuilder.UpdateData( + table: "People", + keyColumn: "Id", + keyValue: -1, + column: "LastUpdated", + value: new DateTime(2023, 10, 19, 9, 30, 30, 30, DateTimeKind.Local).AddTicks(1133)); + } + } +} diff --git a/ContactAppCore/Migrations/ContactContextModelSnapshot.cs b/ContactAppCore/Migrations/ContactContextModelSnapshot.cs index aa5c92a..b7c4201 100644 --- a/ContactAppCore/Migrations/ContactContextModelSnapshot.cs +++ b/ContactAppCore/Migrations/ContactContextModelSnapshot.cs @@ -384,9 +384,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("City") .HasColumnType("nvarchar(max)"); - b.Property("CovidSupport") - .HasColumnType("bit"); - b.Property("Email") .HasColumnType("nvarchar(max)"); @@ -536,7 +533,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) CanEditAllPeopleInUnit = false, IsActive = true, IsFullAdmin = true, - LastUpdated = new DateTime(2023, 10, 19, 9, 30, 30, 30, DateTimeKind.Local).AddTicks(1133), + LastUpdated = new DateTime(2023, 11, 7, 9, 51, 24, 548, DateTimeKind.Local).AddTicks(7065), Title = "jonker@illinois.edu" }, new @@ -545,7 +542,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) CanEditAllPeopleInUnit = false, IsActive = true, IsFullAdmin = true, - LastUpdated = new DateTime(2023, 10, 19, 9, 30, 30, 35, DateTimeKind.Local).AddTicks(1398), + LastUpdated = new DateTime(2023, 11, 7, 9, 51, 24, 553, DateTimeKind.Local).AddTicks(5769), Title = "rbwatson@illinois.edu" }); }); diff --git a/ContactAppCore/Pages/OfficeEdit.cshtml b/ContactAppCore/Pages/OfficeEdit.cshtml index 3b2b28b..5d95e11 100644 --- a/ContactAppCore/Pages/OfficeEdit.cshtml +++ b/ContactAppCore/Pages/OfficeEdit.cshtml @@ -69,8 +69,6 @@

More Information

-
-
Check this box if your support team/help desk is able and willing to help faculty and staff upload their COVID-19 Vaccine records to the MyMcKinley Health Portal.
General Notes:
@@ -240,7 +238,6 @@ } document.getElementById('searchterms').value = data.searchTerms; document.getElementById('isactive').checked = data.isActive; - document.getElementById('covidsupport').checked = data.covidSupport; document.getElementById('internalcode').value = data.internalCode; document.getElementById('internalnotes').value = data.internalNotes; document.getElementById('internalorder').value = data.internalOrder; diff --git a/ContactAppCore/Pages/Shared/_Layout.cshtml b/ContactAppCore/Pages/Shared/_Layout.cshtml index 8241285..e31465c 100644 --- a/ContactAppCore/Pages/Shared/_Layout.cshtml +++ b/ContactAppCore/Pages/Shared/_Layout.cshtml @@ -64,7 +64,6 @@

Weekdays: 8:00 a.m. – 9:00 p.m.
Weekends: 12:00 p.m. – 5:00 p.m.

-

Due to precautions for COVID-19, in-person support is available by appointment only.

diff --git a/ContactAppCore/ViewModel/AreaInformation.cs b/ContactAppCore/ViewModel/AreaInformation.cs index aea0d08..b656ce7 100644 --- a/ContactAppCore/ViewModel/AreaInformation.cs +++ b/ContactAppCore/ViewModel/AreaInformation.cs @@ -1,13 +1,12 @@ -using ContactAppCore.Data.Models; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using ContactAppCore.Data.Models; -namespace ContactAppCore.ViewModel -{ - public class AreaInformation - { - public AreaInformation(Area area, bool useInternal, bool isCovid, string search, OfficeTypeEnum? officeType) - { +namespace ContactAppCore.ViewModel { + + public class AreaInformation { + + public AreaInformation(Area area, bool useInternal, string search, OfficeTypeEnum? officeType) { AreaType = area.AreaType == AreaTypeEnum.NotListed ? "" : area.AreaType.ToString(); Audience = area.Audience; ExternalUrl = area.ExternalUrl; @@ -18,22 +17,14 @@ public AreaInformation(Area area, bool useInternal, bool isCovid, string search, Title = area.Title; var officeGroup = area.Offices == null ? new List() : area.Offices.Where(o => o.IsActive); - if (!useInternal) - { + if (!useInternal) { officeGroup = officeGroup.Where(o => !o.InternalOnly); } - if (isCovid) - { - officeGroup = officeGroup.Where(o => o.CovidSupport); - } - if (officeType != null) - { + if (officeType != null) { officeGroup = officeGroup.Where(o => o.OfficeType == officeType); } - if (!string.IsNullOrEmpty(search)) - { - if (officeGroup.Any(o => (o.Title ?? "").Contains(search) || (o.SearchTerms ?? "").Contains(search) || (o.Audience ?? "").Contains(search))) - { + if (!string.IsNullOrEmpty(search)) { + if (officeGroup.Any(o => (o.Title ?? "").Contains(search) || (o.SearchTerms ?? "").Contains(search) || (o.Audience ?? "").Contains(search))) { officeGroup = officeGroup.Where(o => (o.Title ?? "").Contains(search) || (o.SearchTerms ?? "").Contains(search) || (o.Audience ?? "").Contains(search)); } } diff --git a/ContactAppCore/ViewModel/OfficeInformation.cs b/ContactAppCore/ViewModel/OfficeInformation.cs index 6fd55a8..eeaf523 100644 --- a/ContactAppCore/ViewModel/OfficeInformation.cs +++ b/ContactAppCore/ViewModel/OfficeInformation.cs @@ -27,7 +27,6 @@ public OfficeInformation(Office office) { Building = office.Building; BuildingUrl = string.IsNullOrWhiteSpace(office.BuildingCode) ? string.Empty : "https://map.illinois.edu/view?ACTION=MAP&buildingId=" + office.BuildingCode; City = office.City; - CovidSupport = office.CovidSupport; Email = office.Email; ExternalUrl = office.ExternalUrl; Id = office.Id; @@ -107,8 +106,6 @@ public OfficeInformation(Office office) { public string City { get; set; } - public bool CovidSupport { get; set; } - public string Email { get; set; } public string ExternalUrl { get; set; }