mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Integrate support for more files into processing and upload
The restriction that only pdf files can be uploaded is removed. All files can now be uploaded. The processing may not process all. It is still possible to restrict file uploads by types via a configuration.
This commit is contained in:
@ -38,6 +38,9 @@ object RAttachment {
|
||||
fr"${v.id},${v.itemId},${v.fileId.id},${v.position},${v.created},${v.name}"
|
||||
).update.run
|
||||
|
||||
def updateFileIdAndName(attachId: Ident, fId: Ident, fname: Option[String]): ConnectionIO[Int] =
|
||||
updateRow(table, id.is(attachId), commas(fileId.setTo(fId), name.setTo(fname))).update.run
|
||||
|
||||
def findById(attachId: Ident): ConnectionIO[Option[RAttachment]] =
|
||||
selectSimple(all, table, id.is(attachId)).query[RAttachment].option
|
||||
|
||||
@ -108,7 +111,8 @@ object RAttachment {
|
||||
def delete(attachId: Ident): ConnectionIO[Int] =
|
||||
for {
|
||||
n0 <- RAttachmentMeta.delete(attachId)
|
||||
n1 <- deleteFrom(table, id.is(attachId)).update.run
|
||||
} yield n0 + n1
|
||||
n1 <- RAttachmentSource.delete(attachId)
|
||||
n2 <- deleteFrom(table, id.is(attachId)).update.run
|
||||
} yield n0 + n1 + n2
|
||||
|
||||
}
|
||||
|
@ -8,11 +8,16 @@ import docspell.store.impl._
|
||||
import docspell.store.impl.Implicits._
|
||||
|
||||
case class RAttachmentMeta(
|
||||
id: Ident,
|
||||
id: Ident, //same as RAttachment.id
|
||||
content: Option[String],
|
||||
nerlabels: List[NerLabel],
|
||||
proposals: MetaProposalList
|
||||
) {}
|
||||
) {
|
||||
|
||||
def setContentIfEmpty(txt: Option[String]): RAttachmentMeta =
|
||||
if (content.forall(_.trim.isEmpty)) copy(content = txt)
|
||||
else this
|
||||
}
|
||||
|
||||
object RAttachmentMeta {
|
||||
def empty(attachId: Ident) = RAttachmentMeta(attachId, None, Nil, MetaProposalList.empty)
|
||||
|
@ -41,4 +41,6 @@ object RAttachmentSource {
|
||||
def findById(attachId: Ident): ConnectionIO[Option[RAttachmentSource]] =
|
||||
selectSimple(all, table, id.is(attachId)).query[RAttachmentSource].option
|
||||
|
||||
def delete(attachId: Ident): ConnectionIO[Int] =
|
||||
deleteFrom(table, id.is(attachId)).update.run
|
||||
}
|
||||
|
Reference in New Issue
Block a user