Skills now saved / returned

Edging closer to #2 completion; need to finish styles, create display page, and put some interesting stuff on the dashboard
This commit is contained in:
2020-12-27 22:30:07 -05:00
parent a48af190fa
commit fe3510b818
11 changed files with 424 additions and 102 deletions

View File

@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace JobsJobsJobs.Shared.Api
{
@@ -52,7 +53,17 @@ namespace JobsJobsJobs.Shared.Api
/// The user's past experience
/// </summary>
public string Experience { get; set; } = "";
/// <summary>
/// The skills for the user
/// </summary>
public ICollection<SkillForm> Skills { get; set; } = new List<SkillForm>();
/// <summary>
/// Create an instance of this form from the given profile
/// </summary>
/// <param name="profile">The profile off which this form will be based</param>
/// <returns>The profile form, popluated with values from the given profile</returns>
public static ProfileForm FromProfile(Profile profile) =>
new ProfileForm
{

View File

@@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
namespace JobsJobsJobs.Shared.Api
{
/// <summary>
/// The fields required for a skill
/// </summary>
public class SkillForm
{
/// <summary>
/// The ID of this skill
/// </summary>
[Required]
public string Id { get; set; } = "";
/// <summary>
/// The description of the skill
/// </summary>
[StringLength(100)]
public string Description { get; set; } = "";
/// <summary>
/// Notes regarding the skill
/// </summary>
[StringLength(100)]
public string? Notes { get; set; } = null;
}
}

View File

@@ -12,5 +12,15 @@ namespace JobsJobsJobs.Shared
/// </summary>
/// <returns>A new skill ID</returns>
public static async Task<SkillId> Create() => new SkillId(await ShortId.Create());
/// <summary>
/// Attempt to create a skill ID from a string
/// </summary>
/// <param name="id">The prospective ID</param>
/// <returns>The skill ID</returns>
/// <exception cref="System.FormatException">If the string is not a valid skill ID</exception>
public static SkillId Parse(string id) => new SkillId(ShortId.Parse(id));
public override string ToString() => Id.ToString();
}
}