Skip to content

Commit

Permalink
Add new columns to PrismaVectorStore and update getSongs function
Browse files Browse the repository at this point in the history
  • Loading branch information
JHM69 committed Feb 27, 2024
1 parent bf02296 commit 3b6d1ac
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
20 changes: 20 additions & 0 deletions prisma/prisma-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export const songStore = PrismaVectorStore.withModel<Song>(prisma).create(
tags : PrismaVectorStore.ContentColumn,
mood : PrismaVectorStore.ContentColumn,
lyricsSnippet : PrismaVectorStore.ContentColumn,
url : PrismaVectorStore.ContentColumn,
albumId : PrismaVectorStore.ContentColumn,
artistId : PrismaVectorStore.ContentColumn,
hasLyrics : PrismaVectorStore.ContentColumn,
isDolbyContent : PrismaVectorStore.ContentColumn,
},
filter: {
origin: {
Expand Down Expand Up @@ -72,6 +77,11 @@ export const podcastStore = PrismaVectorStore.withModel<Song>(prisma).create(
tags : PrismaVectorStore.ContentColumn,
mood : PrismaVectorStore.ContentColumn,
lyricsSnippet : PrismaVectorStore.ContentColumn,
url : PrismaVectorStore.ContentColumn,
albumId : PrismaVectorStore.ContentColumn,
artistId : PrismaVectorStore.ContentColumn,
hasLyrics : PrismaVectorStore.ContentColumn,
isDolbyContent : PrismaVectorStore.ContentColumn,
},
filter: {
origin: {
Expand Down Expand Up @@ -103,6 +113,11 @@ export const poemsStore = PrismaVectorStore.withModel<Song>(prisma).create(
tags : PrismaVectorStore.ContentColumn,
mood : PrismaVectorStore.ContentColumn,
lyricsSnippet : PrismaVectorStore.ContentColumn,
url : PrismaVectorStore.ContentColumn,
albumId : PrismaVectorStore.ContentColumn,
artistId : PrismaVectorStore.ContentColumn,
hasLyrics : PrismaVectorStore.ContentColumn,
isDolbyContent : PrismaVectorStore.ContentColumn,
},
filter: {
origin: {
Expand Down Expand Up @@ -133,6 +148,11 @@ export const bookStore = PrismaVectorStore.withModel<Song>(prisma).create(
tags : PrismaVectorStore.ContentColumn,
mood : PrismaVectorStore.ContentColumn,
lyricsSnippet : PrismaVectorStore.ContentColumn,
url : PrismaVectorStore.ContentColumn,
albumId : PrismaVectorStore.ContentColumn,
artistId : PrismaVectorStore.ContentColumn,
hasLyrics : PrismaVectorStore.ContentColumn,
isDolbyContent : PrismaVectorStore.ContentColumn,
},
filter: {
origin: {
Expand Down
24 changes: 7 additions & 17 deletions src/services/album.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ trillerUrl
if (!name ) {
throw new HttpException(422, { errors: { title: ["Required Name fields are missing"] } });
}

console.log("album");
console.log(album);


const data : any = {
slug : `${slugify(name)}`,
contentType,
Expand Down Expand Up @@ -163,8 +160,7 @@ trillerAvailable : (trillerAvailable === "true"),

const al = await prisma.album.create({
data
}).catch((e) => {
console.log(e);
}).catch((e) => {
throw new HttpException(422, { errors: { title: ["Required Name fields are missing"] } });
});

Expand Down Expand Up @@ -224,8 +220,7 @@ export const getAlbum = async (slug: string) => {
};
};

export const getAlbumById = async (slug: string) => {
console.log(slug);
export const getAlbumById = async (slug: string) => {
const album = await prisma.album.findUnique({
where: {
slug
Expand Down Expand Up @@ -383,9 +378,7 @@ trillerUrl
if (!name ) {
throw new HttpException(422, { errors: { title: ["Required Name fields are missing"] } });
}

console.log("album");
console.log(album);


const data : any = {
slug : `${slugify(name)}`,
Expand Down Expand Up @@ -439,16 +432,13 @@ trillerAvailable : (trillerAvailable === "true"),
data.currency = "BDT";
}


console.log("data");
console.log(data);

const updatedAlbum = await prisma.album.update({
where: {
slug,
},
data: data,
}).catch((e) => {
console.log(e);
data,
}).catch((e) => {
throw new HttpException(422, { errors: { title: ["Required Name fields are missing"] } });

}
Expand Down
1 change: 1 addition & 0 deletions src/services/home.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
/* eslint-disable import/prefer-default-export */


Expand Down
2 changes: 2 additions & 0 deletions src/services/songs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export const getSongs = async (query: any, username?: string) => {
primaryImage: true,
},
},
lyricsSnippet: true,
mediaPreviewUrl: true,
// downloadUrls: true,
// images: true,
// playLists: true,
Expand Down

0 comments on commit 3b6d1ac

Please sign in to comment.