Skip to content

Commit

Permalink
fix: Seekers #62
Browse files Browse the repository at this point in the history
 Better usage of Social Media in Seekers Api
  • Loading branch information
nixhantb committed Jan 25, 2025
1 parent 0210ec3 commit 6c297df
Show file tree
Hide file tree
Showing 11 changed files with 982 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ public class SeekerModel : BaseModel
public DateTime? DateOfBirth { get; set; }
public QualificationModel? Qualifications { get; set; }
public string? ProfileSummary { get; set; }
public string? LinkedInProfile { get; set; }
public string? Portfolio { get; set; }
public List<SocialMedia> SocialMedias { get; set; } = new List<SocialMedia>();
public List<string>? Interests { get; set; }
public List<string>? Achievements { get; set; }
}

public class SocialMedia : BaseModel
{
public string? Title { get; set; }
public string? Url { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ public class Seeker : BaseEntity
public DateTime? DateOfBirth { get; set; }
public Qualification? Qualifications { get; set; }
public string? ProfileSummary { get; set; }
public string? LinkedInProfile { get; set; }
public string? Portfolio { get; set; }
public List<SocialMedia>? SocialMedias { get; set; }
public List<string>? Interests { get; set; }
public List<string>? Achievements { get; set; }
}

public class SocialMedia : BaseEntity
{
public string? Title { get; set; }
public string? Url { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ public static Seeker ToSeekerDataBase(Seeker entity, string UserId)
QualificationInformation = entity.Qualifications.QualificationInformation,
},
ProfileSummary = entity.ProfileSummary,
LinkedInProfile = entity.LinkedInProfile,
Portfolio = entity.Portfolio,
SocialMedias = entity
.SocialMedias?.Select(sm => new Core.Entities.Seekers.V1.SocialMedia
{
Id = sm.Id,
Title = sm.Title,
Url = sm.Url,
})
.ToList(),

Interests = entity.Interests,
Achievements = entity.Achievements,
};
Expand Down Expand Up @@ -90,8 +97,14 @@ public static SeekerModel ToSeekerModel(Seeker model)
}
: null,
ProfileSummary = model.ProfileSummary,
LinkedInProfile = model.LinkedInProfile,
Portfolio = model.Portfolio,
SocialMedias = model
.SocialMedias.Select(sm => new Api.Models.Seekers.V1.SocialMedia
{
Id = sm.Id,
Title = sm.Title,
Url = sm.Url,
})
.ToList(),
Interests = model.Interests,
Achievements = model.Achievements,
};
Expand Down
10 changes: 0 additions & 10 deletions Server/JobLeet.WebApi/JobLeet.Validator/V1/SeekersValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ public SeekerValidator()
.MaximumLength(500)
.WithMessage("Profile summary cannot exceed 500 characters.");

RuleFor(seeker => seeker.LinkedInProfile)
.Must(uri => Uri.IsWellFormedUriString(uri, UriKind.Absolute))
.WithMessage("LinkedIn profile must be a valid URL.")
.When(seeker => !string.IsNullOrEmpty(seeker.LinkedInProfile));

RuleFor(seeker => seeker.Portfolio)
.Must(uri => Uri.IsWellFormedUriString(uri, UriKind.Absolute))
.WithMessage("Portfolio must be a valid URL.")
.When(seeker => !string.IsNullOrEmpty(seeker.Portfolio));

RuleFor(seeker => seeker.Interests)
.NotEmpty()
.WithMessage("Interests cannot be empty.")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace JobLeet.WebApi.Migrations
{
/// <inheritdoc />
public partial class AppDBCreate1571 : Migration
public partial class AppDBCreate2741 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace JobLeet.WebApi.Migrations.BaseDB
{
/// <inheritdoc />
public partial class BaseDBCreate9892 : Migration
public partial class BaseDBCreate239 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
Expand Down Expand Up @@ -346,8 +346,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
DateOfBirth = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
QualificationsId = table.Column<string>(type: "text", nullable: true),
ProfileSummary = table.Column<string>(type: "text", nullable: true),
LinkedInProfile = table.Column<string>(type: "text", nullable: true),
Portfolio = table.Column<string>(type: "text", nullable: true),
SocialMedia = table.Column<List<string>>(type: "text[]", nullable: false),
Interests = table.Column<List<string>>(type: "text[]", nullable: true),
Achievements = table.Column<List<string>>(type: "text[]", nullable: true),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
Expand Down
Loading

0 comments on commit 6c297df

Please sign in to comment.