mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
applied propper conventions and fixed code duplication
This commit is contained in:
parent
65f53df939
commit
3eae1f60b2
@ -11,12 +11,15 @@ export class EventBasicUserId extends EventBasic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class EventBasicTx extends EventBasicUserId {
|
export class EventBasicTx extends EventBasicUserId {
|
||||||
xUserId: number
|
|
||||||
xCommunityId: number
|
|
||||||
transactionId: number
|
transactionId: number
|
||||||
amount: decimal
|
amount: decimal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class EventBasicTxX extends EventBasicTx {
|
||||||
|
xUserId: number
|
||||||
|
xCommunityId: number
|
||||||
|
}
|
||||||
|
|
||||||
export class EventBasicCt extends EventBasicUserId {
|
export class EventBasicCt extends EventBasicUserId {
|
||||||
contributionId: number
|
contributionId: number
|
||||||
amount: decimal
|
amount: decimal
|
||||||
@ -28,8 +31,8 @@ export class EventBasicCtX extends EventBasicCt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class EventBasicRedeem extends EventBasicUserId {
|
export class EventBasicRedeem extends EventBasicUserId {
|
||||||
transactionId?: number
|
transactionId: number
|
||||||
contributionId?: number
|
contributionId: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EventBasicCtMsg extends EventBasicCt {
|
export class EventBasicCtMsg extends EventBasicCt {
|
||||||
@ -44,9 +47,9 @@ export class EventInactiveAccount extends EventBasicUserId {}
|
|||||||
export class EventSendConfirmationEmail extends EventBasicUserId {}
|
export class EventSendConfirmationEmail extends EventBasicUserId {}
|
||||||
export class EventSendAccountMultiRegistrationEmail extends EventBasicUserId {}
|
export class EventSendAccountMultiRegistrationEmail extends EventBasicUserId {}
|
||||||
export class EventSendForgotPasswordEmail extends EventBasicUserId {}
|
export class EventSendForgotPasswordEmail extends EventBasicUserId {}
|
||||||
export class EventSendTransactionSendEmail extends EventBasicTx {}
|
export class EventSendTransactionSendEmail extends EventBasicTxX {}
|
||||||
export class EventSendTransactionReceiveEmail extends EventBasicTx {}
|
export class EventSendTransactionReceiveEmail extends EventBasicTxX {}
|
||||||
export class EventSendTransactionLinkRedeemEmail extends EventBasicTx {}
|
export class EventSendTransactionLinkRedeemEmail extends EventBasicTxX {}
|
||||||
export class EventSendAddedContributionEmail extends EventBasicCt {}
|
export class EventSendAddedContributionEmail extends EventBasicCt {}
|
||||||
export class EventSendContributionConfirmEmail extends EventBasicCt {}
|
export class EventSendContributionConfirmEmail extends EventBasicCt {}
|
||||||
export class EventConfirmationEmail extends EventBasicUserId {}
|
export class EventConfirmationEmail extends EventBasicUserId {}
|
||||||
@ -56,15 +59,12 @@ export class EventLogout extends EventBasicUserId {}
|
|||||||
export class EventRedeemLogin extends EventBasicRedeem {}
|
export class EventRedeemLogin extends EventBasicRedeem {}
|
||||||
export class EventActivateAccount extends EventBasicUserId {}
|
export class EventActivateAccount extends EventBasicUserId {}
|
||||||
export class EventPasswordChange extends EventBasicUserId {}
|
export class EventPasswordChange extends EventBasicUserId {}
|
||||||
export class EventTransactionSend extends EventBasicTx {}
|
export class EventTransactionSend extends EventBasicTxX {}
|
||||||
export class EventTransactionSendRedeem extends EventBasicTx {}
|
export class EventTransactionSendRedeem extends EventBasicTxX {}
|
||||||
export class EventTransactionRepeateRedeem extends EventBasicTx {}
|
export class EventTransactionRepeateRedeem extends EventBasicTxX {}
|
||||||
export class EventTransactionCreation extends EventBasicUserId {
|
export class EventTransactionCreation extends EventBasicTx {}
|
||||||
transactionId: number
|
export class EventTransactionReceive extends EventBasicTxX {}
|
||||||
amount: decimal
|
export class EventTransactionReceiveRedeem extends EventBasicTxX {}
|
||||||
}
|
|
||||||
export class EventTransactionReceive extends EventBasicTx {}
|
|
||||||
export class EventTransactionReceiveRedeem extends EventBasicTx {}
|
|
||||||
export class EventContributionCreate extends EventBasicCt {}
|
export class EventContributionCreate extends EventBasicCt {}
|
||||||
export class EventUserCreateContributionMessage extends EventBasicCtMsg {}
|
export class EventUserCreateContributionMessage extends EventBasicCtMsg {}
|
||||||
export class EventAdminCreateContributionMessage extends EventBasicCtMsg {}
|
export class EventAdminCreateContributionMessage extends EventBasicCtMsg {}
|
||||||
@ -157,21 +157,21 @@ export class Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setEventSendTransactionSendEmail(ev: EventSendTransactionSendEmail): Event {
|
public setEventSendTransactionSendEmail(ev: EventSendTransactionSendEmail): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.SEND_TRANSACTION_SEND_EMAIL
|
this.type = EventProtocolType.SEND_TRANSACTION_SEND_EMAIL
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEventSendTransactionReceiveEmail(ev: EventSendTransactionReceiveEmail): Event {
|
public setEventSendTransactionReceiveEmail(ev: EventSendTransactionReceiveEmail): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.SEND_TRANSACTION_RECEIVE_EMAIL
|
this.type = EventProtocolType.SEND_TRANSACTION_RECEIVE_EMAIL
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEventSendTransactionLinkRedeemEmail(ev: EventSendTransactionLinkRedeemEmail): Event {
|
public setEventSendTransactionLinkRedeemEmail(ev: EventSendTransactionLinkRedeemEmail): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.SEND_TRANSACTION_LINK_REDEEM_EMAIL
|
this.type = EventProtocolType.SEND_TRANSACTION_LINK_REDEEM_EMAIL
|
||||||
|
|
||||||
return this
|
return this
|
||||||
@ -241,44 +241,42 @@ export class Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setEventTransactionSend(ev: EventTransactionSend): Event {
|
public setEventTransactionSend(ev: EventTransactionSend): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.TRANSACTION_SEND
|
this.type = EventProtocolType.TRANSACTION_SEND
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEventTransactionSendRedeem(ev: EventTransactionSendRedeem): Event {
|
public setEventTransactionSendRedeem(ev: EventTransactionSendRedeem): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.TRANSACTION_SEND_REDEEM
|
this.type = EventProtocolType.TRANSACTION_SEND_REDEEM
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEventTransactionRepeateRedeem(ev: EventTransactionRepeateRedeem): Event {
|
public setEventTransactionRepeateRedeem(ev: EventTransactionRepeateRedeem): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.TRANSACTION_REPEATE_REDEEM
|
this.type = EventProtocolType.TRANSACTION_REPEATE_REDEEM
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEventTransactionCreation(ev: EventTransactionCreation): Event {
|
public setEventTransactionCreation(ev: EventTransactionCreation): Event {
|
||||||
this.setByBasicUser(ev.userId)
|
this.setByBasicTx(ev.userId, ev.transactionId, ev.amount)
|
||||||
if (ev.transactionId) this.transactionId = ev.transactionId
|
|
||||||
if (ev.amount) this.amount = ev.amount
|
|
||||||
this.type = EventProtocolType.TRANSACTION_CREATION
|
this.type = EventProtocolType.TRANSACTION_CREATION
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEventTransactionReceive(ev: EventTransactionReceive): Event {
|
public setEventTransactionReceive(ev: EventTransactionReceive): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.TRANSACTION_RECEIVE
|
this.type = EventProtocolType.TRANSACTION_RECEIVE
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEventTransactionReceiveRedeem(ev: EventTransactionReceiveRedeem): Event {
|
public setEventTransactionReceiveRedeem(ev: EventTransactionReceiveRedeem): Event {
|
||||||
this.setByBasicTx(ev.userId, ev.xUserId, ev.xCommunityId, ev.transactionId, ev.amount)
|
this.setByBasicTxX(ev.userId, ev.transactionId, ev.amount, ev.xUserId, ev.xCommunityId)
|
||||||
this.type = EventProtocolType.TRANSACTION_RECEIVE_REDEEM
|
this.type = EventProtocolType.TRANSACTION_RECEIVE_REDEEM
|
||||||
|
|
||||||
return this
|
return this
|
||||||
@ -354,26 +352,32 @@ export class Event {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
setByBasicTx(
|
setByBasicTx(userId: number, transactionId: number, amount: decimal): Event {
|
||||||
userId: number,
|
|
||||||
xUserId?: number,
|
|
||||||
xCommunityId?: number,
|
|
||||||
transactionId?: number,
|
|
||||||
amount?: decimal,
|
|
||||||
): Event {
|
|
||||||
this.setByBasicUser(userId)
|
this.setByBasicUser(userId)
|
||||||
if (xUserId) this.xUserId = xUserId
|
this.transactionId = transactionId
|
||||||
if (xCommunityId) this.xCommunityId = xCommunityId
|
this.amount = amount
|
||||||
if (transactionId) this.transactionId = transactionId
|
|
||||||
if (amount) this.amount = amount
|
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
setByBasicCt(userId: number, contributionId: number, amount?: decimal): Event {
|
setByBasicTxX(
|
||||||
|
userId: number,
|
||||||
|
transactionId: number,
|
||||||
|
amount: decimal,
|
||||||
|
xUserId: number,
|
||||||
|
xCommunityId: number,
|
||||||
|
): Event {
|
||||||
|
this.setByBasicTx(userId, transactionId, amount)
|
||||||
|
this.xUserId = xUserId
|
||||||
|
this.xCommunityId = xCommunityId
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
setByBasicCt(userId: number, contributionId: number, amount: decimal): Event {
|
||||||
this.setByBasicUser(userId)
|
this.setByBasicUser(userId)
|
||||||
if (contributionId) this.contributionId = contributionId
|
this.contributionId = contributionId
|
||||||
if (amount) this.amount = amount
|
this.amount = amount
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
@ -406,31 +410,10 @@ export class Event {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
setByBasicRedeem(userId: number, transactionId?: number, contributionId?: number): Event {
|
setByBasicRedeem(userId: number, transactionId: number, contributionId: number): Event {
|
||||||
this.setByBasicUser(userId)
|
this.setByBasicUser(userId)
|
||||||
if (transactionId) this.transactionId = transactionId
|
this.transactionId = transactionId
|
||||||
if (contributionId) this.contributionId = contributionId
|
this.contributionId = contributionId
|
||||||
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
setByEventTransactionCreation(event: EventTransactionCreation): Event {
|
|
||||||
this.type = event.type
|
|
||||||
this.createdAt = event.createdAt
|
|
||||||
this.userId = event.userId
|
|
||||||
this.transactionId = event.transactionId
|
|
||||||
this.amount = event.amount
|
|
||||||
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
setByEventContributionConfirm(event: EventContributionConfirm): Event {
|
|
||||||
this.type = event.type
|
|
||||||
this.createdAt = event.createdAt
|
|
||||||
this.userId = event.userId
|
|
||||||
this.xUserId = event.xUserId
|
|
||||||
this.xCommunityId = event.xCommunityId
|
|
||||||
this.amount = event.amount
|
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user