🚨 fix: resolve linting type error

This commit is contained in:
Rafi Arrafif
2026-01-31 08:13:04 +07:00
parent 5a43769f69
commit 68fec64efc
11 changed files with 21 additions and 35 deletions

View File

@ -1,5 +1,12 @@
import { Context } from "elysia"; import { Context } from "elysia";
export const isAdminMiddleware = (ctx: Context) => { export const isAdminMiddleware = (ctx: Context) => {
//validate here const isAdmin = ctx.headers["isAdmin"];
if (!isAdmin) {
ctx.set.status = 403;
return {
error: "Forbidden",
message: "You don't have access to this resource",
};
}
}; };

View File

@ -1,6 +1,5 @@
import { AppError } from "../../../../helpers/error/instances/app"; import { AppError } from "../../../../helpers/error/instances/app";
import { jwtDecode } from "../../../../helpers/http/jwt/decode"; import { jwtDecode } from "../../../../helpers/http/jwt/decode";
import { jwtEncode } from "../../../../helpers/http/jwt/encode";
export const tokenValidationService = (payload: string) => { export const tokenValidationService = (payload: string) => {
try { try {

View File

@ -1,4 +1,3 @@
import { Prisma } from "@prisma/client";
import { getEpisodeReferenceAPI } from "../../../../config/apis/episode.reference"; import { getEpisodeReferenceAPI } from "../../../../config/apis/episode.reference";
import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder"; import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder";
import { MediaEpisodeInfoResponse } from "../../types/mediaEpisodeInfo.type"; import { MediaEpisodeInfoResponse } from "../../types/mediaEpisodeInfo.type";

View File

@ -1,6 +1,5 @@
import { SystemAccountId } from "../../../../config/account/system"; import { SystemAccountId } from "../../../../config/account/system";
import { getContentReferenceAPI } from "../../../../config/apis/media.reference"; import { getContentReferenceAPI } from "../../../../config/apis/media.reference";
import { generateUUIDv7 } from "../../../../helpers/databases/uuidv7";
import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder"; import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder";
import { bulkInsertCharactersRepository } from "../../repositories/bulkInsertCharacters.repository"; import { bulkInsertCharactersRepository } from "../../repositories/bulkInsertCharacters.repository";
import { bulkInsertLangVARepository } from "../../repositories/bulkInsertLangVA.repository"; import { bulkInsertLangVARepository } from "../../repositories/bulkInsertLangVA.repository";

View File

@ -1,5 +1,4 @@
import { SystemAccountId } from "../../../../config/account/system"; import { SystemAccountId } from "../../../../config/account/system";
import { generateUUIDv7 } from "../../../../helpers/databases/uuidv7";
import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder"; import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder";
import { bulkInsertVoiceActorRepository } from "../../repositories/bulkInsertVoiceActor.repository"; import { bulkInsertVoiceActorRepository } from "../../repositories/bulkInsertVoiceActor.repository";
import { Person } from "../../types/mediaCharWithVAInfo"; import { Person } from "../../types/mediaCharWithVAInfo";

View File

@ -34,12 +34,12 @@ interface Data {
year: number; year: number;
broadcast: Broadcast; broadcast: Broadcast;
producers: Genre[]; producers: Genre[];
licensors: any[]; licensors: unknown[];
studios: Genre[]; studios: Genre[];
genres: Genre[]; genres: Genre[];
explicit_genres: any[]; explicit_genres: unknown[];
themes: Genre[]; themes: Genre[];
demographics: any[]; demographics: unknown[];
relations: Relation[]; relations: Relation[];
theme: Theme; theme: Theme;
external: External[]; external: External[];

View File

@ -10,7 +10,7 @@ interface Data {
name: string; name: string;
given_name: null; given_name: null;
family_name: null; family_name: null;
alternate_names: any[]; alternate_names: string[];
birthday: Date; birthday: Date;
favorites: number; favorites: number;
about: string; about: string;

View File

@ -6,14 +6,17 @@ const includeOptions = ["preference", "assignedRoles"] as const;
export const getUserOptionsSchema = z.object({ export const getUserOptionsSchema = z.object({
verbosity: z.enum( verbosity: z.enum(
["exists", "basic", "full"], ["exists", "basic", "full"],
"option: verbosity value must match with enum types" "option: verbosity value must match with enum types",
), ),
include: z include: z
.string() .string()
.optional() .optional()
.transform((val) => val?.split(",") ?? []) .transform((val) => val?.split(",") ?? [])
.refine( .refine(
(arr) => arr.every((val) => includeOptions.includes(val.trim() as any)), (arr) =>
"option: include value didn't match with enum types" arr.every((val) =>
includeOptions.includes(val.trim() as typeof includeOptions[number]),
),
"option: include value didn't match with enum types",
), ),
}); });

View File

@ -2,26 +2,6 @@ import { Prisma } from "@prisma/client";
import { ErrorForwarder } from "../../../helpers/error/instances/forwarder"; import { ErrorForwarder } from "../../../helpers/error/instances/forwarder";
import { userSessionModel } from "../userSession.model"; import { userSessionModel } from "../userSession.model";
type CreateUserSessionResponse = Prisma.UserSessionGetPayload<{
select: {
id: true;
deviceType: true;
isAuthenticated: true;
validUntil: true;
user: {
select: {
id: true;
name: true;
email: true;
username: true;
avatar: true;
birthDate: true;
bioProfile: true;
};
};
};
}>;
export const createUserSessionRepository = async ( export const createUserSessionRepository = async (
data: Prisma.UserSessionUncheckedCreateInput, data: Prisma.UserSessionUncheckedCreateInput,
) => { ) => {

View File

@ -1,4 +1,4 @@
import { minioBucketName, minioClient } from "../client"; import { minioClient } from "../client";
import { ensureBucketExists } from "../validations/ensureBucketExists"; import { ensureBucketExists } from "../validations/ensureBucketExists";
export const getStreamFile = async (filename: string) => { export const getStreamFile = async (filename: string) => {

View File

@ -1,4 +1,4 @@
import { minioBucketName, minioClient, minioProtocol } from "../client"; import { minioBucketName, minioClient } from "../client";
import { ensureBucketExists } from "../validations/ensureBucketExists"; import { ensureBucketExists } from "../validations/ensureBucketExists";
import { Readable } from "stream"; import { Readable } from "stream";
@ -7,7 +7,7 @@ export const uploadFile = async (
options?: { options?: {
fileDir?: string; fileDir?: string;
fileName?: string; fileName?: string;
} },
): Promise<string> => { ): Promise<string> => {
// Ensure the target MinIO bucket exists before performing any upload // Ensure the target MinIO bucket exists before performing any upload
await ensureBucketExists(); await ensureBucketExists();