|
@@ -6,9 +6,13 @@ const express_graphql = require('express-graphql');
|
|
|
const { buildSchema, printSchema } = require('graphql');
|
|
|
const expand = require('mm-graphql/expand')
|
|
|
const fs = require('fs')
|
|
|
+
|
|
|
const uploadPath = `${__dirname}/public/images/`;
|
|
|
const upload = require('multer')({ dest: uploadPath })
|
|
|
|
|
|
+const uploadTrackPath = `${__dirname}/public/track/`;
|
|
|
+const uploadTrack = require('multer')({ dest: uploadTrackPath, fieldSize: 1024*1024*128 })
|
|
|
+
|
|
|
|
|
|
;(async () => {
|
|
|
|
|
@@ -53,9 +57,19 @@ const upload = require('multer')({ dest: uploadPath })
|
|
|
url: String,
|
|
|
originalFileName: String,
|
|
|
owner: User
|
|
|
+ id3: ID3
|
|
|
playlists: [Playlist]
|
|
|
}
|
|
|
|
|
|
+ type ID3 {
|
|
|
+ title: String
|
|
|
+ artist: String
|
|
|
+ album: String
|
|
|
+ year: String
|
|
|
+ genre: String
|
|
|
+ trackNumber: String
|
|
|
+ }
|
|
|
+
|
|
|
input TrackInput {
|
|
|
_id: ID,
|
|
|
playlists: [PlaylistInput]
|
|
@@ -70,6 +84,7 @@ const upload = require('multer')({ dest: uploadPath })
|
|
|
tracks: [Track]
|
|
|
}
|
|
|
|
|
|
+
|
|
|
input PlaylistInput {
|
|
|
_id: ID,
|
|
|
name: String
|
|
@@ -102,7 +117,7 @@ const upload = require('multer')({ dest: uploadPath })
|
|
|
})
|
|
|
|
|
|
|
|
|
- app.post('/track', upload.single('track'), async (req, res, next) => {
|
|
|
+ app.post('/track', uploadTrack.single('track'), async (req, res, next) => {
|
|
|
let decoded;
|
|
|
console.log('wtf')
|
|
|
if (decoded = jwtCheck(req, jwtSecret)){
|