Skip to main content

ListingService

@adamondo/backend


@adamondo/backend / application/services/ListingService

application/services/ListingService

Classes

ListingService

Defined in: src/application/services/ListingService.ts:14

Coordinates listing-specific business operations across repositories.

Constructors

Constructor

new ListingService(uow): ListingService

Defined in: src/application/services/ListingService.ts:15

Parameters
uow

UnitOfWork

Returns

ListingService

Methods

checkListing()

checkListing(id): Promise<number>

Defined in: src/application/services/ListingService.ts:22

Checks whether a listing exists and returns legacy status codes used by current resolvers.

Parameters
id

number

Listing identifier.

Returns

Promise<number>

200 when the listing exists, otherwise 400.

updateBlockedDates()

updateBlockedDates(params): Promise<{ status: string; errorMessage?: string; }>

Defined in: src/application/services/ListingService.ts:34

Upserts blocked date records for a listing after validating date payload and reservation conflicts.

Parameters
params

Blocked date operation payload.

listId

number

blockedDates

string[]

calendarStatus

ListBlockedDates_calendarStatus

isSpecialPrice

number

Returns

Promise<{ status: string; errorMessage?: string; }>

Operation status and optional validation error message.

managePublish()

managePublish(params): Promise<{ status: number; errorMessage?: string; }>

Defined in: src/application/services/ListingService.ts:93

Publishes or unpublishes a listing with ownership and readiness checks.

Parameters
params

Publish/unpublish request payload.

listId

number

action

string

userId

string

canManageAnyListing

boolean

getListingSetupReadiness

(listing) => Promise<{ ready: boolean; missingSections: string[]; }>

getListingPublishReadiness

(userId, listId) => Promise<{ ready: boolean; missing: string[]; pendingReview: string[]; needsFix: string[]; }>

Returns

Promise<{ status: number; errorMessage?: string; }>

HTTP-like status and optional domain validation message.

adminSearchListings()

adminSearchListings(params): Promise<{ usersData: any[]; count: number; }>

Defined in: src/application/services/ListingService.ts:189

Returns paginated admin listing search data.

Parameters
params

Pagination and optional query filters.

currentPage?

number

searchQuery?

string

Returns

Promise<{ usersData: any[]; count: number; }>

Paginated listing payload with total count.

getListingDashboardStats()

getListingDashboardStats(): Promise<{ totalCount: number; todayCount: number; monthCount: number; }>

Defined in: src/application/services/ListingService.ts:214

Aggregates listing dashboard totals for admin analytics.

Returns

Promise<{ totalCount: number; todayCount: number; monthCount: number; }>