go-exercises-backend, v1.3
Posted on

Back-end of the service for solving programming exercises.
Calculate a total correctness flag based on all solutions of a requesting author; sort the tasks and solutions; process pagination for the tasks and solutions; allow a solution task author to get solutions of other authors.
Change Log
- RESTful API:
- models:
- task model:
- operations:
- getting all tasks:
- join an additional data:
- join an author data to the results;
- calculate a total correctness flag based on all solutions of a requesting author;
- sort the results by creation time in descending order;
- process pagination:
- implemented using an offset and a limit;
- join an additional data:
- getting a single task by an ID:
- join an additional data:
- join an author data to the results;
- calculate a total correctness flag based on all solutions of a requesting author;
- join an additional data:
- getting all tasks:
- operations:
- solution model:
- operations:
- getting all solutions by a task ID:
- join an author data to the results;
- filtered by a requesting author:
- allow a solution task author to get solutions of other authors;
- sort the results by creation time in descending order;
- process pagination:
- implemented using an offset and a limit;
- getting a single solution by an ID:
- join an author data to the results;
- allow a solution task author to get solutions of other authors.
- getting all solutions by a task ID:
- operations:
- task model:
- models:
Features
- RESTful API:
- models:
- task model:
- storing:
- author ID;
- title;
- description;
- boilerplate code;
- test cases:
- all test cases are represented by a single string;
- operations:
- getting all tasks:
- calculate a total correctness flag based on all solutions of a requesting author;
- sort the results by creation time in descending order;
- process pagination:
- implemented using an offset and a limit;
- getting a single task by an ID:
- calculate a total correctness flag based on all solutions of a requesting author;
- creating;
- updating by an ID:
- allowed for its author only;
- deleting by an ID:
- allowed for its author only;
- getting all tasks:
- storing:
- solution model:
- storing:
- author ID;
- task ID;
- code;
- correctness flag;
- testing result:
- represented by a string;
- operations:
- getting all solutions by a task ID:
- filtered by a requesting author:
- allow a solution task author to get solutions of other authors;
- sort the results by creation time in descending order;
- process pagination:
- implemented using an offset and a limit;
- filtered by a requesting author:
- getting a single solution by an ID:
- allowed for:
- solution author;
- solution task author;
- allowed for:
- creating;
- updating by an ID:
- performed by a queue consumer only (see below);
- getting all solutions by a task ID:
- storing:
- task model:
- representing:
- in a JSON:
- payloads:
- of requests;
- of responses;
- payloads:
- as a plain text:
- errors;
- in a JSON:
- models:
- server:
- additional routing:
- serving static files;
- storing settings in environment variables;
- supporting graceful shutdown;
- logging:
- logging requests;
- logging errors;
- panics:
- recovering on panics;
- logging of panics;
- additional routing:
- authentication:
- use the Bearer authentication scheme based on JSON Web Tokens:
- store in a JWT claims:
- expiration time claim;
- user claim:
- contains a whole user model;
- store in a JWT claims:
- generate a token signing key automatically by default;
- user model:
- storing:
- username (unique);
- password hash:
- generated using the bcrypt function;
- storing:
- use the Bearer authentication scheme based on JSON Web Tokens:
- databases:
- storing data in the PostgreSQL database;
- interaction with queues:
- using the RabbitMQ message broker;
- common properties:
- automatic declaring of the used queues;
- passing of a message data in JSON;
- operations:
- producing solutions:
- concurrent producing;
- consuming solution results:
- concurrent consuming;
- once requeue the solution on failure;
- producing solutions:
- utilities:
- utility for managing users:
- commands:
- add a user:
- parameters:
- username;
- password:
- generate automatically by default;
- password hashing cost;
- generated password length;
- parameters:
- add a user:
- commands:
- utility for managing users:
- distributing:
- Docker image;
- Docker Compose configuration.
Repository
Link: https://github.com/thewizardplusplus/go-exercises-backend/tree/v1.3.
Content: code.
License: MIT.