الملفات
boutmoun123 8863f61d00
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
Add Oudelaa dashboard API integration
2026-05-25 20:36:52 +03:00

119 أسطر
7.1 KiB
TypeScript

import { toQueryString } from "@/lib/api/core";
export const apiEndpoints = {
health: "/",
auth: {
login: "/auth/login",
refresh: "/auth/refresh",
logout: "/auth/logout",
superAdminLogin: "/auth/superadmin/login",
superAdminRefresh: "/auth/superadmin/refresh",
superAdminLogout: "/auth/superadmin/logout",
superAdminSessions: "/auth/superadmin/sessions",
revokeSuperAdminSession: (sessionId: string) => `/auth/superadmin/sessions/${sessionId}/revoke`,
},
users: {
all: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/users/admin?${toQueryString(params)}`,
byId: (userId: string) => `/users/admin/${userId}`,
update: (userId: string) => `/users/admin/${userId}`,
disable: (userId: string) => `/users/admin/${userId}/disable`,
enable: (userId: string) => `/users/admin/${userId}/enable`,
remove: (userId: string) => `/users/admin/${userId}`,
setRole: (userId: string) => `/users/admin/${userId}/role`,
admins: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/users/admin/admins?${toQueryString(params)}`,
updateAdmin: (userId: string) => `/users/admin/admins/${userId}`,
removeAdmin: (userId: string) => `/users/admin/admins/${userId}`,
createAdmin: "/users/admin/create-admin",
discover: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/users/admin/discover?${toQueryString(params)}`,
profileOverview: (userId: string) => `/users/admin/${userId}/profile-overview`,
},
posts: {
moderation: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/posts/admin/moderation?${toQueryString(params)}`,
adminDelete: (postId: string) => `/posts/admin/${postId}`,
},
comments: {
moderation: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/comments/admin?${toQueryString(params)}`,
adminDelete: (commentId: string) => `/comments/admin/${commentId}`,
},
notifications: {
superAdmin: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/notifications/superadmin?${toQueryString(params)}`,
},
reports: {
superAdmin: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/reports/superadmin?${toQueryString(params)}`,
updateStatus: (reportId: string) => `/reports/superadmin/${reportId}/status`,
},
marketplace: {
home: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/marketplace/home?${toQueryString(params)}`,
shopByAdminId: (adminId: string) => `/marketplace/shops/${adminId}`,
adminShopProfile: "/marketplace/admin/shop-profile",
adminMyShopProfile: "/marketplace/admin/shop-profile/me",
adminCreateRepairShop: "/marketplace/admin/repair-shops",
adminUpdateRepairShop: (repairShopId: string) => `/marketplace/admin/repair-shops/${repairShopId}`,
adminDeleteRepairShop: (repairShopId: string) => `/marketplace/admin/repair-shops/${repairShopId}`,
adminMyRepairShops: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/marketplace/admin/repair-shops/me?${toQueryString(params)}`,
adminCreateInstrument: "/marketplace/admin/instruments",
adminUpdateInstrument: (instrumentId: string) => `/marketplace/admin/instruments/${instrumentId}`,
adminDeleteInstrument: (instrumentId: string) => `/marketplace/admin/instruments/${instrumentId}`,
adminMyInstruments: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/marketplace/admin/instruments/me?${toQueryString(params)}`,
adminCreateListing: "/marketplace/admin/listings",
adminUpdateListing: (listingId: string) => `/marketplace/admin/listings/${listingId}`,
adminDeleteListing: (listingId: string) => `/marketplace/admin/listings/${listingId}`,
adminMyListings: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/marketplace/admin/listings/me?${toQueryString(params)}`,
moderationListings: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/marketplace/superadmin/listings?${toQueryString(params)}`,
superAdminCreateListing: (adminId: string) => `/marketplace/superadmin/admins/${adminId}/listings`,
superAdminCreateInstrument: (adminId: string) => `/marketplace/superadmin/admins/${adminId}/instruments`,
superAdminCreateRepairShop: (adminId: string) => `/marketplace/superadmin/admins/${adminId}/repair-shops`,
superAdminUpdateShopProfile: (adminId: string) => `/marketplace/superadmin/admins/${adminId}/shop-profile`,
moderationUpdateListingStatus: (listingId: string) => `/marketplace/superadmin/listings/${listingId}/status`,
moderationDeleteListing: (listingId: string) => `/marketplace/superadmin/listings/${listingId}`,
moderationRepairShops: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/marketplace/superadmin/repair-shops?${toQueryString(params)}`,
moderationUpdateRepairShopStatus: (repairShopId: string) =>
`/marketplace/superadmin/repair-shops/${repairShopId}/status`,
moderationDeleteRepairShop: (repairShopId: string) => `/marketplace/superadmin/repair-shops/${repairShopId}`,
},
audit: {
logs: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/audit/superadmin/logs?${toQueryString(params)}`,
},
superadmin: {
session: "/superadmin/session",
overview: "/superadmin/overview",
charts: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/superadmin/charts?${toQueryString(params)}`,
recentActivity: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/superadmin/recent-activity?${toQueryString(params)}`,
reports: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/superadmin/reports?${toQueryString(params)}`,
ops: "/superadmin/ops",
cases: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/superadmin/cases?${toQueryString(params)}`,
createCase: "/superadmin/cases",
caseById: (caseId: string) => `/superadmin/cases/${caseId}`,
bulkActions: "/superadmin/bulk-actions",
settings: "/superadmin/settings",
settingsHistory: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
`/superadmin/settings/history?${toQueryString(params)}`,
restoreSettingsHistory: (historyId: string) => `/superadmin/settings/history/${historyId}/restore`,
updatePostStatus: (postId: string) => `/superadmin/posts/${postId}/status`,
deletePost: (postId: string) => `/superadmin/posts/${postId}`,
restorePost: (postId: string) => `/superadmin/posts/${postId}/restore`,
updateCommentStatus: (commentId: string) => `/superadmin/comments/${commentId}/status`,
deleteComment: (commentId: string) => `/superadmin/comments/${commentId}`,
restoreComment: (commentId: string) => `/superadmin/comments/${commentId}/restore`,
updateUserStatus: (userId: string) => `/superadmin/users/${userId}/status`,
},
} as const;