Menu

Six predicates in this codebase are written twice, once in TypeScript and once in SQL
📰

Six predicates in this codebase are written twice, once in TypeScript and once in SQL

DEV Community: typescript·Daniel Pertu·14 days ago
#fBKuFBAH
#devtotypescript#devto#dev#pause#null
Reading 0:00
15s threshold

A campaign in Nakodo can be paused in three different ways: stop finding new creators, stop the email flow, or stop both. Nakodo can also pause a campaign itself, for instance when a Free account's month of contacts is used up, and our pricing page states a couple of those cases, including that extra campaigns are paused rather than deleted when a plan gets smaller.

From that one product idea comes a question the code has to answer in two completely different places. A React component renders a status dot and needs to know whether this campaign is still searching. A background job runs a query that has to pick which campaigns' searches to claim out of everyone's. The first has one row in memory.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.