You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
627 B
18 lines
627 B
const models = require('../models'); |
|
import * as api from '../../client/src/api'; |
|
|
|
export const CreateArtistEndpointHandler = (req: any, res: any) => { |
|
if (!api.checkCreateArtistRequest(req)) { |
|
console.log('Invalid CreateArtist request: ' + JSON.stringify(req.body)); |
|
res.sendStatus(400); |
|
return; |
|
} |
|
const reqObject: api.CreateArtistRequest = req.body; |
|
models.Artist.create(reqObject) |
|
.then((artist: any) => { |
|
const responseObject: api.CreateArtistResponse = { |
|
id: artist.id |
|
}; |
|
res.status(200).send(responseObject); |
|
}) |
|
} |