mirror of
https://github.com/XFox111/MuiCharts.git
synced 2026-04-22 06:51:05 +03:00
Added ASP.NET backend with SQLite
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using ErrorOr;
|
||||
using MuiCharts.Domain.Models;
|
||||
|
||||
namespace MuiCharts.Domain.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a repository for managing points.
|
||||
/// </summary>
|
||||
public interface IPointRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a new point asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="point">The point to add.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the added point or an error.</returns>
|
||||
Task<ErrorOr<Point>> AddPointAsync(Point point);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a point by its ID asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the point to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the retrieved point or an error.</returns>
|
||||
Task<ErrorOr<Point>> GetPointAsync(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a range of points asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a queryable collection of points.</returns>
|
||||
Task<IQueryable<Point>> GetPointsRangeAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Adds or updates a point asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="point">The point to add or update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the added or updated point or an error.</returns>
|
||||
Task<ErrorOr<Point?>> AddOrUpdatePointAsync(Point point);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a point by its ID asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the point to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a flag indicating if the point was deleted successfully or an error.</returns>
|
||||
Task<ErrorOr<Deleted>> DeletePointAsync(int id);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using ErrorOr;
|
||||
using MuiCharts.Domain.Models;
|
||||
|
||||
namespace MuiCharts.Domain.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a repository for managing tracks.
|
||||
/// </summary>
|
||||
public interface ITrackRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a new track asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="track">The track to add.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the added track if successful, or an error if unsuccessful.</returns>
|
||||
Task<ErrorOr<Track>> AddTrackAsync(Track track);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a track asynchronously based on the specified IDs.
|
||||
/// </summary>
|
||||
/// <param name="firstId">The first ID.</param>
|
||||
/// <param name="secondId">The second ID.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the retrieved track if successful, or an error if unsuccessful.</returns>
|
||||
Task<ErrorOr<Track>> GetTrackAsync(int firstId, int secondId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a range of tracks asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the range of tracks.</returns>
|
||||
Task<IQueryable<Track>> GetTracksRangeAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Adds or updates a track asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="track">The track to add or update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the added or updated track if successful, or an error if unsuccessful.</returns>
|
||||
Task<ErrorOr<Track?>> AddOrUpdateTrackAsync(Track track);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a track asynchronously based on the specified IDs.
|
||||
/// </summary>
|
||||
/// <param name="firstId">The first ID.</param>
|
||||
/// <param name="secondId">The second ID.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the deletion status if successful, or an error if unsuccessful.</returns>
|
||||
Task<ErrorOr<Deleted>> DeleteTrackAsync(int firstId, int secondId);
|
||||
}
|
||||
Reference in New Issue
Block a user