Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NoExp.Application/Interfaces/IJobAdService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ public interface IJobAdService
Task<List<JobAd>> GetAllEmployerJobAdsAsync(string employerProfileId);

Task<JobAd> GetJobAdByIdAsync(Guid jobAdId);

Task<Guid> RemoveJobAdAsync(Guid jobAdId);

Task<JobAd> UpdateJobAdAsync(JobAd jobAd);
}
11 changes: 11 additions & 0 deletions NoExp.Application/Services/JobAdService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@

public async Task<JobAd> GetJobAdByIdAsync(Guid jobAdId)
{
return await jobAdRepository.GetJobAdByIdAsync(jobAdId);

Check warning on line 26 in NoExp.Application/Services/JobAdService.cs

View workflow job for this annotation

GitHub Actions / build-and-test (9.0.x)

Possible null reference return.
}

public async Task<Guid> RemoveJobAdAsync(Guid jobAdId)
{
await jobAdRepository.SafeDeleteJobAdAsync(jobAdId);
return jobAdId;
}

public async Task<JobAd> UpdateJobAdAsync(JobAd jobAd)
{
return await jobAdRepository.UpdateJobAdAsync(jobAd);
}
}
4 changes: 4 additions & 0 deletions NoExp.Domain/Interfaces/IJobAdRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ public interface IJobAdRepository
Task<List<JobAd>> GetJobAdsByEmployerProfileIdAsync(string employerProfileId);

Task<JobAd?> GetJobAdByIdAsync(Guid jobAdId);

Task SafeDeleteJobAdAsync(Guid jobAdId);

Task<JobAd> UpdateJobAdAsync(JobAd jobAd);
}
17 changes: 17 additions & 0 deletions NoExp.Infrastructure/Repositories/JobAdRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,21 @@ public async Task<List<JobAd>> GetJobAdsByEmployerProfileIdAsync(string employer
.Include(i => i.EmployerProfile)
.FirstOrDefaultAsync(j => j.Id == jobAdId)!;
}

public async Task SafeDeleteJobAdAsync(Guid jobAdId)
{
var jobAd = await context.JobAds.FindAsync(jobAdId);
if (jobAd != null)
{
context.JobAds.Remove(jobAd);
await context.SaveChangesAsync();
}
}

public async Task<JobAd> UpdateJobAdAsync(JobAd jobAd)
{
context.JobAds.Update(jobAd);
await context.SaveChangesAsync();
return jobAd;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<MudDialog>
<DialogContent>
<MudText>@ContentText</MudText>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">Cancel</MudButton>
<MudButton Color="@Color" Variant="Variant.Filled" OnClick="Submit">@ButtonText</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter]
private IMudDialogInstance MudDialog { get; set; } = default!;

[Parameter]
public string ContentText { get; set; } = string.Empty;

[Parameter]
public string ButtonText { get; set; } = string.Empty;

[Parameter]
public Color Color { get; set; } = Color.Default;

private void Submit() => MudDialog.Close(DialogResult.Ok(true));

private void Cancel() => MudDialog.Cancel();
}
11 changes: 2 additions & 9 deletions NoExp.Presentation/Components/Pages/JobAds/CreateJobAd.razor
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
var user = (await AuthStateProvider.GetAuthenticationStateAsync()).User;
var userId = user.FindFirst(c => c.Type.Contains("nameidentifier"))?.Value;

var employerProfile = await ProfileService.GetEmployerProfileByUserIdAsync(userId);

Check warning on line 147 in NoExp.Presentation/Components/Pages/JobAds/CreateJobAd.razor

View workflow job for this annotation

GitHub Actions / build-and-test (9.0.x)

Possible null reference argument for parameter 'userId' in 'Task<EmployerProfile?> IProfileService.GetEmployerProfileByUserIdAsync(string userId)'.

if (employerProfile == null)
{
Expand Down Expand Up @@ -184,16 +184,15 @@
{
if (e.Key == "Enter" && !string.IsNullOrWhiteSpace(Input.TechStack))
{
if (!AddedTechStack.Contains(Input.TechStack))
if (!AddedTechStack.Contains(Input.TechStack, StringComparer.OrdinalIgnoreCase))
{
AddedTechStack.Add(Input.TechStack.Trim());
}
else
{
Snackbar.Add(new MarkupString($"{Input.TechStack} skill exists!"), Severity.Error);
Snackbar.Add($"{Input.TechStack} skill exists!", Severity.Error);
}

await Task.Delay(10);
Input.TechStack = string.Empty;
StateHasChanged();
}
Expand All @@ -219,28 +218,22 @@

private sealed class JobAdModel
{
public string Title { get; set; }

Check warning on line 221 in NoExp.Presentation/Components/Pages/JobAds/CreateJobAd.razor

View workflow job for this annotation

GitHub Actions / build-and-test (9.0.x)

Non-nullable property 'Title' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public string Description { get; set; }

Check warning on line 223 in NoExp.Presentation/Components/Pages/JobAds/CreateJobAd.razor

View workflow job for this annotation

GitHub Actions / build-and-test (9.0.x)

Non-nullable property 'Description' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public WorkType WorkType { get; set; }

public WorkMode WorkMode { get; set; }

public string Location { get; set; }

Check warning on line 229 in NoExp.Presentation/Components/Pages/JobAds/CreateJobAd.razor

View workflow job for this annotation

GitHub Actions / build-and-test (9.0.x)

Non-nullable property 'Location' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public decimal SalaryMin { get; set; }

public decimal SalaryMax { get; set; }

public string TechStack { get; set; }

Check warning on line 235 in NoExp.Presentation/Components/Pages/JobAds/CreateJobAd.razor

View workflow job for this annotation

GitHub Actions / build-and-test (9.0.x)

Non-nullable property 'TechStack' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public string Requirements { get; set; }

public string Responsibilities { get; set; }

public string Offer { get; set; }

public DateTime? ExpirationDate { get; set; }
}

Expand Down
Loading
Loading