tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
[api] fix wrong loved song date
tsiry-sandratraina.com
8 months ago
ca7a36de
ffcced84
+6
-6
1 changed file
expand all
collapse all
unified
split
apps
api
src
xrpc
app
rocksky
actor
getActorLovedSongs.ts
+6
-6
apps/api/src/xrpc/app/rocksky/actor/getActorLovedSongs.ts
···
18
Effect.catchAll((err) => {
19
console.error(err);
20
return Effect.succeed({ tracks: [] });
21
-
}),
22
);
23
server.app.rocksky.actor.getActorLovedSongs({
24
handler: async ({ params }) => {
···
45
.from(tables.lovedTracks)
46
.leftJoin(
47
tables.tracks,
48
-
eq(tables.lovedTracks.trackId, tables.tracks.id),
49
)
50
.leftJoin(tables.users, eq(tables.lovedTracks.userId, tables.users.id))
51
.where(
52
or(
53
eq(tables.users.did, params.did),
54
-
eq(tables.users.handle, params.did),
55
-
),
56
)
57
.limit(params.limit ?? 10)
58
.offset(params.offset ?? 0)
···
61
.then((rows) =>
62
rows.map((row) => ({
63
...row.tracks,
64
-
createdAt: row.lovedTracks.createdAt,
65
}))
66
),
67
catch: (error) => new Error(`Failed to retrieve loved songs: ${error}`),
···
69
};
70
71
const presentation = (
72
-
data: SelectTrack[],
73
): Effect.Effect<{ tracks: SongViewBasic[] }, never> => {
74
return Effect.sync(() => ({
75
tracks: data.map((track) => ({
···
18
Effect.catchAll((err) => {
19
console.error(err);
20
return Effect.succeed({ tracks: [] });
21
+
})
22
);
23
server.app.rocksky.actor.getActorLovedSongs({
24
handler: async ({ params }) => {
···
45
.from(tables.lovedTracks)
46
.leftJoin(
47
tables.tracks,
48
+
eq(tables.lovedTracks.trackId, tables.tracks.id)
49
)
50
.leftJoin(tables.users, eq(tables.lovedTracks.userId, tables.users.id))
51
.where(
52
or(
53
eq(tables.users.did, params.did),
54
+
eq(tables.users.handle, params.did)
55
+
)
56
)
57
.limit(params.limit ?? 10)
58
.offset(params.offset ?? 0)
···
61
.then((rows) =>
62
rows.map((row) => ({
63
...row.tracks,
64
+
createdAt: row.loved_tracks.createdAt,
65
}))
66
),
67
catch: (error) => new Error(`Failed to retrieve loved songs: ${error}`),
···
69
};
70
71
const presentation = (
72
+
data: SelectTrack[]
73
): Effect.Effect<{ tracks: SongViewBasic[] }, never> => {
74
return Effect.sync(() => ({
75
tracks: data.map((track) => ({