This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
toAdminMarketValuationDto,
|
||||
toAdminMarketValuationSummaryDto,
|
||||
toAdminPricingObservationDto,
|
||||
} from "@pokemon-inventory/contracts/pricing";
|
||||
import {
|
||||
@@ -91,6 +92,14 @@ export async function registerAdminPricingRoutes(app, options) {
|
||||
return reply.code(201).send({ data: override });
|
||||
});
|
||||
|
||||
app.get("/valuations", async (request) => ({
|
||||
data: (
|
||||
await pricingService.listValuations({
|
||||
sellerId: request.admin.sellerId,
|
||||
})
|
||||
).map(toAdminMarketValuationSummaryDto),
|
||||
}));
|
||||
|
||||
app.post("/inventory/:id/pricing/refresh", async (request, reply) => {
|
||||
await authorizeUnsafeRequest?.(
|
||||
request.cookies[sessionCookieName],
|
||||
|
||||
@@ -203,6 +203,10 @@ export function createPricingService({
|
||||
return pricingRefreshJobRepository?.listForSeller(sellerId) ?? [];
|
||||
},
|
||||
|
||||
async listValuations({ sellerId }) {
|
||||
return pricingRepository.listLatestValuationsForSeller(sellerId);
|
||||
},
|
||||
|
||||
async retryJob({ sellerId, jobId }) {
|
||||
const job = await pricingRefreshJobRepository?.retryForSeller(
|
||||
jobId,
|
||||
|
||||
Reference in New Issue
Block a user