Skip to content

Commit

Permalink
Merge pull request #397 from Klimatbyran/staging
Browse files Browse the repository at this point in the history
Fix approve button
  • Loading branch information
hugo-nl authored Dec 6, 2024
2 parents 0fceabb + 4634eec commit 458a770
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
14 changes: 10 additions & 4 deletions src/discord/interactions/approve.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { ButtonInteraction } from 'discord.js'
import { DiscordJob } from '../../lib/DiscordWorker'

class ApproveJob extends DiscordJob {
declare data: DiscordJob['data'] & {
wikidata: { node: string }
}
}

export default {
async execute(interaction: ButtonInteraction, job: DiscordJob) {
async execute(interaction: ButtonInteraction, job: ApproveJob) {
await job.updateData({ ...job.data, approved: true })
job.log(`Approving company edit: ${job.data.wikidataId}`)

job.log(`Approving company edit: ${job.data.wikidata.node}`)
await interaction.reply({
content: `Tack för din granskning, ${interaction?.user?.username}!`,
})

await job.promote()
},
}
1 change: 0 additions & 1 deletion src/lib/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Turnover,
Goal,
Initiative,
Industry,
} from '@prisma/client'
import { OptionalNullable } from './type-utils'

Expand Down
2 changes: 1 addition & 1 deletion src/lib/wikidata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import WBK, { EntityId } from 'wikibase-sdk'
import WBK from 'wikibase-sdk'
import { SearchEntitiesOptions } from 'wikibase-sdk/dist/src/queries/search_entities'

const transformData = (data: any): any => {
Expand Down
1 change: 0 additions & 1 deletion src/workers/guessWikidata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { UnrecoverableError } from 'bullmq'
import { searchCompany } from '../lib/wikidata'
import { ask } from '../lib/openai'
import { zodResponseFormat } from 'openai/helpers/zod'
Expand Down
2 changes: 1 addition & 1 deletion tests/prisma.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { prisma, upsertReportingPeriod, upsertCompany } from '../src/lib/prisma'
import { prisma, upsertReportingPeriod } from '../src/lib/prisma'
import { resetDB } from '../src/lib/dev-utils'

describe('reporting periods', () => {
Expand Down

0 comments on commit 458a770

Please sign in to comment.