refactor: Rename func for getting homepage data

This commit is contained in:
Roman Godmaire 2023-11-20 09:48:26 -05:00
parent 714078980c
commit 33aee1875e
3 changed files with 5 additions and 4 deletions

View file

@ -1,8 +1,9 @@
import type { Track, TrackVersion } from '@prisma/client';
export interface Database {
listTracksWithProducer: (producerId: string) => Promise<
listTracksForTrackCard: (producerId: string) => Promise<
{
id: number;
title: string;
version: number;
producer: string;
@ -10,7 +11,7 @@ export interface Database {
author: string;
content: string;
createdAt: Date;
};
}[];
}[]
>;

View file

@ -8,7 +8,7 @@ export class DatabasePrisma implements Database {
this.client = new PrismaClient();
}
listTracksWithProducer = async (producerId: string) => {
listTracksForTrackCard = async (producerId: string) => {
const tracks = await this.client.track.findMany({
select: {
title: true,

View file

@ -8,7 +8,7 @@ export const load: PageServerLoad = async ({ locals: { authReq, database } }) =>
tracks: []
};
const tracks = await database.listTracksWithProducer(session.user.userId);
const tracks = await database.listTracksForTrackCard(session.user.userId);
return {
tracks