v1.0 release
This commit is contained in:
7
Models/AuthorResponse.cs
Normal file
7
Models/AuthorResponse.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public record class AuthorResponse(string Name, int WorkCount)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
8
Models/ComicDeleteRequest.cs
Normal file
8
Models/ComicDeleteRequest.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
//handle is taken from URL
|
||||
public record class ComicDeleteRequest
|
||||
(
|
||||
bool DeleteIfFileExists
|
||||
);
|
||||
}
|
||||
23
Models/ComicDuplicateList.cs
Normal file
23
Models/ComicDuplicateList.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using ComiServ.Entities;
|
||||
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public class ComicDuplicateList
|
||||
{
|
||||
public long Hash { get; set; }
|
||||
public int Count { get; set; }
|
||||
public List<ComicData> Comics { get; set; }
|
||||
public ComicDuplicateList(long hash, IEnumerable<Comic> comics)
|
||||
{
|
||||
Hash = hash;
|
||||
Comics = comics.Select(c => new ComicData(c)).ToList();
|
||||
Count = Comics.Count;
|
||||
}
|
||||
public ComicDuplicateList(long hash, IEnumerable<ComicData> comics)
|
||||
{
|
||||
Hash = hash;
|
||||
Comics = comics.ToList();
|
||||
Count = Comics.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public class ComicMetadataUpdate
|
||||
public class ComicMetadataUpdateRequest
|
||||
{
|
||||
public string? Title { get; set; }
|
||||
public string? Description { get; set; }
|
||||
6
Models/LibraryResponse.cs
Normal file
6
Models/LibraryResponse.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public record class LibraryResponse(int ComicCount, int UniqueFiles)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(page), page, "must be greater than or equal to 0");
|
||||
}
|
||||
Items = iter.Take(max + 1).ToList();
|
||||
Items = iter.Skip(max * page).Take(max + 1).ToList();
|
||||
if (Items.Count > max)
|
||||
{
|
||||
Last = false;
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public class RequestError
|
||||
{
|
||||
using System.Collections;
|
||||
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public class RequestError : IEnumerable<string>
|
||||
{
|
||||
public static RequestError InvalidHandle => new("Invalid handle");
|
||||
public static RequestError ComicNotFound => new("Comic not found");
|
||||
public static RequestError CoverNotFound => new("Cover not found");
|
||||
public static RequestError PageNotFound => new("Page not found");
|
||||
public static RequestError FileNotFound => new("File not found");
|
||||
public static RequestError ThumbnailNotFound => new("Thumbnail not found");
|
||||
public static RequestError NotAuthenticated => new("Not authenticated");
|
||||
public static RequestError NoAccess => new("User does not have access to this resource");
|
||||
public static RequestError UserNotFound => new("User not found");
|
||||
public static RequestError ComicFileExists => new("Comic file exists so comic not deleted");
|
||||
public static RequestError UserSpecificEndpoint => new("Endpoint is user-specific, requires login");
|
||||
public string[] Errors { get; }
|
||||
public RequestError(string ErrorMessage)
|
||||
{
|
||||
Errors = [ErrorMessage];
|
||||
}
|
||||
public RequestError()
|
||||
{
|
||||
Errors = [];
|
||||
}
|
||||
public RequestError(IEnumerable<string> ErrorMessages)
|
||||
{
|
||||
Errors = ErrorMessages.ToArray();
|
||||
@@ -27,8 +38,15 @@
|
||||
}
|
||||
public RequestError And(IEnumerable<string> other)
|
||||
{
|
||||
return new RequestError(Errors.Concat(other))
|
||||
;
|
||||
return new RequestError(Errors.Concat(other));
|
||||
}
|
||||
public IEnumerator<string> GetEnumerator()
|
||||
{
|
||||
return ((IEnumerable<string>)Errors).GetEnumerator();
|
||||
}
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
7
Models/TagResponse.cs
Normal file
7
Models/TagResponse.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public record class TagResponse(string Name, int WorkCount)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,10 @@ namespace ComiServ.Models
|
||||
if (Items.Count <= max)
|
||||
{
|
||||
Complete = true;
|
||||
if (Items.Count > 0)
|
||||
Items.RemoveAt(max);
|
||||
}
|
||||
else
|
||||
{
|
||||
Items.RemoveAt(max);
|
||||
Complete = false;
|
||||
}
|
||||
Count = Items.Count;
|
||||
|
||||
12
Models/UserCreateRequest.cs
Normal file
12
Models/UserCreateRequest.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using ComiServ.Entities;
|
||||
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public class UserCreateRequest
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public UserTypeEnum UserType { get; set; }
|
||||
//NOT HASHED do not persist this object
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
4
Models/UserDescription.cs
Normal file
4
Models/UserDescription.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public record class UserDescription(string Username, string Usertype);
|
||||
}
|
||||
11
Models/UserModifyRequest.cs
Normal file
11
Models/UserModifyRequest.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using ComiServ.Entities;
|
||||
|
||||
namespace ComiServ.Models
|
||||
{
|
||||
public class UserModifyRequest
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string? NewUsername { get; set; }
|
||||
public UserTypeEnum? NewUserType { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user