A decentralized music tracking and discovery platform built on AT Protocol 🎵

Merge branch 'main' into feat/feed-generator

+11 -13
+11 -13
apps/api/src/bsky/app.ts
··· 1 1 import type { BlobRef } from "@atproto/lexicon"; 2 2 import { isValidHandle } from "@atproto/syntax"; 3 3 import { ctx } from "context"; 4 - import { and, desc, eq } from "drizzle-orm"; 4 + import { and, desc, eq, sql } from "drizzle-orm"; 5 5 import { Hono } from "hono"; 6 6 import jwt from "jsonwebtoken"; 7 7 import * as Profile from "lexicon/types/app/bsky/actor/profile"; ··· 81 81 ? Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 365 * 1000 82 82 : Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 7, 83 83 }, 84 - env.JWT_SECRET, 84 + env.JWT_SECRET 85 85 ); 86 86 ctx.kv.set(did, token); 87 87 } catch (err) { ··· 93 93 .select() 94 94 .from(spotifyAccounts) 95 95 .where( 96 - and( 97 - eq(spotifyAccounts.userId, did), 98 - eq(spotifyAccounts.isBetaUser, true), 99 - ), 96 + and(eq(spotifyAccounts.userId, did), eq(spotifyAccounts.isBetaUser, true)) 100 97 ) 101 98 .limit(1) 102 99 .execute(); ··· 148 145 await ctx.db 149 146 .insert(users) 150 147 .values({ 148 + id: sql`xata_id()`, 151 149 did, 152 150 handle, 153 151 displayName: profile.displayName, ··· 182 180 183 181 ctx.nc.publish( 184 182 "rocksky.user", 185 - Buffer.from(JSON.stringify(deepSnakeCaseKeys(user))), 183 + Buffer.from(JSON.stringify(deepSnakeCaseKeys(user))) 186 184 ); 187 185 188 186 await ctx.kv.set("lastUser", lastUser[0].id); ··· 195 193 .where( 196 194 and( 197 195 eq(spotifyAccounts.userId, did), 198 - eq(spotifyAccounts.isBetaUser, true), 199 - ), 196 + eq(spotifyAccounts.isBetaUser, true) 197 + ) 200 198 ) 201 199 .limit(1) 202 200 .execute(), ··· 212 210 .where( 213 211 and( 214 212 eq(googleDriveAccounts.userId, did), 215 - eq(googleDriveAccounts.isBetaUser, true), 216 - ), 213 + eq(googleDriveAccounts.isBetaUser, true) 214 + ) 217 215 ) 218 216 .limit(1) 219 217 .execute(), ··· 223 221 .where( 224 222 and( 225 223 eq(dropboxAccounts.userId, did), 226 - eq(dropboxAccounts.isBetaUser, true), 227 - ), 224 + eq(dropboxAccounts.isBetaUser, true) 225 + ) 228 226 ) 229 227 .limit(1) 230 228 .execute(),