189 أسطر
11 KiB
TypeScript
189 أسطر
11 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: {
|
|
meProfileSetup: "/users/me/profile-setup",
|
|
meMusicSetup: "/users/me/music-setup",
|
|
me: "/users/me",
|
|
publicList: "/users",
|
|
publicById: (userId: string) => `/users/${userId}`,
|
|
publicDiscover: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/users/discover?${toQueryString(params)}`,
|
|
publicProfileOverview: (userId: string) => `/users/${userId}/profile-overview`,
|
|
publicPresence: (userId: string) => `/users/${userId}/presence`,
|
|
publicPosts: (userId: string, params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/users/${userId}/posts?${toQueryString(params)}`,
|
|
follow: (userId: string) => `/users/${userId}/follow`,
|
|
unfollow: (userId: string) => `/users/${userId}/follow`,
|
|
followStatus: (userId: string) => `/users/${userId}/follow-status`,
|
|
followers: (userId: string, params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/users/${userId}/followers?${toQueryString(params)}`,
|
|
following: (userId: string, params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/users/${userId}/following?${toQueryString(params)}`,
|
|
myFollowers: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/users/me/followers?${toQueryString(params)}`,
|
|
myFollowing: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/users/me/following?${toQueryString(params)}`,
|
|
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: {
|
|
create: "/posts",
|
|
reelsCreate: "/posts/reels",
|
|
reels: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/posts/reels?${toQueryString(params)}`,
|
|
byId: (postId: string) => `/posts/${postId}`,
|
|
byUser: (userId: string, params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/posts/user/${userId}?${toQueryString(params)}`,
|
|
update: (postId: string) => `/posts/${postId}`,
|
|
repost: (postId: string) => `/posts/${postId}/repost`,
|
|
commentSettings: (postId: string) => `/posts/${postId}/comment-settings`,
|
|
pinProfile: (postId: string) => `/posts/${postId}/pin-profile`,
|
|
unpinProfile: (postId: string) => `/posts/${postId}/unpin-profile`,
|
|
archive: (postId: string) => `/posts/${postId}/archive`,
|
|
restoreArchive: (postId: string) => `/posts/${postId}/restore-archive`,
|
|
remove: (postId: string) => `/posts/${postId}`,
|
|
view: (postId: string) => `/posts/${postId}/view`,
|
|
play: (postId: string) => `/posts/${postId}/play`,
|
|
share: (postId: string) => `/posts/${postId}/share`,
|
|
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: {
|
|
mine: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/notifications?${toQueryString(params)}`,
|
|
unreadCount: "/notifications/unread-count",
|
|
markRead: (notificationId: string) => `/notifications/${notificationId}/read`,
|
|
markAllRead: "/notifications/read-all",
|
|
superAdmin: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/notifications/superadmin?${toQueryString(params)}`,
|
|
},
|
|
follows: {
|
|
toggle: "/follows/toggle",
|
|
followers: (userId: string, params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/follows/followers/${userId}?${toQueryString(params)}`,
|
|
following: (userId: string, params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/follows/following/${userId}?${toQueryString(params)}`,
|
|
status: (targetUserId: string) => `/follows/status/${targetUserId}`,
|
|
suggestions: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/follows/suggestions?${toQueryString(params)}`,
|
|
requests: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/follows/requests?${toQueryString(params)}`,
|
|
approveRequest: (requestId: string) => `/follows/requests/${requestId}/approve`,
|
|
rejectRequest: (requestId: string) => `/follows/requests/${requestId}/reject`,
|
|
},
|
|
devices: {
|
|
register: "/devices/register",
|
|
unregister: "/devices/unregister",
|
|
},
|
|
collaborationRequests: {
|
|
create: (postId: string) => `/posts/${postId}/collaboration-requests`,
|
|
list: (params: Record<string, string | number | boolean | null | undefined> = {}) =>
|
|
`/collaboration-requests?${toQueryString(params)}`,
|
|
approve: (requestId: string) => `/collaboration-requests/${requestId}/approve`,
|
|
reject: (requestId: string) => `/collaboration-requests/${requestId}/reject`,
|
|
},
|
|
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;
|