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

View file

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

View file

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