Title, Provider, tags from paperless
This commit is contained in:
21
src/index.ts
21
src/index.ts
@@ -365,6 +365,27 @@ app.get("/integrations/paperless/search", async (req, res, next) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/integrations/paperless/documents/:documentId", async (req, res, next) => {
|
||||
if (!paperlessClient.isConfigured) {
|
||||
return res.status(503).json({ error: "Paperless integration not configured" });
|
||||
}
|
||||
|
||||
const documentId = parseId(req.params.documentId);
|
||||
if (!documentId) {
|
||||
return res.status(400).json({ error: "Invalid document id" });
|
||||
}
|
||||
|
||||
try {
|
||||
const document = await paperlessClient.getDocument(documentId);
|
||||
if (!document) {
|
||||
return res.status(404).json({ error: "Document not found" });
|
||||
}
|
||||
res.json(document);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/contracts", (req, res) => {
|
||||
const skip = Number(req.query.skip ?? 0);
|
||||
const limit = Math.min(Number(req.query.limit ?? 100), 500);
|
||||
|
||||
Reference in New Issue
Block a user