Skip to content

Commit

Permalink
Fixes, still WIP to get identity and navigation all working.
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Nov 10, 2023
1 parent 0059e1c commit b3ffdc0
Show file tree
Hide file tree
Showing 30 changed files with 153 additions and 3,914 deletions.
4 changes: 2 additions & 2 deletions TalentBlazor.ServiceInterface/TalentServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ JobApplicationEvent CreateEvent(JobApplicationStatus status)
var userId = this.GetSession().UserAuthId;
return new JobApplicationEvent
{
AppUserId = userId.ToInt(),
ApplicationUserId = userId,
Status = status,
Description = status.ToDescription(),
EventDate = DateTime.UtcNow,
Expand Down Expand Up @@ -73,7 +73,7 @@ public object Post(CreateJobOffer request)
{
var jobApp = Db.SingleById<JobApplication>(request.JobApplicationId);
jobApp.JobOffer = request.ConvertTo<JobOffer>().WithAudit(Request);
jobApp.JobOffer.AppUserId = GetSession().UserAuthId.ToInt();
jobApp.JobOffer.ApplicationUserId = GetSession().UserAuthId;
jobApp.Events ??= new();
if (jobApp.ApplicationStatus != request.ApplicationStatus)
jobApp.Events.Add(CreateEvent(request.ApplicationStatus));
Expand Down
82 changes: 9 additions & 73 deletions TalentBlazor.ServiceModel/AppUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,85 +4,21 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Microsoft.AspNetCore.Identity;

Check failure on line 7 in TalentBlazor.ServiceModel/AppUser.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Check failure on line 7 in TalentBlazor.ServiceModel/AppUser.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

namespace TalentBlazor.ServiceModel;

[Icon(Svg = Icons.AppUser)]
public class AppUser : IUserAuth
[Alias("AspNetUsers")]
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser

Check failure on line 14 in TalentBlazor.ServiceModel/AppUser.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 14 in TalentBlazor.ServiceModel/AppUser.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'IdentityUser' could not be found (are you missing a using directive or an assembly reference?)
{
[AutoIncrement]
public int Id { get; set; }
public string DisplayName { get; set; }

[Index]
[Format(FormatMethods.LinkEmail)]
public string Email { get; set; }

// Custom Properties
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? DisplayName { get; set; }

[Format(FormatMethods.IconRounded)]
[Input(Type = "file"), UploadTo("users")]
public string ProfileUrl { get; set; }

public Department Department { get; set; }
public string Title { get; set; }
public string JobArea { get; set; }
public string Location { get; set; }
public int Salary { get; set; }
public string About { get; set; }
public bool IsArchived { get; set; }
public DateTime? ArchivedDate { get; set; }
public DateTime? LastLoginDate { get; set; }
public string LastLoginIp { get; set; }

// UserAuth Properties
public string UserName { get; set; }
public string PrimaryEmail { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Company { get; set; }
public string Country { get; set; }
public string PhoneNumber { get; set; }
public DateTime? BirthDate { get; set; }
public string BirthDateRaw { get; set; }
public string Address { get; set; }
public string Address2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Culture { get; set; }
public string FullName { get; set; }
public string Gender { get; set; }
public string Language { get; set; }
public string MailAddress { get; set; }
public string Nickname { get; set; }
public string PostalCode { get; set; }
public string TimeZone { get; set; }
[IgnoreDataMember]
public string Salt { get; set; }
[IgnoreDataMember]
public string PasswordHash { get; set; }
[IgnoreDataMember]
public string DigestHa1Hash { get; set; }
public List<string> Roles { get; set; } = new();
public List<string> Permissions { get; set; } = new();
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public int InvalidLoginAttempts { get; set; }
public DateTime? LastLoginAttempt { get; set; }
public DateTime? LockedDate { get; set; }
[IgnoreDataMember]
public string RecoveryToken { get; set; }

//Custom Reference Data
public int? RefId { get; set; }
public string RefIdStr { get; set; }
public Dictionary<string, string> Meta { get; set; }
public string? ProfileUrl { get; set; }
}

public enum Department
{
None,
Marketing,
Accounts,
Legal,
HumanResources,
}
42 changes: 21 additions & 21 deletions TalentBlazor.ServiceModel/Talent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public class JobApplicationComment : AuditBase
[AutoIncrement]
public int Id { get; set; }

[References(typeof(AppUser))]
public int AppUserId { get; set; }
[References(typeof(ApplicationUser))]
public string ApplicationUserId { get; set; }

[Reference, Format(FormatMethods.Hidden)]
public AppUser AppUser { get; set; }
public ApplicationUser ApplicationUser { get; set; }

[References(typeof(JobApplication))]
public int JobApplicationId { get; set; }
Expand Down Expand Up @@ -132,11 +132,11 @@ public class JobApplicationEvent : AuditBase
[References(typeof(JobApplication))]
public int JobApplicationId { get; set; }

[References(typeof(AppUser))]
public int AppUserId { get; set; }
[References(typeof(ApplicationUser))]
public string ApplicationUserId { get; set; }

[Reference, Format(FormatMethods.Hidden)]
public AppUser AppUser { get; set; }
public ApplicationUser ApplicationUser { get; set; }

public string Description { get; set; }

Expand All @@ -152,11 +152,11 @@ public class PhoneScreen : AuditBase
[AutoIncrement]
public int Id { get; set; }

[References(typeof(AppUser))]
public int AppUserId { get; set; }
[References(typeof(ApplicationUser))]
public string ApplicationUserId { get; set; }

[Reference, Format(FormatMethods.Hidden)]
public AppUser AppUser { get; set; }
public ApplicationUser ApplicationUser { get; set; }

[References(typeof(JobApplication))]
public int JobApplicationId { get; set; }
Expand All @@ -180,11 +180,11 @@ public class Interview : AuditBase
[References(typeof(JobApplication))]
public int JobApplicationId { get; set; }

[References(typeof(AppUser))]
public int AppUserId { get; set; }
[References(typeof(ApplicationUser))]
public string ApplicationUserId { get; set; }

[Reference, Format(FormatMethods.Hidden)]
public AppUser AppUser { get; set; }
public ApplicationUser ApplicationUser { get; set; }

[ReferenceField(typeof(JobApplication), nameof(JobApplicationId))]
public JobApplicationStatus? ApplicationStatus { get; set; }
Expand All @@ -205,11 +205,11 @@ public class JobOffer : AuditBase
[References(typeof(JobApplication))]
public int JobApplicationId { get; set; }

[References(typeof(AppUser))]
public int AppUserId { get; set; }
[References(typeof(ApplicationUser))]
public string ApplicationUserId { get; set; }

[Reference, Format(FormatMethods.Hidden)]
public AppUser AppUser { get; set; }
public ApplicationUser ApplicationUser { get; set; }

[Input(Type = "textarea"), FieldCss(Field = "col-span-12 text-center")]
public string Notes { get; set; }
Expand Down Expand Up @@ -427,7 +427,7 @@ public class CreatePhoneScreen : ICreateDb<PhoneScreen>, IReturn<PhoneScreen>
[ValidateGreaterThan(0)]
public int JobApplicationId { get; set; }
[ValidateGreaterThan(0, Message = "An employee to perform the phone screening must be selected.")]
public int AppUserId { get; set; }
public string ApplicationUserId { get; set; }

public JobApplicationStatus ApplicationStatus { get; set; }
}
Expand Down Expand Up @@ -460,7 +460,7 @@ public class CreateInterview : ICreateDb<Interview>, IReturn<Interview>
[ValidateGreaterThan(0)]
public int JobApplicationId { get; set; }
[ValidateGreaterThan(0, Message = "An employee to perform interview must be selected.")]
public int AppUserId { get; set; }
public string ApplicationUserId { get; set; }

public JobApplicationStatus ApplicationStatus { get; set; }
}
Expand Down Expand Up @@ -537,7 +537,7 @@ public class DeleteJobApplicationEvent : IDeleteDb<JobApplicationEvent>,
}

[Tag("Talent")]
public class QueryAppUser : QueryDb<AppUser>
public class QueryAppUser : QueryDb<ApplicationUser>
{
public string? EmailContains { get; set; }
public string? FirstNameContains { get; set; }
Expand All @@ -553,7 +553,7 @@ public class QueryJobApplicationComments : QueryDb<JobApplicationComment>

[Tag("Talent")]
[AutoApply(Behavior.AuditCreate)]
[AutoPopulate(nameof(JobApplicationComment.AppUserId), Eval = "userAuthId")]
[AutoPopulate(nameof(JobApplicationComment.ApplicationUserId), Eval = "userAuthId")]
public class CreateJobApplicationComment : ICreateDb<JobApplicationComment>, IReturn<JobApplicationComment>
{
[ValidateGreaterThan(0)]
Expand All @@ -566,7 +566,7 @@ public class CreateJobApplicationComment : ICreateDb<JobApplicationComment>, IRe

[Tag("Talent")]
[AutoApply(Behavior.AuditModify)]
[AutoPopulate(nameof(JobApplicationComment.AppUserId), Eval = "userAuthId")]
[AutoPopulate(nameof(JobApplicationComment.ApplicationUserId), Eval = "userAuthId")]
public class UpdateJobApplicationComment : IPatchDb<JobApplicationComment>, IReturn<JobApplicationComment>
{
public int Id { get; set; }
Expand All @@ -579,7 +579,7 @@ public class UpdateJobApplicationComment : IPatchDb<JobApplicationComment>, IRet

[Tag("Talent")]
[AutoApply(Behavior.AuditSoftDelete)]
[AutoPopulate(nameof(JobApplicationComment.AppUserId), Eval = "userAuthId")]
[AutoPopulate(nameof(JobApplicationComment.ApplicationUserId), Eval = "userAuthId")]
public class DeleteJobApplicationComment : IDeleteDb<JobApplicationComment>, IReturnVoid
{
public int Id { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions TalentBlazor.ServiceModel/TalentBlazor.ServiceModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
<Folder Include="Types\" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.Extensions.Identity.Stores">
<HintPath>..\..\..\..\..\Program Files\dotnet\shared\Microsoft.AspNetCore.App\8.0.0-rc.2.23480.2\Microsoft.Extensions.Identity.Stores.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@page "/jobs/{JobId:int}/applications/{JobAppId:int}"
@inherits AppComponentBase
@layout MainLayout
@rendermode RenderMode.InteractiveServer

<SetHeader>
<div class="flex-1 min-w-0">
Expand Down Expand Up @@ -211,13 +213,13 @@

JobApplication jobApp = new();
List<JobApplicationEvent> jobAppEvents = new();
List<AppUser> appUsers = new();
List<ApplicationUser> appUsers = new();

PhoneScreen phoneScreen = new();
Interview interview = new();
JobOffer jobOffer = new();

AppUser? employeeSelection;
ApplicationUser? employeeSelection;

bool loading = true;

Expand Down Expand Up @@ -395,7 +397,7 @@
errorStatus = api.Error;
}

void OnEmployeeSelectionChanged(AppUser val)
void OnEmployeeSelectionChanged(ApplicationUser val)
{
Console.WriteLine($"Api user selection changed: {val.Email}");
employeeSelection = val;
Expand All @@ -416,7 +418,7 @@
{
phoneScreenResult = await ApiAsync(new CreatePhoneScreen {
JobApplicationId = JobAppId,
AppUserId = employeeSelection?.Id ?? 0,
ApplicationUserId = employeeSelection?.Id ?? "",
ApplicationStatus = JobApplicationStatus.PhoneScreening
});
if (phoneScreenResult.Succeeded)
Expand Down Expand Up @@ -455,7 +457,7 @@
{
interviewResult = await ApiAsync(new CreateInterview {
JobApplicationId = JobAppId,
AppUserId = employeeSelection?.Id ?? 0,
ApplicationUserId = employeeSelection?.Id ?? "",
BookingTime = interviewBookingTime,
ApplicationStatus = JobApplicationStatus.Interview
});
Expand Down
1 change: 1 addition & 0 deletions TalentBlazor/Components/Pages/Talent/ContactDetails.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/contacts/{ContactId:int}"
@layout MainLayout
@inherits AppComponentBase

<SetHeader>
Expand Down
5 changes: 3 additions & 2 deletions TalentBlazor/Components/Pages/Talent/ContactsList.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/contacts"
@layout MainLayout
@inherits AppComponentBase

<SetHeader>
Expand Down Expand Up @@ -157,13 +158,13 @@

</div>
<div class="-mt-px w-0 flex-1 flex justify-end">
<a href="" @onclick="(e) => currentPage = currentPage == NumberOfPages() - 1 ? currentPage : currentPage + 1" @onclick:preventDefault class="border-t-2 border-transparent pt-4 pl-1 inline-flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-200">
<button type="button" @onclick="(e) => currentPage = currentPage == NumberOfPages() - 1 ? currentPage : currentPage + 1" class="border-t-2 border-transparent pt-4 pl-1 inline-flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-200">
Next
<!-- Heroicon name: solid/arrow-narrow-right -->
<svg class="ml-3 h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</a>
</button>
</div>
</nav>
</main>
Expand Down
3 changes: 2 additions & 1 deletion TalentBlazor/Components/Pages/Talent/Dashboard.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@page "/dashboard"
@inherits AppComponentBase
@layout MainLayout
@inject NavigationManager NavigationManager;

<SetHeader>
Expand Down Expand Up @@ -69,7 +70,7 @@
</Authorizing>
<NotAuthorized>
<div class="mt-5 flex justify-center sm:mt-0">
<a href="/signin" class="flex justify-center items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50"> Sign in </a>
<a href="/Account/Login" class="flex justify-center items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50"> Sign in </a>
</div>
</NotAuthorized>
</AuthorizeView>
Expand Down
Loading

0 comments on commit b3ffdc0

Please sign in to comment.