Remove old commented code

This commit is contained in:
Eike Kettner 2020-12-14 13:41:26 +01:00
parent 266fec9eb5
commit d1606d6f16
3 changed files with 0 additions and 157 deletions

View File

@ -74,19 +74,6 @@ object RAttachmentArchive {
attachId: Ident, attachId: Ident,
collective: Ident collective: Ident
): ConnectionIO[Option[RAttachmentArchive]] = { ): ConnectionIO[Option[RAttachmentArchive]] = {
// val bId = RAttachment.Columns.id.prefix("b")
// val aId = Columns.id.prefix("a")
// val bItem = RAttachment.Columns.itemId.prefix("b")
// val iId = RItem.Columns.id.prefix("i")
// val iColl = RItem.Columns.cid.prefix("i")
//
// val from = table ++ fr"a INNER JOIN" ++
// RAttachment.table ++ fr"b ON" ++ aId.is(bId) ++
// fr"INNER JOIN" ++ RItem.table ++ fr"i ON" ++ bItem.is(iId)
//
// val where = and(aId.is(attachId), bId.is(attachId), iColl.is(collective))
//
// selectSimple(all.map(_.prefix("a")), from, where).query[RAttachmentArchive].option
val b = RAttachment.as("b") val b = RAttachment.as("b")
val a = RAttachmentArchive.as("a") val a = RAttachmentArchive.as("a")
val i = RItem.as("i") val i = RItem.as("i")
@ -104,20 +91,6 @@ object RAttachmentArchive {
messageIds: NonEmptyList[String], messageIds: NonEmptyList[String],
collective: Ident collective: Ident
): ConnectionIO[Vector[RAttachmentArchive]] = { ): ConnectionIO[Vector[RAttachmentArchive]] = {
// val bId = RAttachment.Columns.id.prefix("b")
// val bItem = RAttachment.Columns.itemId.prefix("b")
// val aMsgId = Columns.messageId.prefix("a")
// val aId = Columns.id.prefix("a")
// val iId = RItem.Columns.id.prefix("i")
// val iColl = RItem.Columns.cid.prefix("i")
//
// val from = table ++ fr"a INNER JOIN" ++
// RAttachment.table ++ fr"b ON" ++ aId.is(bId) ++
// fr"INNER JOIN" ++ RItem.table ++ fr"i ON" ++ bItem.is(iId)
//
// val where = and(aMsgId.isIn(messageIds), iColl.is(collective))
//
// selectSimple(all.map(_.prefix("a")), from, where).query[RAttachmentArchive].to[Vector]
val b = RAttachment.as("b") val b = RAttachment.as("b")
val a = RAttachmentArchive.as("a") val a = RAttachmentArchive.as("a")
val i = RItem.as("i") val i = RItem.as("i")
@ -135,24 +108,6 @@ object RAttachmentArchive {
): ConnectionIO[Vector[(RAttachmentArchive, FileMeta)]] = { ): ConnectionIO[Vector[(RAttachmentArchive, FileMeta)]] = {
import bitpeace.sql._ import bitpeace.sql._
// val aId = Columns.id.prefix("a")
// val afileMeta = fileId.prefix("a")
// val bPos = RAttachment.Columns.position.prefix("b")
// val bId = RAttachment.Columns.id.prefix("b")
// val bItem = RAttachment.Columns.itemId.prefix("b")
// val mId = RFileMeta.as("m").id.column
//
// val cols = all.map(_.prefix("a")) ++ RFileMeta.as("m").all.map(_.column).toList
// val from = table ++ fr"a INNER JOIN" ++
// Fragment.const(RFileMeta.T.tableName) ++ fr"m ON" ++ afileMeta.is(
// mId
// ) ++ fr"INNER JOIN" ++
// RAttachment.table ++ fr"b ON" ++ aId.is(bId)
// val where = bItem.is(id)
//
// (selectSimple(cols, from, where) ++ orderBy(bPos.asc))
// .query[(RAttachmentArchive, FileMeta)]
// .to[Vector]
val a = RAttachmentArchive.as("a") val a = RAttachmentArchive.as("a")
val b = RAttachment.as("b") val b = RAttachment.as("b")
val m = RFileMeta.as("m") val m = RFileMeta.as("m")
@ -170,14 +125,10 @@ object RAttachmentArchive {
* no archive for the given attachment. * no archive for the given attachment.
*/ */
def countEntries(attachId: Ident): ConnectionIO[Int] = def countEntries(attachId: Ident): ConnectionIO[Int] =
// val qFileId = selectSimple(Seq(fileId), table, id.is(attachId))
// val q = selectCount(id, table, fileId.isSubquery(qFileId))
// q.query[Int].unique
Select( Select(
count(T.id).s, count(T.id).s,
from(T), from(T),
T.fileId.in(Select(T.fileId.s, from(T), T.id === attachId)) T.fileId.in(Select(T.fileId.s, from(T), T.id === attachId))
).build.query[Int].unique ).build.query[Int].unique
//TODO this looks strange, can be simplified
} }

View File

@ -60,19 +60,6 @@ object RAttachmentPreview {
attachId: Ident, attachId: Ident,
collective: Ident collective: Ident
): ConnectionIO[Option[RAttachmentPreview]] = { ): ConnectionIO[Option[RAttachmentPreview]] = {
// val bId = RAttachment.Columns.id.prefix("b")
// val aId = Columns.id.prefix("a")
// val bItem = RAttachment.Columns.itemId.prefix("b")
// val iId = RItem.Columns.id.prefix("i")
// val iColl = RItem.Columns.cid.prefix("i")
//
// val from = table ++ fr"a INNER JOIN" ++
// RAttachment.table ++ fr"b ON" ++ aId.is(bId) ++
// fr"INNER JOIN" ++ RItem.table ++ fr"i ON" ++ bItem.is(iId)
//
// val where = and(aId.is(attachId), bId.is(attachId), iColl.is(collective))
//
// selectSimple(all.map(_.prefix("a")), from, where).query[RAttachmentPreview].option
val b = RAttachment.as("b") val b = RAttachment.as("b")
val a = RAttachmentPreview.as("a") val a = RAttachmentPreview.as("a")
val i = RItem.as("i") val i = RItem.as("i")
@ -87,14 +74,6 @@ object RAttachmentPreview {
} }
def findByItem(itemId: Ident): ConnectionIO[Vector[RAttachmentPreview]] = { def findByItem(itemId: Ident): ConnectionIO[Vector[RAttachmentPreview]] = {
// val sId = Columns.id.prefix("s")
// val aId = RAttachment.Columns.id.prefix("a")
// val aItem = RAttachment.Columns.itemId.prefix("a")
//
// val from = table ++ fr"s INNER JOIN" ++ RAttachment.table ++ fr"a ON" ++ sId.is(aId)
// selectSimple(all.map(_.prefix("s")), from, aItem.is(itemId))
// .query[RAttachmentPreview]
// .to[Vector]
val s = RAttachmentPreview.as("s") val s = RAttachmentPreview.as("s")
val a = RAttachment.as("a") val a = RAttachment.as("a")
Select( Select(
@ -109,25 +88,6 @@ object RAttachmentPreview {
itemId: Ident, itemId: Ident,
coll: Ident coll: Ident
): ConnectionIO[Option[RAttachmentPreview]] = { ): ConnectionIO[Option[RAttachmentPreview]] = {
// val sId = Columns.id.prefix("s")
// val aId = RAttachment.Columns.id.prefix("a")
// val aItem = RAttachment.Columns.itemId.prefix("a")
// val aPos = RAttachment.Columns.position.prefix("a")
// val iId = RItem.Columns.id.prefix("i")
// val iColl = RItem.Columns.cid.prefix("i")
//
// val from =
// table ++ fr"s INNER JOIN" ++ RAttachment.table ++ fr"a ON" ++ sId.is(aId) ++
// fr"INNER JOIN" ++ RItem.table ++ fr"i ON" ++ iId.is(aItem)
//
// selectSimple(
// all.map(_.prefix("s")) ++ List(aPos),
// from,
// and(aItem.is(itemId), iColl.is(coll))
// )
// .query[(RAttachmentPreview, Int)]
// .to[Vector]
// .map(_.sortBy(_._2).headOption.map(_._1))
val s = RAttachmentPreview.as("s") val s = RAttachmentPreview.as("s")
val a = RAttachment.as("a") val a = RAttachment.as("a")
val i = RItem.as("i") val i = RItem.as("i")
@ -149,22 +109,6 @@ object RAttachmentPreview {
): ConnectionIO[Vector[(RAttachmentPreview, FileMeta)]] = { ): ConnectionIO[Vector[(RAttachmentPreview, FileMeta)]] = {
import bitpeace.sql._ import bitpeace.sql._
// val aId = Columns.id.prefix("a")
// val afileMeta = fileId.prefix("a")
// val bPos = RAttachment.Columns.position.prefix("b")
// val bId = RAttachment.Columns.id.prefix("b")
// val bItem = RAttachment.Columns.itemId.prefix("b")
// val mId = RFileMeta.Columns.id.prefix("m")
//
// val cols = all.map(_.prefix("a")) ++ RFileMeta.Columns.all.map(_.prefix("m"))
// val from = table ++ fr"a INNER JOIN" ++
// RFileMeta.table ++ fr"m ON" ++ afileMeta.is(mId) ++ fr"INNER JOIN" ++
// RAttachment.table ++ fr"b ON" ++ aId.is(bId)
// val where = bItem.is(id)
//
// (selectSimple(cols, from, where) ++ orderBy(bPos.asc))
// .query[(RAttachmentPreview, FileMeta)]
// .to[Vector]
val a = RAttachmentPreview.as("a") val a = RAttachmentPreview.as("a")
val b = RAttachment.as("b") val b = RAttachment.as("b")
val m = RFileMeta.as("m") val m = RFileMeta.as("m")
@ -177,5 +121,4 @@ object RAttachmentPreview {
b.itemId === id b.itemId === id
).orderBy(b.position.asc).build.query[(RAttachmentPreview, FileMeta)].to[Vector] ).orderBy(b.position.asc).build.query[(RAttachmentPreview, FileMeta)].to[Vector]
} }
} }

View File

@ -70,19 +70,6 @@ object RAttachmentSource {
from(s).innerJoin(a, a.id === s.id), from(s).innerJoin(a, a.id === s.id),
a.id === attachId && a.fileId <> s.fileId a.id === attachId && a.fileId <> s.fileId
).build.query[Int].unique.map(_ > 0) ).build.query[Int].unique.map(_ > 0)
// val sId = Columns.id.prefix("s")
// val sFile = Columns.fileId.prefix("s")
// val aId = RAttachment.Columns.id.prefix("a")
// val aFile = RAttachment.Columns.fileId.prefix("a")
//
// val from = table ++ fr"s INNER JOIN" ++
// RAttachment.table ++ fr"a ON" ++ aId.is(sId)
//
// selectCount(aId, from, and(aId.is(attachId), aFile.isNot(sFile)))
// .query[Int]
// .unique
// .map(_ > 0)
} }
def delete(attachId: Ident): ConnectionIO[Int] = def delete(attachId: Ident): ConnectionIO[Int] =
@ -92,19 +79,6 @@ object RAttachmentSource {
attachId: Ident, attachId: Ident,
collective: Ident collective: Ident
): ConnectionIO[Option[RAttachmentSource]] = { ): ConnectionIO[Option[RAttachmentSource]] = {
// val bId = RAttachment.Columns.id.prefix("b")
// val aId = Columns.id.prefix("a")
// val bItem = RAttachment.Columns.itemId.prefix("b")
// val iId = RItem.Columns.id.prefix("i")
// val iColl = RItem.Columns.cid.prefix("i")
//
// val from = table ++ fr"a INNER JOIN" ++
// RAttachment.table ++ fr"b ON" ++ aId.is(bId) ++
// fr"INNER JOIN" ++ RItem.table ++ fr"i ON" ++ bItem.is(iId)
//
// val where = and(aId.is(attachId), bId.is(attachId), iColl.is(collective))
//
// selectSimple(all.map(_.prefix("a")), from, where).query[RAttachmentSource].option
val b = RAttachment.as("b") val b = RAttachment.as("b")
val a = RAttachmentSource.as("a") val a = RAttachmentSource.as("a")
val i = RItem.as("i") val i = RItem.as("i")
@ -119,15 +93,6 @@ object RAttachmentSource {
} }
def findByItem(itemId: Ident): ConnectionIO[Vector[RAttachmentSource]] = { def findByItem(itemId: Ident): ConnectionIO[Vector[RAttachmentSource]] = {
// val sId = Columns.id.prefix("s")
// val aId = RAttachment.Columns.id.prefix("a")
// val aItem = RAttachment.Columns.itemId.prefix("a")
//
// val from = table ++ fr"s INNER JOIN" ++ RAttachment.table ++ fr"a ON" ++ sId.is(aId)
// selectSimple(all.map(_.prefix("s")), from, aItem.is(itemId))
// .query[RAttachmentSource]
// .to[Vector]
val s = RAttachmentSource.as("s") val s = RAttachmentSource.as("s")
val a = RAttachment.as("a") val a = RAttachment.as("a")
Select(select(s.all), from(s).innerJoin(a, a.id === s.id), a.itemId === itemId).build Select(select(s.all), from(s).innerJoin(a, a.id === s.id), a.itemId === itemId).build
@ -140,22 +105,6 @@ object RAttachmentSource {
): ConnectionIO[Vector[(RAttachmentSource, FileMeta)]] = { ): ConnectionIO[Vector[(RAttachmentSource, FileMeta)]] = {
import bitpeace.sql._ import bitpeace.sql._
// val aId = Columns.id.prefix("a")
// val afileMeta = fileId.prefix("a")
// val bPos = RAttachment.Columns.position.prefix("b")
// val bId = RAttachment.Columns.id.prefix("b")
// val bItem = RAttachment.Columns.itemId.prefix("b")
// val mId = RFileMeta.Columns.id.prefix("m")
//
// val cols = all.map(_.prefix("a")) ++ RFileMeta.Columns.all.map(_.prefix("m"))
// val from = table ++ fr"a INNER JOIN" ++
// RFileMeta.table ++ fr"m ON" ++ afileMeta.is(mId) ++ fr"INNER JOIN" ++
// RAttachment.table ++ fr"b ON" ++ aId.is(bId)
// val where = bItem.is(id)
//
// (selectSimple(cols, from, where) ++ orderBy(bPos.asc))
// .query[(RAttachmentSource, FileMeta)]
// .to[Vector]
val a = RAttachmentSource.as("a") val a = RAttachmentSource.as("a")
val b = RAttachment.as("b") val b = RAttachment.as("b")
val m = RFileMeta.as("m") val m = RFileMeta.as("m")