mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 13:40:24 +02:00
Move server directory outside of frontend src
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { Request, Response } from 'express';
|
||||
import { ApiSuccess, getSuccessResponse } from '@/utils';
|
||||
import { service } from '@services/index';
|
||||
import { validation, TypedRequest } from '@validations/index';
|
||||
|
||||
const getList = async (req: Request, res: Response) => {
|
||||
const { take, skip, serverFolderIds } = req.query;
|
||||
const albumArtists = await service.albumArtists.findMany(req, {
|
||||
serverFolderIds: String(serverFolderIds),
|
||||
skip: Number(skip),
|
||||
take: Number(take),
|
||||
user: req.authUser,
|
||||
});
|
||||
|
||||
const success = ApiSuccess.ok({
|
||||
data: albumArtists.data,
|
||||
paginationItems: {
|
||||
skip: Number(skip),
|
||||
take: Number(take),
|
||||
totalEntries: albumArtists.totalEntries,
|
||||
url: req.originalUrl,
|
||||
},
|
||||
});
|
||||
|
||||
return res.status(success.statusCode).json(getSuccessResponse(success));
|
||||
};
|
||||
|
||||
const getDetail = async (
|
||||
req: TypedRequest<typeof validation.albumArtists.detail>,
|
||||
res: Response
|
||||
) => {
|
||||
const { id } = req.params;
|
||||
const albumArtist = await service.albumArtists.findById({
|
||||
id,
|
||||
user: req.authUser,
|
||||
});
|
||||
|
||||
const success = ApiSuccess.ok({ data: albumArtist });
|
||||
return res.status(success.statusCode).json(getSuccessResponse(success));
|
||||
};
|
||||
|
||||
export const albumArtistsController = {
|
||||
getDetail,
|
||||
getList,
|
||||
};
|
||||
Reference in New Issue
Block a user