diff --git a/backend/src/socketio/Room.ts b/backend/src/socketio/Room.ts index 09d95d36..d6a1a912 100644 --- a/backend/src/socketio/Room.ts +++ b/backend/src/socketio/Room.ts @@ -120,7 +120,7 @@ export default class Room { this.queue.push({ ...track, - addedBy: "TODO", // TODO: Add the id of the user who added the track + addedBy: accountId, votes: [], }); if (this.queue.length !== 1) return; diff --git a/commons/backend-types.ts b/commons/backend-types.ts index 0b5dcf8d..e976b3ad 100644 --- a/commons/backend-types.ts +++ b/commons/backend-types.ts @@ -8,8 +8,6 @@ export interface JSONTrack { /** An array of all genres of this song */ genres: string[]; id: string; - votes?: string[]; // array of user ids - addedBy: string; } export interface RoomJSONTrack extends JSONTrack { @@ -17,7 +15,10 @@ export interface RoomJSONTrack extends JSONTrack { * The user id of the user who added the track to the queue */ addedBy: string; - votes: string[]; // array of user ids + /** + * An array of user ids of users who have voted to skip this track + */ + votes: string[]; } export interface PlayingJSONTrack extends RoomJSONTrack { diff --git a/expo/app/(tabs)/rooms/[id]/add.tsx b/expo/app/(tabs)/rooms/[id]/add.tsx index 715e6085..ea530d65 100644 --- a/expo/app/(tabs)/rooms/[id]/add.tsx +++ b/expo/app/(tabs)/rooms/[id]/add.tsx @@ -33,7 +33,11 @@ export default function AddTrack() { "Les utilisateurs anonymes ne sont pas autorisés à accéder à cette fonctionnalité. Veuillez vous connecter." ); try { - socket.emit("queue:add", new URL(url).toString(), userProfile.account_id); + socket.emit( + "queue:add", + new URL(url).toString(), + userProfile.user_profile_id + ); } catch { setSearchBar(""); setResult(null); diff --git a/expo/components/room/TrackItem.tsx b/expo/components/room/TrackItem.tsx index 310e35eb..2a39b01b 100644 --- a/expo/components/room/TrackItem.tsx +++ b/expo/components/room/TrackItem.tsx @@ -19,7 +19,6 @@ export default function TrackItem(prop: { handleDislike: () => void; disliked: boolean; addedBy: string; - accountId: string; }) { const { title, @@ -48,8 +47,8 @@ export default function TrackItem(prop: { artistsName={artists} imgUrl={rawImageUrl} profilePictureImage={ - prop.accountId ? ( - + prop.addedBy ? ( + ) : (