Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semana 4 > Actividad 4 > "Contribution Open Source" #161

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mabvmex
Copy link

@mabvmex mabvmex commented May 13, 2022

  1. Se agregan pruebas de unidad para services/ExplorerService.test.js y server.test.js
  2. Se agrega endpoint en lib/server.js:

/v1/explorers/stack/:stack

  1. Se agrega funcionalidad en lib/services/ExplorerService.js

getExplorersUsernamesByStack()

  • Se extrae el listado completo de "explorers".
  • Se extra el listado de stacks de cada explorer que incluya el criterio de búsqueda definido en el endpoint que llega a traves del controlador ExplorerControler.
  • Se extrae un listado de los username de los explorers que contengan el criterio de búsqueda ya aplicado a la lista de explorers filtrada anteriormente:

    static getExplorersUsernamesByStack(explorers, stack) {
        const explorers_JSstack = explorers.filter((singleExplorer) =>
            singleExplorer.stacks.includes(stack)
        );

        const usernames_JSstack = explorers_JSstack.map(
            (singleExplorer_JSstack) => singleExplorer_JSstack.githubUsername
        );
        return usernames_JSstack;
    }
  1. Se agrega funcionalidad en lib/controllers/ExplorerController.js

getExplorerByStack()

  • Se ejecuta la función que entrega el criterio stack definido en el request, a través de la función ExplorerService:
   static getExplorerByStack(stack) {
        const explorer = Reader.readJsonFile("explorers.json");
        const explorerStack = ExplorerService.getExplorersUsernamesByStack(
            explorer,
            stack
        );
        return explorerStack;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant