{"id":40615335,"url":"https://github.com/andreger/projectmark-takehome","last_synced_at":"2026-01-21T06:02:25.269Z","repository":{"id":289941878,"uuid":"972653635","full_name":"andreger/projectmark-takehome","owner":"andreger","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-25T21:07:20.000Z","size":82,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T22:19:45.162Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-25T12:39:06.000Z","updated_at":"2025-04-25T21:07:23.000Z","dependencies_parsed_at":"2025-04-30T04:30:33.006Z","dependency_job_id":null,"html_url":"https://github.com/andreger/projectmark-takehome","commit_stats":null,"previous_names":["andreger/projectmark-takehome"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andreger/projectmark-takehome","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreger%2Fprojectmark-takehome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreger%2Fprojectmark-takehome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreger%2Fprojectmark-takehome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreger%2Fprojectmark-takehome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreger","download_url":"https://codeload.github.com/andreger/projectmark-takehome/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreger%2Fprojectmark-takehome/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28628701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-21T06:02:24.573Z","updated_at":"2026-01-21T06:02:25.239Z","avatar_url":"https://github.com/andreger.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ProjectMark API\n\nA REST API for managing **topics** (with versioning and hierarchy), **resources**, and **users** (with role-based access control).\n\n## About me\n\nMy name is André Gervásio.\n\nThank you for this opportunity. Over the past few days, I have dedicated time and effort to developing this task. I sincerely hope it meets your expectations. I would appreciate the chance to discuss the decisions I made, explore areas for improvement, and receive any feedback you may have.\n\nhttps://www.linkedin.com/in/andregervasio/\n\n## Installation\n\n1. Clone this repository:\n\n   ```bash\n   git clone https://github.com/andreger/projectmark-takehome\n   ```\n\n2. Navigate to the `projectmark-takehome` folder:\n\n   ```bash\n   cd projectmark-takehome\n   ```\n\n3. Start Docker Compose:\n\n   ```bash\n   docker compose up -d\n   ```\n\n   The application will run on port `3000`.\n\n4. seed the database:\n\n   ```bash\n   docker exec projectmark_api npm run seed\n   ```\n\n5. Access the API on `http://localhost:3000`.\n\n## Database\n\nThe project uses **SQLite** for local development:\n\n- The database is stored in a file:  \n  **`database.sqlite`** (located in the project root).\n- The file is automatically created **if it does not exist** when you run:\n  ```bash\n  docker compose up -d\n  ```\n- You can **delete** the `database.sqlite` file at any time to reset the database.\n- After deleting or recreating the database, **remember to seed it again** using the command below.\n\n## Database Seeding\n\nTo insert default users and sample topics:\n\n```bash\ndocker exec projectmark_api npm run seed\n```\n\n## Default Users\n\n| Email                | Password    | Role   |\n| :------------------- | :---------- | :----- |\n| `admin@example.com`  | `admin123`  | Admin  |\n| `editor@example.com` | `editor123` | Editor |\n| `viewer@example.com` | `viewer123` | Viewer |\n\n## Authentication\n\n### 1. Login\n\n**Endpoint:** `POST /api/auth/login`\n\n**Request Body:**\n\n```json\n{\n  \"email\": \"admin@example.com\",\n  \"password\": \"admin123\"\n}\n```\n\n**Response:**\n\n```json\n{\n  \"access_token\": \"\u003cjwt-token\u003e\"\n}\n```\n\n### 2. Using the Token\n\nFor all protected endpoints, set the token in the **Authorization** header:\n\n```\nAuthorization: Bearer \u003caccess_token\u003e\n```\n\n## API Endpoints\n\n`ProjectMark.postman_collection.json` file, located in the project's root folder, is a Postman-exported collection containing all API endpoints.\n\n### Authentication\n\n| Method | Endpoint          | Description                     |\n| :----: | :---------------- | :------------------------------ |\n|  POST  | `/api/auth/login` | Log in and retrieve a JWT token |\n\n### Topics\n\n| Method | Endpoint                           | Description                                    |\n| :----: | :--------------------------------- | :--------------------------------------------- |\n|  GET   | `/api/topics`                      | List all topics                                |\n|  POST  | `/api/topics`                      | Create a new topic (optionally with parent ID) |\n|  GET   | `/api/topics/:id`                  | Get a topic by ID                              |\n|  GET   | `/api/topics/:id/tree`             | Get a topic and its descendants as a tree      |\n|  GET   | `/api/topics/:id/version/:version` | Get a specific version of a topic              |\n| PATCH  | `/api/topics/:id`                  | Update a topic                                 |\n| DELETE | `/api/topics/:id`                  | Delete a topic                                 |\n|  GET   | `/api/topics/:fromId/path/:toId`   | Find the shortest path between two topics      |\n\n### Resources\n\n| Method | Endpoint             | Description           |\n| :----: | :------------------- | :-------------------- |\n|  GET   | `/api/resources`     | List all resources    |\n|  GET   | `/api/resources/:id` | Get a resource by ID  |\n|  POST  | `/api/resources`     | Create a new resource |\n| PATCH  | `/api/resources/:id` | Update a resource     |\n| DELETE | `/api/resources/:id` | Delete a resource     |\n\n### Users\n\n| Method | Endpoint         | Description       |\n| :----: | :--------------- | :---------------- |\n|  GET   | `/api/users`     | List all users    |\n|  GET   | `/api/users/:id` | Get a user by ID  |\n|  POST  | `/api/users`     | Create a new user |\n| PATCH  | `/api/users/:id` | Update a user     |\n| DELETE | `/api/users/:id` | Delete a user     |\n\n## Notes\n\n- **Authentication Required**:  \n  All `/api/*` endpoints (except `/api/auth/login`) require a valid **Bearer token**.\n- **RBAC (Role-Based Access Control)**:  \n  Actions like creating, updating, or deleting require appropriate permissions based on the user's role (Admin, Editor, Viewer).\n- **Validation**:  \n  All incoming requests are validated using DTOs (`class-validator`).\n- **Good Practices (Disclaimer)**:\n  Due to time constraints, some architectural and engineering best practices — such as more granular service/repository/factory abstractions, unit and integration testing, and advanced modularization — were not fully implemented. These would be prioritized in a production-ready version of this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreger%2Fprojectmark-takehome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreger%2Fprojectmark-takehome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreger%2Fprojectmark-takehome/lists"}