Skip to content

Commit

Permalink
add Experience Endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nixhantb committed Mar 9, 2024
1 parent e5fcf6f commit 26f303e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace JobLeet.WebApi.JobLeet.Api.Controllers.Common.V1
{
[Route("api/v1/experience")]
[Route("api/v1/experiences")]
public class ExperienceController : BaseApiController<ExperienceModel, IExperienceRepository>
{
public ExperienceController(IExperienceRepository experienceRepository, ILoggerManagerV1 logger)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using JobLeet.WebApi.JobLeet.Api.Models.Common.V1;

namespace JobLeet.WebApi.JobLeet.Core.Interfaces.Common.V1
{
public interface IQualificationTypeRepository : IRepository<QualificationModel>
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ public BaseDBContext(DbContextOptions<BaseDBContext> options) : base(options)
public virtual DbSet<Email> Emails { get; set; }
public virtual DbSet<Skill> Skills { get; set; }
public virtual DbSet<PersonName> PersonNames { get; set; }
public virtual DbSet<Qualification> Qualifications { get; set; }
// public virtual DbSet<Qualification> Qualifications { get; set; }
public virtual DbSet<Experience> Experiences { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new EmailConfiguration());
modelBuilder.ApplyConfiguration(new SkillConfiguration());
modelBuilder.ApplyConfiguration(new PersonNameConfiguration());
modelBuilder.ApplyConfiguration(new ExperienceConfiguration());
base.OnModelCreating(modelBuilder);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace JobLeet.WebApi.JobLeet.Infrastructure.Data.Contexts.V1
public class ExperienceConfiguration : IEntityTypeConfiguration<Experience>
{
public void Configure(EntityTypeBuilder<Experience> builder)

{
builder.ToTable("Experience");
builder.HasKey(e => e.Id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ namespace JobLeet.WebApi.JobLeet.Infrastructure.Repositories.Common.V1
public class ExperienceRepository : IExperienceRepository
{
private readonly BaseDBContext _dbContext;
public ExperienceRepository(BaseDBContext dbContext)
{
_dbContext = dbContext;
}
public Task AddAsync(ExperienceModel entity)
{
throw new NotImplementedException();
}

public Task DeleteAsync(int id)
{

throw new NotImplementedException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public Task DeleteAsync(int id)

public async Task<List<QualificationModel>> GetAllAsync()
{
/*
try
{
var result = await _dbContext.Qualifications
Expand All @@ -33,6 +34,8 @@ public async Task<List<QualificationModel>> GetAllAsync()
{
throw new Exception("Error while fetching the database. Please try again later"+ ex.Message);
}
*/
throw new NotImplementedException();
}

public Task<QualificationModel> GetByIdAsync(int id)
Expand Down
4 changes: 3 additions & 1 deletion JobLeet.WebApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using JobLeet.WebApi.JobLeet.Core.Interfaces.Common.V1;
using Microsoft.EntityFrameworkCore;
using JobLeet.WebApi.JobLeet.Infrastructure.Data.Contexts;
using System.Text.Json.Serialization;
using JobLeet.WebApi.JobLeet.Api.Logging;
var builder = WebApplication.CreateBuilder(args);

Expand All @@ -11,12 +10,15 @@
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true);

// Add the required Configurations
// Register the Repository service
builder.Services.AddControllers();
builder.Services.AddScoped<DbContext, BaseDBContext>();
builder.Services.AddScoped<IEmaiTypeRepository, EmailTypeRepository>();
builder.Services.AddSingleton<ILoggerManagerV1, LoggerManagerV1>();
builder.Services.AddScoped<ISkillRepository, SkillRepository>();
builder.Services.AddScoped<IPersonNameRepository, PersonNameRepository>();
builder.Services.AddScoped<IExperienceRepository, ExperienceRepository>();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
Expand Down

0 comments on commit 26f303e

Please sign in to comment.