Commit 8e96069a authored by Цой Данил's avatar Цой Данил 💬

#2 checked albums for working

parent a83985f5
import { Document, ObjectId } from "mongoose"
import { Types } from "mongoose";
import IArtist from "./IArtist";
export default interface IAlbum extends Document{
_id: ObjectId
export default interface IAlbum{
_id: Types.ObjectId
title: string;
artist: IArtist['_id']
releaseYear: Date
......
import { Document, ObjectId } from "mongoose"
import { Types } from "mongoose";
export default interface IArtist extends Document{
_id: ObjectId
export default interface IArtist {
_id: Types.ObjectId
name: string;
photo: string;
information: string;
......
......@@ -3,13 +3,12 @@ import IAlbum from "../interfaces/IAlbum";
import IResponse from "../interfaces/IResponse";
import IAlbumDto from "../interfaces/IAlbumDto";
import { Album } from "../models/Album";
import IArtist from "../interfaces/IArtist";
export class AlbumsService {
public getAlbums = async(): Promise<IResponse<IAlbum[] | null>> => {
try {
const data = await Album.find().populate('Artist')
const data = await Album.find().populate('artist')
const response: IResponse<IAlbum[]> = {
status: EStatuses.SUCCESS,
result: data,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment