23 lines
783 B
C#
23 lines
783 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.OutputCaching;
|
|
using Portfolio.Shared.Models;
|
|
using Portfolio.Shared.Services;
|
|
|
|
namespace Portfolio.Api.Controller;
|
|
|
|
[ApiController, Route("api/timeline"), OutputCache(Tags = [DatabaseContext.CacheKey])]
|
|
public class TimelineController(ITimelineRepository repository) : ControllerBase {
|
|
|
|
[HttpGet("{type}")]
|
|
public async Task<IActionResult> GetTimeline(TimelineEntryType type, CancellationToken ct) {
|
|
var timeline = await repository.GetTimeline(type, ct);
|
|
return Ok(timeline);
|
|
}
|
|
|
|
[HttpGet("featured")]
|
|
public async Task<IActionResult> GetFeaturedTimeline(CancellationToken ct) {
|
|
var timeline = await repository.GetFeaturedTimeline(ct);
|
|
return Ok(timeline);
|
|
}
|
|
|
|
} |