{"id":15039001,"url":"https://github.com/fredimachado/productdetails","last_synced_at":"2026-03-16T16:35:19.942Z","repository":{"id":252777474,"uuid":"841425500","full_name":"fredimachado/ProductDetails","owner":"fredimachado","description":"Experimenting with GraphQL, FastEndpoints and RulesEngine","archived":false,"fork":false,"pushed_at":"2024-08-23T10:19:37.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T11:33:35.950Z","etag":null,"topics":["asp-net-core","dataloader","dotnet","dotnet-core","dotnetcore","fastendpoints","graphql","microservices","minimal-api","product","rules-engine","tagging"],"latest_commit_sha":null,"homepage":"","language":"C#","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/fredimachado.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":"2024-08-12T11:36:24.000Z","updated_at":"2024-08-23T10:19:41.000Z","dependencies_parsed_at":"2024-08-23T11:34:19.832Z","dependency_job_id":null,"html_url":"https://github.com/fredimachado/ProductDetails","commit_stats":null,"previous_names":["fredimachado/productdetails"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredimachado%2FProductDetails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredimachado%2FProductDetails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredimachado%2FProductDetails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredimachado%2FProductDetails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredimachado","download_url":"https://codeload.github.com/fredimachado/ProductDetails/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428437,"owners_count":20289317,"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":["asp-net-core","dataloader","dotnet","dotnet-core","dotnetcore","fastendpoints","graphql","microservices","minimal-api","product","rules-engine","tagging"],"created_at":"2024-09-24T20:41:10.441Z","updated_at":"2025-12-29T16:20:20.025Z","avatar_url":"https://github.com/fredimachado.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Product Details\n\nExperiments with GraphQL, FastEndpoints and RulesEngine.\n\n## ProductDetails.Api\n\nThis project is a GraphQL API that exposes endpoints for querying product details using\nusing the [HotChocolate](https://hotchocolate.io/) library.\n\n## Fetching Product Details:\n\nProduct details can be fetched by stockcode using the following GraphQL query:\n\n```graphql\nquery {\n  product(stockcode: \"1-1\") {\n    description\n    name\n    price\n    stockcode\n  }\n}\n```\n\nThis will result in the following response:\n\n```json\n{\n  \"data\": {\n    \"product\": {\n      \"description\": \"Laptop with Intel i5, 16Gb RAM and 1TB SSD\",\n      \"name\": \"Intel Laptop\",\n      \"price\": 1900,\n      \"stockcode\": \"1-1\"\n    }\n  }\n}\n```\n\n## Product Tags\n\nThe Product model was extended to include tags. Tags can be added to a product using the following query:\n\n```graphql\nquery {\n  product(stockcode: \"1-1\") {\n    description\n    name\n    price\n    stockcode\n    tags {\n      category\n      kind\n      text\n      value\n    }\n  }\n}\n```\n\nWhich will result in the following response:\n\n```json\n{\n  \"data\": {\n    \"product\": {\n      \"description\": \"Laptop with Intel i5, 16Gb RAM and 1TB SSD\",\n      \"name\": \"Intel Laptop\",\n      \"price\": 1900,\n      \"stockcode\": \"1-1\",\n      \"tags\": [\n        {\n          \"category\": \"New\",\n          \"kind\": \"Information\",\n          \"text\": \"New\",\n          \"value\": \"\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## DataLoader to avoid the N+1 problem\n\nFetching multiple products can result in the N+1 problem, which will cause multiple database queries to be executed,\ndue to GraphQL field resolvers being atomic and not knowing about the query as a whole.\nThis can be avoided by using a DataLoader, which will batch all requests together into one query to the database.\n\nData Loaders were implemented for both Product and ProductTag models.\n\n## Managing Products\n\nThe Api project also exposes REST API endpoints for managing products. Swagger UI can be used to interact with the API.\n\n## Security\n\nThe REST API is secured using JWT tokens.\n\nIn local development environment, a token can be generated using the `user-jwt` tool.\nExecute the following command from the ProductDetails.Api project directory:\n\n```bash\ndotnet user-jwts create --audience productdetails-api --audience productdetails-promotion-api --role Admin --claim \"AdminId=1\"\"\n```\n\nThis will generate a JWT token that can be used to authenticate to both ProductDetails REST API and Promotion API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredimachado%2Fproductdetails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredimachado%2Fproductdetails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredimachado%2Fproductdetails/lists"}