fase(3): crawling module domain and application
This commit is contained in:
23
dist/modules/crawling/application/queries/ListSessionsQuery.js
vendored
Normal file
23
dist/modules/crawling/application/queries/ListSessionsQuery.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ListSessionsQuery = void 0;
|
||||
const Result_1 = require("../../../../shared/domain/Result");
|
||||
class ListSessionsQuery {
|
||||
constructor(repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
async execute(_request) {
|
||||
const sessions = await this.repository.findAll();
|
||||
const dtos = sessions.map((session) => ({
|
||||
id: session.id.toString(),
|
||||
url: session.url,
|
||||
status: session.status,
|
||||
seed: session.seed,
|
||||
maxStates: session.maxStates,
|
||||
statesVisited: session.statesVisited,
|
||||
config: session.config,
|
||||
}));
|
||||
return (0, Result_1.Ok)(dtos);
|
||||
}
|
||||
}
|
||||
exports.ListSessionsQuery = ListSessionsQuery;
|
||||
Reference in New Issue
Block a user