add: implementacao inicial
This commit is contained in:
12
Repositories/IWorkshopRepository.cs
Normal file
12
Repositories/IWorkshopRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
using CampusWorkshops.Api.Models;
|
||||
|
||||
namespace CampusWorkshops.Api.Repositories;
|
||||
|
||||
// Define repository contract; implementations should be provided by students during the workshop.
|
||||
public interface IWorkshopRepository
|
||||
{
|
||||
Task<IReadOnlyList<Workshop>> GetAllAsync(DateTimeOffset? from, DateTimeOffset? to, string? q, CancellationToken ct);
|
||||
Task<Workshop?> GetByIdAsync(Guid id, CancellationToken ct);
|
||||
Task<Workshop> AddAsync(Workshop workshop, CancellationToken ct);
|
||||
}
|
31
Repositories/InMemoryWorkshopRepository.cs
Normal file
31
Repositories/InMemoryWorkshopRepository.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
using CampusWorkshops.Api.Models;
|
||||
|
||||
namespace CampusWorkshops.Api.Repositories;
|
||||
|
||||
// In-memory repository stub
|
||||
public class InMemoryWorkshopRepository : IWorkshopRepository
|
||||
{
|
||||
public InMemoryWorkshopRepository()
|
||||
{
|
||||
// TODO: Adicionar workshops iniciais
|
||||
}
|
||||
|
||||
public Task<IReadOnlyList<Workshop>> GetAllAsync(DateTimeOffset? from, DateTimeOffset? to, string? q, CancellationToken ct)
|
||||
{
|
||||
// TODO: retornar uma lista filtrada e ordenada por StartAt
|
||||
return Task.FromResult<IReadOnlyList<Workshop>>(Array.Empty<Workshop>());
|
||||
}
|
||||
|
||||
public Task<Workshop?> GetByIdAsync(Guid id, CancellationToken ct)
|
||||
{
|
||||
// TODO: buscar por id
|
||||
return Task.FromResult<Workshop?>(null);
|
||||
}
|
||||
|
||||
public Task<Workshop> AddAsync(Workshop workshop, CancellationToken ct)
|
||||
{
|
||||
// TODO: adicionar à lista em memória e retornar criado
|
||||
return Task.FromResult(workshop);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user