Skip to content

Commit

Permalink
fix: fix whitelist state typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladivo committed Oct 29, 2024
1 parent 1e1afa6 commit 07e6391
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apps/chat-service/src/db/WhiteListDbService/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export const WhitelistRecordId = Schema.BigInt.pipe(
export type WhitelistRecordId = Schema.Schema.Type<typeof WhitelistRecordId>

export const WhiteListState = Schema.Literal(
'APROVED',
'DISAPROVED',
'APPROVED',
'DISAPPROVED',
'BLOCKED',
'WAITING',
'CANCELED'
Expand Down
6 changes: 3 additions & 3 deletions apps/chat-service/src/routes/inbox/approveReqest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@ export const approveRequest = Handler.make(ApproveRequestEndpoint, (req) =>
yield* _(
whitelistDb.updateWhitelistRecordState({
id: whitelistRecord.id,
state: 'APROVED',
state: 'APPROVED',
})
)
// make sure to insert the other way around!
yield* _(
whitelistDb.insertWhitelistRecord({
receiver: senderInbox.id,
sender: receiverInbox.publicKey,
state: 'APROVED',
state: 'APPROVED',
})
)
} else {
// Not approved
yield* _(
whitelistDb.updateWhitelistRecordState({
id: whitelistRecord.id,
state: 'DISAPROVED',
state: 'DISAPPROVED',
})
)

Expand Down
2 changes: 1 addition & 1 deletion apps/chat-service/src/routes/inbox/requestApproval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const canSendRequest = ({
if (
whitelistRecord.state === 'CANCELED' ||
whitelistRecord.state === 'WAITING' ||
whitelistRecord.state === 'DISAPROVED'
whitelistRecord.state === 'DISAPPROVED'
) {
const requestTimeoutDays = yield* _(requestTimeoutDaysConfig)
const canBeRequestedAgainFrom = dayjs(whitelistRecord.date).add(
Expand Down
2 changes: 1 addition & 1 deletion apps/chat-service/src/utils/isSenderInReceiverWhitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const isSenderInReceiverWhitelist = ({
)

if (Option.isNone(whitelistRecord)) return false
if (whitelistRecord.value.state === 'APROVED') return true
if (whitelistRecord.value.state === 'APPROVED') return true
return false
})

Expand Down

0 comments on commit 07e6391

Please sign in to comment.