Database migration, repository, controller and service
This commit is contained in:
1 parent
07e4e6b381
commit
4fb8768807
17 files changed
+368
-44
No files matched your search
@@ -0,0 +1,22 @@
|
||||
using PaperlessAI.Models;
|
||||
using PaperlessAI.Repositories;
|
||||
|
||||
namespace PaperlessAI.Services;
|
||||
|
||||
public class PaperlessDocumentService(PaperlessDocumentRepository docRepo)
|
||||
{
|
||||
public async Task<bool> Exists(long documentId)
|
||||
{
|
||||
if(documentId < 0 || documentId > long.MaxValue)
|
||||
throw new Exception($"Value \"{documentId}\" must be in Range between 0 - {long.MaxValue}!");
|
||||
|
||||
return await docRepo.Get(documentId) != null;
|
||||
}
|
||||
|
||||
public async Task<PaperlessDocument> Create(long documentId)
|
||||
{
|
||||
var doc = PaperlessDocument.Create(documentId);
|
||||
await docRepo.Add(doc);
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user