2021-03-15 02:30:47 +00:00
|
|
|
'use strict';
|
|
|
|
|
2021-03-17 04:11:17 +00:00
|
|
|
const {
|
|
|
|
stashActor,
|
|
|
|
stashScene,
|
|
|
|
stashMovie,
|
|
|
|
unstashActor,
|
|
|
|
unstashScene,
|
|
|
|
unstashMovie,
|
2021-03-20 01:03:30 +00:00
|
|
|
updateStash,
|
2021-03-17 04:11:17 +00:00
|
|
|
} = require('../stashes');
|
2021-03-15 02:30:47 +00:00
|
|
|
|
2021-03-20 01:03:30 +00:00
|
|
|
async function updateStashApi(req, res) {
|
|
|
|
const stash = await updateStash(req.params.stashId, req.body, req.session.user);
|
|
|
|
|
|
|
|
res.send(stash);
|
|
|
|
}
|
|
|
|
|
2021-03-15 02:30:47 +00:00
|
|
|
async function stashActorApi(req, res) {
|
|
|
|
await stashActor(req.body.actorId, req.params.stashId, req.session.user);
|
|
|
|
|
|
|
|
res.status(201).send();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function stashSceneApi(req, res) {
|
|
|
|
await stashScene(req.body.sceneId, req.params.stashId, req.session.user);
|
|
|
|
|
|
|
|
res.status(201).send();
|
|
|
|
}
|
|
|
|
|
2021-03-17 04:11:17 +00:00
|
|
|
async function stashMovieApi(req, res) {
|
|
|
|
await stashMovie(req.body.movieId, req.params.stashId, req.session.user);
|
|
|
|
|
|
|
|
res.status(201).send();
|
|
|
|
}
|
|
|
|
|
2021-03-15 02:30:47 +00:00
|
|
|
async function unstashActorApi(req, res) {
|
|
|
|
await unstashActor(req.params.actorId, req.params.stashId, req.session.user);
|
|
|
|
|
|
|
|
res.status(204).send();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function unstashSceneApi(req, res) {
|
|
|
|
await unstashScene(req.params.sceneId, req.params.stashId, req.session.user);
|
|
|
|
|
|
|
|
res.status(204).send();
|
|
|
|
}
|
|
|
|
|
2021-03-17 04:11:17 +00:00
|
|
|
async function unstashMovieApi(req, res) {
|
|
|
|
await unstashMovie(req.params.movieId, req.params.stashId, req.session.user);
|
|
|
|
|
|
|
|
res.status(204).send();
|
|
|
|
}
|
|
|
|
|
2021-03-15 02:30:47 +00:00
|
|
|
module.exports = {
|
|
|
|
stashActor: stashActorApi,
|
|
|
|
stashScene: stashSceneApi,
|
2021-03-17 04:11:17 +00:00
|
|
|
stashMovie: stashMovieApi,
|
2021-03-15 02:30:47 +00:00
|
|
|
unstashActor: unstashActorApi,
|
|
|
|
unstashScene: unstashSceneApi,
|
2021-03-17 04:11:17 +00:00
|
|
|
unstashMovie: unstashMovieApi,
|
2021-03-20 01:03:30 +00:00
|
|
|
updateStash: updateStashApi,
|
2021-03-15 02:30:47 +00:00
|
|
|
};
|