{"id":26475802,"url":"https://github.com/fabogit/jobinterview_api-data","last_synced_at":"2026-04-10T07:57:22.060Z","repository":{"id":273430606,"uuid":"919245258","full_name":"fabogit/JobInterview_api-data","owner":"fabogit","description":"A server made for an interview assignment","archived":false,"fork":false,"pushed_at":"2025-01-21T17:32:26.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T23:49:56.874Z","etag":null,"topics":["docker","nestjs","postgresql","prisma","swagger","typescript"],"latest_commit_sha":null,"homepage":"","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/fabogit.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}},"created_at":"2025-01-20T03:13:59.000Z","updated_at":"2025-01-29T01:37:11.000Z","dependencies_parsed_at":"2025-01-20T22:22:36.409Z","dependency_job_id":"65329017-70ea-473f-9ae5-e4120458a98c","html_url":"https://github.com/fabogit/JobInterview_api-data","commit_stats":null,"previous_names":["fabogit/planetwatch","fabogit/jobinterview_api-data"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabogit%2FJobInterview_api-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabogit%2FJobInterview_api-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabogit%2FJobInterview_api-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabogit%2FJobInterview_api-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabogit","download_url":"https://codeload.github.com/fabogit/JobInterview_api-data/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244525599,"owners_count":20466545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker","nestjs","postgresql","prisma","swagger","typescript"],"created_at":"2025-03-19T23:50:00.615Z","updated_at":"2026-04-10T07:57:21.988Z","avatar_url":"https://github.com/fabogit.png","language":"TypeScript","funding_links":["https://opencollective.com/nest","https://paypal.me/kamilmysliwiec"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\u003cimg src=\"https://nestjs.com/img/logo-small.svg\" width=\"120\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456\n[circleci-url]: https://circleci.com/gh/nestjs/nest\n\n  \u003cp align=\"center\"\u003eA progressive \u003ca href=\"http://nodejs.org\" target=\"_blank\"\u003eNode.js\u003c/a\u003e framework for building efficient and scalable server-side applications.\u003c/p\u003e\n    \u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/~nestjscore\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@nestjs/core.svg\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/~nestjscore\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/@nestjs/core.svg\" alt=\"Package License\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/~nestjscore\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/@nestjs/common.svg\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://circleci.com/gh/nestjs/nest\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/circleci/build/github/nestjs/nest/master\" alt=\"CircleCI\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/github/nestjs/nest?branch=master\" target=\"_blank\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9\" alt=\"Coverage\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://discord.gg/G7Qnnhy\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/discord-online-brightgreen.svg\" alt=\"Discord\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/nest#backer\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/nest/backers/badge.svg\" alt=\"Backers on Open Collective\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/nest#sponsor\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/nest/sponsors/badge.svg\" alt=\"Sponsors on Open Collective\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://paypal.me/kamilmysliwiec\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-ff3f59.svg\" alt=\"Donate us\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://opencollective.com/nest#sponsor\"  target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg\" alt=\"Support us\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://twitter.com/nestframework\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/nestframework.svg?style=social\u0026label=Follow\" alt=\"Follow us on Twitter\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n  \u003c!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)\n  [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)--\u003e\n\n## Description\n\n[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.\n\n## Project setup\n\n```bash\n$ pnpm install\n```\n\n## Compile and run the project\n\n```bash\n# development\n$ pnpm run start\n\n# watch mode\n$ pnpm run start:dev\n\n# production mode\n$ pnpm run start:prod\n```\n\n## Run tests\n\n```bash\n# unit tests\n$ pnpm run test\n\n# e2e tests\n$ pnpm run test:e2e\n\n# test coverage\n$ pnpm run test:cov\n```\n\n## Deployment\n\nWhen you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.\n\nIf you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:\n\n```bash\n$ pnpm install -g mau\n$ mau deploy\n```\n\nWith Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.\n\n## Resources\n\nCheck out a few resources that may come in handy when working with NestJS:\n\n- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.\n- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).\n- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).\n- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.\n- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).\n- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).\n- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).\n- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).\n\n## Support\n\nNest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).\n\n## Stay in touch\n\n- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)\n- Website - [https://nestjs.com](https://nestjs.com/)\n- Twitter - [@nestframework](https://twitter.com/nestframework)\n\n## License\n\nNest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).\n\n\n~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n\n# Project Readme\n\nThis project is a Node.js application written in TypeScript. It implements three REST APIs and interacts with a PostgreSQL database. The APIs are hosted on `localhost:{PORT}` and handle data storage, retrieval, and environment variable access. Below is an overview of the requirements, implementation details, and setup instructions.\n\n---\n\n## Features\n\n1. **API to Write Data to the Database**\n\n   - Endpoint: `/write`\n   - Method: `POST`\n   - Accepts JSON payload with the following format:\n     ```json\n     {\n       \"name\": \"string\",\n       \"value\": \"string\",\n       \"required\": \"boolean\"\n     }\n     ```\n   - Adds data to the database or fails if the `name` is already present.\n\n2. **API to Read Data from the Database**\n\n   - Endpoint: `/read`\n   - Method: `GET`\n   - Returns all rows from the database in JSON format.\n\n3. **API to Read Custom Variable (`env`)**\n   - Endpoint: `/env`\n   - Method: `GET`\n   - Returns the value of the custom environment variable defined in `constants.ts`.\n\n---\n\n## Data Model\n\n- Table Name: `DataTable`\n- Columns:\n  - `id` (Primary Key, Auto Increment)\n  - `DataName` (String, Unique)\n  - `DataValue` (String)\n  - `DataRequired` (Boolean)\n\n---\n\n## Technical Details\n\n- **Framework**: NestJS\n- **Language**: TypeScript\n- **Database**: PostgreSQL\n- **Build Tool**: `tsc`\n- **Environment Variables**: Defined in `constants.ts`\n- **ORM**: Prisma\n\n---\n\n## Features Implemented\n\n- OpenAPI documentation using Swagger.\n- JSDoc comments for functions.\n- Automatic database table creation and migrations using Prisma.\n- Code linting with ESLint.\n- Input validation using class-validator.\n- REST APIs to update and delete data rows.\n- Configurable port using environment variables.\n- Dockerized PostgreSQL database for easy setup.\n\n---\n\n## Project Structure\n\n```\ndocker/\n├── docker-compose.yaml\n├── docker.env\nprisma/\n├── schema.prisma\n├── migrations/\nsrc/\n├── app.module.ts\n├── main.ts\n├── modules/\n│ ├── data/\n│ │ ├── data.controller.ts\n│ │ ├── data.service.ts\n│ │ ├── data.module.ts\n│ │ ├── dto/\n│ │ │ ├── create-data.dto.ts\n│ │ │ ├── update-data.dto.ts\n.env\n```\n\n---\n\n## Setup Instructions\n\n### Prerequisites\n\n- Git\n- Node.js LTS (v22+)\n- Docker\n- pnpm (preferred package manager)\n\n### Install Dependencies\n\n`pnpm install`\n\nSet Up Environment Variables Create a .env file in the project root with the following content:\n\n```\nDATABASE_URL=\"postgresql://myuser:mypassword@localhost:5432/mydatabase\"\nPORT=3000\nVARIABLE=\"a string\"\n```\n\n### Run Database in Docker\n\n`pnpm run docker up` and `pnpm run docker down`\n\n### Generate schema\n\n`pnpm prisma generate`\n\n### Run Migrations\n\n`pnpm prisma migrate dev`\n\n### Start the Server\n\n`pnpm start`\n\n## API Endpoints\n\n### 1. Create a New Data Entry\n\n- **Endpoint**: `POST /data`\n- **Description**: Adds a new data entry to the database.\n- **Request Body**:\n\n    ```json\n    {\n    \"name\": \"exampleName\",\n    \"value\": \"exampleValue\",\n    \"required\": true\n    }\n    ```\n\n- **Responses**:\n\n  - `201 Created`: Data created successfully.\n\n  - `400 Bad Request`: Invalid request or server error.\n\n  - `409 Conflict`: Data with this name already exists.\n\n### 2. Get All Data Entries\n\n- **Endpoint**: GET /data\n- **Description**: Retrieves all data entries from the database.\n- **Responses**:\n\n  - `200 OK`: Returns an array of data entries.\n\n    ```json\n    [\n        {\n        \"id\": 1,\n        \"DataName\": \"exampleName\",\n        \"DataValue\": \"exampleValue\",\n        \"DataRequired\": true\n        }\n    ]\n    ```\n\n  - `400 Bad Request`: Server error.\n\n### 3. Update an Existing Data Entry\n\n- **Endpoint**: PATCH /data/:name\n- **Description**: Updates an existing data entry by its name.\n- **Request** Parameters: name (string, path): The name of the data entry to update.\n- **Request** Body:\n\n    ```json\n    {\n    \"value\": \"updatedValue\",\n    \"required\": false\n    }\n    ```\n\n- **Responses**:\n\n  - `200 OK`: Data updated successfully.\n\n  - `400 Bad Request`: Invalid request or server error.\n\n  - `404 Not Found`: Data with the given name does not exist.\n\n### 4. Delete a Data Entry\n\n- **Endpoint**: DELETE /data/:name\n- **Description**: Deletes an existing data entry by its name.\n- **Request Parameters**: name (string, path): The name of the data entry to delete.\n\n- **Responses**:\n\n  - `200 OK`: Data deleted successfully.\n\n  - `400 Bad Request`: Server error.\n\n  - `404 Not Found`: Data with the given name does not exist.\n\n### 5. Get the Value of an Environment Variable\n\n- **Endpoint**: GET /data/env\n- **Description**: Retrieves the value of an environment variable by its key.\n\n- **Request Query**:\n  key (string, query): The key of the environment variable.\n\n- **Responses**:\n\n  - `200 OK`: Returns the value of the requested environment variable.\n\n    ```json\n    {\n        \"key\": \"exampleKey\",\n        \"value\": \"exampleValue\"\n    }\n    ```\n\n  - `400 Bad Request`: Missing or invalid key query parameter.\n\n  - `404 Not Found`: Environment variable with the given key does not exist.\n\nAll REST APIs return JSON responses.\n\nAPI documentation is available at http://localhost:{PORT}/api.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabogit%2Fjobinterview_api-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabogit%2Fjobinterview_api-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabogit%2Fjobinterview_api-data/lists"}