Skip to content

Conversation

@arthurbz
Copy link

Interview Solution Submission

Candidate Name: Arthur Bassotto Ziero
Interview Date: May 19th


Solution Overview

The solution emphasizes clear separation between layers (resolvers, services, DTOs) and uses validation to ensure data integrity.

It implements five core functionalities:

  • Create movies
  • Update movies
  • Find all movies
  • Find movie by ID
  • Find highest rated movies

While I didn't have much prior experience with NestJS, GraphQL, or DynamoDB, I drew from my background in structuring large-scale projects to focus on building a clean and concise solution.


Key Implementation Details

  • Technologies/Languages Used:

    • Node.js
    • TypeScript
    • Nest.js
    • Apollo
    • GraphQL
    • DynamoDB
  • Main Components/Files Modified:

src/
├── database/                   # Database configuration and providers
├── movies/                     # Movies module
│   ├── dto/                    # Data Transfer Objects
│   ├── entities/               # GraphQL entities
│   ├── movies.module.ts
│   ├── movies.resolver.ts
│   └── movies.service.ts
└── main.ts                     # Application entry point
  • Algorithm/Approach:
    Built CRUD operations using NestJS services and GraphQL resolvers with input validation with class-validator. For querying the highest rated movies, I've used GSI instead of normal scan as this is a more efficient way of fetching data.

Testing & Validation

  • Code compiles/runs without errors
  • All requirements from the problem statement are addressed
  • Added comments explaining complex logic
  • Additional test cases considered.

I did ad hoc testing. I focused on solving the most basic cases, like making sure a movie existed before updating it. In a real scenario, automated testing would not only be helpful but, a necessary step to make sure the code meets the quality standards


Time Spent

Approximately 4 hours for the coding plus 20 minutes for this PR.


Additional Notes

There are two main points regarding the Separation of Concerns, that I'd love to improve if I had more time:

1. Database Gateway with dependency injection
I would create a gateway between the DynamoDB client and the service layer to make our code database-agnostic. We could define an interface to specify the expected type in our service, and through dependency injection, let Nest inject the gateway implementation using DynamoDB into the service.

2. Domain objects and object mappers
In the code I delivered, the layers are well-defined (service, resolvers, DTOs), but for a large project, it would be important to create domain objects and object mappers. This approach allows the business logic layer to communicate using domain objects rather than directly using entity representations. To achieve this, a domain entity mapper would need to be implemented to translate domain objects into entities and vice versa.


Submission Confirmation

  • I have reviewed my code for quality and completeness
  • I am ready for this solution to be evaluated
  • I understand this completes my technical interview submission

Demo

I've attached this video with the project running locally. You can check for more information on how to run the project locally on my README.

MovieAPI-GraphQL-Demo.mp4

Ready for Review: Please review my submission

@ericcheatham
@damonique-dev


Thank you for your time and consideration. I look forward to discussing this solution with you.

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