b1k-00 / bayou-tech-music

Music app
1 stars 0 forks source link

Configure-Interfaces #5

Closed b1k-00 closed 6 months ago

b1k-00 commented 6 months ago

Interfaces Igloo

Define interfaces that BTM app will implement. -For Each domain create CRUD interface, this sets up our repository pattern better -review commit e1808827 to understand implementation -hold off on the IApp implementation

b1k-00 commented 6 months ago

[HttpPost("Add")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))] [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task Create(T entity) {

return await ((IApp<T>)_app).Create(entity);

}

b1k-00 commented 6 months ago
[HttpPost("CreateMeeting")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<bool> CreateMeeting(Meeting meeting)
{

    return await _meetingApp.CreateMeeting(meeting);
}
b1k-00 commented 6 months ago

builder.Services.AddHttpContextAccessor(); //This adds Amazon Cognito as the Identity Provider //builder.Services.AddCognitoIdentity();

builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("JuniorAssociateDb")), ServiceLifetime.Scoped);

builder.Services.AddScoped<IUserApp, UserApp>(); builder.Services.AddScoped<IGenericRepository, UserRepository>(); builder.Services.AddScoped<IAvailabilityApp, AvailabilityApp>(); builder.Services.AddScoped<IGenericRepository, AvailabilityRepository>();

b1k-00 commented 6 months ago

namespace Application.Interfaces; public interface IApp where T : class {

Task<T> Get(int id);

Task<List<T>> GetAll();

Task<string> Update(T entity);

Task<string> Delete(int id);

Task<T> Create(T newEntity);

}