Menu

One text column holds YouTube IDs, Instagram handles and place IDs, and the absence of a colon is the type tag
📰

One text column holds YouTube IDs, Instagram handles and place IDs, and the absence of a colon is the type tag

DEV Community: typescript·Daniel Pertu·1 day ago
#jWDXnnHT
#devtotypescript#devto#dev#platform#instagram
Reading 0:00
15s threshold

Nakodo looks at creators on YouTube, Instagram and TikTok, and at businesses from open map listings. Four kinds of thing, and one channels table:

export const channels = pgTable ( " channels " , { // YouTube channel ID (UC...); on other platforms the platform and the // lowercase handle, e.g. "tiktok:name" id : text (). primaryKey (), platform : text ({ enum : PLATFORMS }). notNull (). default ( " youtube " ),

Enter fullscreen mode

Exit fullscreen mode

So a primary key can read as any of these:

UCsBjURrPoezykLs9EqgamOA instagram:home.barista tiktok:coffee.nerd web:08f194ad1b1ec1d60386bb3bb6e1e0a7

Enter fullscreen mode

Exit fullscreen mode

YouTube IDs have no prefix because they came first and because they already carry a shape nobody else uses. Everything added since names itself. The whole type test is one character:

export function platformOf ( channelId : string ): Platform { if ( ! channelId . includes ( " : " )) return " youtube " ; const prefix = channelId .…

Continue reading — create a free account

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