Adopt modules to new collective table

This commit is contained in:
eikek
2022-07-13 23:37:46 +02:00
parent 77f22bb5ea
commit 26d7c91266
11 changed files with 113 additions and 64 deletions

View File

@ -70,7 +70,7 @@ object BasicData {
def find(
itemIds: NonEmptyList[Ident],
account: AccountId,
account: AccountInfo,
now: Timestamp
): ConnectionIO[Vector[Item]] = {
import ItemQueryDsl._

View File

@ -46,7 +46,7 @@ object DeleteFieldValueCtx {
for {
now <- OptionT.liftF(Timestamp.current[ConnectionIO])
items <- OptionT.liftF(Item.find(ev.items, ev.account, now))
field <- OptionT(RCustomField.findById(ev.field, ev.account.collective))
field <- OptionT(RCustomField.findById(ev.field, ev.account.collectiveId))
msg = DeleteFieldValueCtx(
ev,
Data(
@ -71,7 +71,7 @@ object DeleteFieldValueCtx {
)
final case class Data(
account: AccountId,
account: AccountInfo,
items: List[Item],
field: Field,
itemUrl: Option[String]

View File

@ -61,7 +61,7 @@ object ItemSelectionCtx {
items.toList,
ev.itemUrl,
ev.more,
ev.account.user.id
ev.account.login.id
)
)
} yield msg
@ -73,12 +73,12 @@ object ItemSelectionCtx {
items <- ev.items.traverse(Item.sample[F])
} yield ItemSelectionCtx(
ev,
Data(ev.account, items.toList, ev.itemUrl, ev.more, ev.account.user.id)
Data(ev.account, items.toList, ev.itemUrl, ev.more, ev.account.login.id)
)
)
final case class Data(
account: AccountId,
account: AccountInfo,
items: List[Item],
itemUrl: Option[String],
more: Boolean,
@ -89,7 +89,7 @@ object ItemSelectionCtx {
io.circe.generic.semiauto.deriveEncoder
def create(
account: AccountId,
account: AccountInfo,
items: Vector[ListItem],
baseUrl: Option[LenientUri],
more: Boolean,
@ -100,7 +100,7 @@ object ItemSelectionCtx {
items.map(Item(now)).toList,
baseUrl.map(_.asString),
more,
account.user.id
account.login.id
)
}

View File

@ -44,7 +44,7 @@ object SetFieldValueCtx {
for {
now <- OptionT.liftF(Timestamp.current[ConnectionIO])
items <- OptionT.liftF(Item.find(ev.items, ev.account, now))
field <- OptionT(RCustomField.findById(ev.field, ev.account.collective))
field <- OptionT(RCustomField.findById(ev.field, ev.account.collectiveId))
msg = SetFieldValueCtx(
ev,
Data(
@ -70,7 +70,7 @@ object SetFieldValueCtx {
)
final case class Data(
account: AccountId,
account: AccountInfo,
items: List[Item],
field: Field,
value: String,

View File

@ -39,8 +39,8 @@ object TagsChangedCtx {
def apply: Factory =
EventContext.factory(ev =>
for {
tagsAdded <- RTag.findAllByNameOrId(ev.added, ev.account.collective)
tagsRemov <- RTag.findAllByNameOrId(ev.removed, ev.account.collective)
tagsAdded <- RTag.findAllByNameOrId(ev.added, ev.account.collectiveId)
tagsRemov <- RTag.findAllByNameOrId(ev.removed, ev.account.collectiveId)
now <- Timestamp.current[ConnectionIO]
items <- Item.find(ev.items, ev.account, now)
msg = TagsChangedCtx(
@ -69,7 +69,7 @@ object TagsChangedCtx {
)
final case class Data(
account: AccountId,
account: AccountInfo,
items: List[Item],
added: List[Tag],
removed: List[Tag],