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

#3 started working with albums. Created schema and interface for it. Currently…

#3 started working with albums. Created schema and interface for it. Currently planing to start to work with services and controllers for it
parent 64704b69
......@@ -10,7 +10,6 @@
"license": "ISC",
"dependencies": {
"@types/cors": "^2.8.13",
"@types/mongoose": "^5.11.97",
"@types/shortid": "^0.0.29",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
......@@ -29,6 +28,7 @@
"@types/dotenv": "^8.2.0",
"@types/express": "^4.17.17",
"@types/mongodb": "^4.0.7",
"@types/mongoose": "^5.11.97",
"@types/multer": "^1.4.7",
"@types/uuid": "^9.0.1",
"@types/validator": "^13.7.14",
......@@ -185,6 +185,7 @@
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.11.97.tgz",
"integrity": "sha512-cqwOVYT3qXyLiGw7ueU2kX9noE8DPGRY6z8eUxudhXY8NZ7DMKYAxyZkLSevGfhCX3dO/AoX5/SO9lAzfjon0Q==",
"deprecated": "Mongoose publishes its own types, so you do not need to install this package.",
"dev": true,
"dependencies": {
"mongoose": "*"
}
......@@ -2347,6 +2348,7 @@
"version": "5.11.97",
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.11.97.tgz",
"integrity": "sha512-cqwOVYT3qXyLiGw7ueU2kX9noE8DPGRY6z8eUxudhXY8NZ7DMKYAxyZkLSevGfhCX3dO/AoX5/SO9lAzfjon0Q==",
"dev": true,
"requires": {
"mongoose": "*"
}
......
......@@ -11,7 +11,6 @@
"license": "ISC",
"dependencies": {
"@types/cors": "^2.8.13",
"@types/mongoose": "^5.11.97",
"@types/shortid": "^0.0.29",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
......@@ -30,6 +29,7 @@
"@types/dotenv": "^8.2.0",
"@types/express": "^4.17.17",
"@types/mongodb": "^4.0.7",
"@types/mongoose": "^5.11.97",
"@types/multer": "^1.4.7",
"@types/uuid": "^9.0.1",
"@types/validator": "^13.7.14",
......
......@@ -4,7 +4,6 @@ import shortid from "shortid";
import { config } from "../index.config";
import path from 'path'
import { artistsService, ArtistsService } from "../services/atistsService";
import IArtistDto from "../interfaces/IArtistDto";
import { EStatuses } from "../enum/EStatuses";
const storage = multer.diskStorage({
......
import { Document, ObjectId } from "mongoose"
export default interface IArtist extends Document{
_id: ObjectId
title: string;
artist: IArtist['_id']
releaseYear: Date
coverImage: string
}
\ No newline at end of file
import { Document, ObjectId } from "mongoose"
import IArtist from "./IArtist"
export default interface IAlbumDto extends Document{
title: string
artist: IArtist['_id']
releaseYear: Date
coverImage: File
}
\ No newline at end of file
import mongoose from "mongoose";
import IAlbum from "../interfaces/IAlbum"
const Schema = mongoose.Schema
const AlbumSchema = new Schema<IAlbum>({
title:{
type: String,
require: true
},
artist:{
type: Schema.Types.ObjectId,
ref: 'Artist',
required: true
},
releaseYear:{
type: Date,
required: true
},
coverImage:{
type: String,
required: true
}
})
export const Album = mongoose.model<IAlbum>('Artist', AlbumSchema)
\ No newline at end of file
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