|
@@ -3,7 +3,7 @@ import { formatBalance } from '@polkadot/util';
|
|
|
import { u128 } from '@polkadot/types';
|
|
|
import { EventRecord } from '@polkadot/types/interfaces';
|
|
|
import Discord from 'discord.js';
|
|
|
-import { Membership, OpeningOf, RewardRelationship } from '@joystream/types/augment-codec/all';
|
|
|
+import { ApplicationId, ApplicationOf, Membership, OpeningOf, RewardRelationship } from '@joystream/types/augment-codec/all';
|
|
|
|
|
|
|
|
|
export const getMintCapacityChangedEmbed = (minted: number, mint: u128, blockNumber: number, event: EventRecord): Discord.MessageEmbed => {
|
|
@@ -26,6 +26,7 @@ export const getOpeningAddedEmbed = (opening: any, openingObject: OpeningOf, blo
|
|
|
.setTitle(`⛩ ${opening.headline} ⛩`)
|
|
|
.setDescription(opening.job.description)
|
|
|
.addFields(
|
|
|
+ { name: 'ID', value: openingObject.hiring_opening_id + "", inline: true },
|
|
|
{ name: 'Reward', value: opening.reward, inline: true },
|
|
|
{ name: 'Application Stake', value: openingObject.policy_commitment.application_staking_policy.unwrap().amount.toString() || 'Not Set', inline: true },
|
|
|
{ name: 'Role Stake', value: openingObject.policy_commitment.role_staking_policy.unwrap().amount.toString() || 'Not Set', inline: true },
|
|
@@ -48,6 +49,23 @@ export const getOpeningFilledEmbed = (opening: any, member: Membership, blockNum
|
|
|
.setTimestamp();
|
|
|
}
|
|
|
|
|
|
+export const getAppliedOnOpeningEmbed = (applicationId: ApplicationId, application: ApplicationOf,
|
|
|
+ openingText: any, hiringApplicationText: any, applicant: Membership, blockNumber: number, event: EventRecord): Discord.MessageEmbed => {
|
|
|
+
|
|
|
+ return new Discord.MessageEmbed()
|
|
|
+ .setColor(joystreamBlue)
|
|
|
+ .setTitle(`🏛 ${applicant.handle} applied to opening ${openingText.job.title}`)
|
|
|
+ .setDescription(hiringApplicationText['About you']['What makes you a good fit for the job?'])
|
|
|
+ .addFields(
|
|
|
+ { name: 'Application ID', value: applicationId.toString(), inline: true},
|
|
|
+ { name: 'Opening', value: openingText.headline, inline: true},
|
|
|
+ { name: 'Applicant', value: `[${application.member_id}] ${hiringApplicationText['About you']['Your name']}`, inline: true},
|
|
|
+ { name: 'Block', value: blockNumber + "", inline: true },
|
|
|
+ { name: 'Tx', value: event.hash.toString(), inline: true },
|
|
|
+ )
|
|
|
+ .setTimestamp();
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
export const getWorkerRewardAmountUpdatedEmbed = (reward: RewardRelationship, member: Membership,
|
|
|
blockNumber: number, event: EventRecord): Discord.MessageEmbed => {
|
|
@@ -110,4 +128,31 @@ export const getWorkerExitedOrTerminatedEmbed = (action: string, member: Members
|
|
|
{ name: 'Tx', value: event.hash.toString(), inline: true },
|
|
|
)
|
|
|
.setTimestamp();
|
|
|
+}
|
|
|
+
|
|
|
+export const getApplicationTerminatedEmbed = (applicationId: ApplicationId, application: ApplicationOf, member: Membership,
|
|
|
+ blockNumber: number, event: EventRecord): Discord.MessageEmbed => {
|
|
|
+
|
|
|
+ return getApplicationTerminatedOrWithdrawEmbed("terminated", applicationId, application, member, blockNumber, event);
|
|
|
+}
|
|
|
+
|
|
|
+export const getApplicationWithdrawnEmbed = (applicationId: ApplicationId, application: ApplicationOf, member: Membership,
|
|
|
+ blockNumber: number, event: EventRecord): Discord.MessageEmbed => {
|
|
|
+
|
|
|
+ return getApplicationTerminatedOrWithdrawEmbed("withdrawn", applicationId, application, member, blockNumber, event);
|
|
|
+}
|
|
|
+
|
|
|
+export const getApplicationTerminatedOrWithdrawEmbed = (action: string, applicationId: ApplicationId, application: ApplicationOf, member: Membership,
|
|
|
+ blockNumber: number, event: EventRecord): Discord.MessageEmbed => {
|
|
|
+
|
|
|
+ return new Discord.MessageEmbed()
|
|
|
+ .setColor(joystreamBlue)
|
|
|
+ .setTitle(`🏛 Application of ${member.handle} ${action}`)
|
|
|
+ .addFields(
|
|
|
+ { name: 'Application ID', value: applicationId.toString(), inline: true },
|
|
|
+ { name: 'Opening ID', value: application.opening_id.toString(), inline: true },
|
|
|
+ { name: 'Block', value: blockNumber + "", inline: true },
|
|
|
+ { name: 'Tx', value: event.hash.toString(), inline: true },
|
|
|
+ )
|
|
|
+ .setTimestamp();
|
|
|
}
|