mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
update usage of linked_user_id for creation transactions
This commit is contained in:
parent
9e11c66ee4
commit
44720aee90
@ -451,6 +451,7 @@ export class ContributionResolver {
|
||||
transaction.userId = contribution.userId
|
||||
transaction.userGradidoID = user.gradidoID
|
||||
transaction.userName = fullName(user.firstName, user.lastName)
|
||||
transaction.linkedUserId = contribution.moderatorId
|
||||
transaction.previous = lastTransaction ? lastTransaction.id : null
|
||||
transaction.amount = contribution.amount
|
||||
transaction.creationDate = contribution.contributionDate
|
||||
|
||||
@ -254,6 +254,9 @@ export class TransactionResolver {
|
||||
// userTransactions.forEach((transaction: dbTransaction) => {
|
||||
// use normal for loop because of timing problems with await in forEach-loop
|
||||
for (const transaction of userTransactions) {
|
||||
if (transaction.typeId === TransactionTypeId.CREATION) {
|
||||
continue;
|
||||
}
|
||||
if (transaction.linkedUserId && !involvedUserIds.includes(transaction.linkedUserId)) {
|
||||
involvedUserIds.push(transaction.linkedUserId)
|
||||
}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(`
|
||||
UPDATE \`transactions\` AS t
|
||||
JOIN \`contributions\` AS c ON t.id = c.transaction_id
|
||||
SET t.linked_user_id = c.confirmed_by
|
||||
WHERE t.typeId = ?
|
||||
`, [1])
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(`UPDATE \`transactions\` SET \`linked_user_id\` = NULL where \`type_id\` = ?;`, [1])
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user