{"id":21144168,"url":"https://github.com/straw-hat-labs/straw_hat_review","last_synced_at":"2025-12-12T00:12:56.386Z","repository":{"id":57553757,"uuid":"120837222","full_name":"straw-hat-labs/straw_hat_review","owner":"straw-hat-labs","description":"Review System","archived":false,"fork":false,"pushed_at":"2019-11-01T13:36:26.000Z","size":405,"stargazers_count":11,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-16T22:44:25.642Z","etag":null,"topics":["elixir","elixir-lang","otp","reviews"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/straw_hat_review","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/straw-hat-labs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-09T00:52:13.000Z","updated_at":"2020-01-12T03:19:53.000Z","dependencies_parsed_at":"2022-08-28T11:22:20.951Z","dependency_job_id":null,"html_url":"https://github.com/straw-hat-labs/straw_hat_review","commit_stats":null,"previous_names":["straw-hat-team/straw_hat_review"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/straw-hat-labs/straw_hat_review","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/straw-hat-labs%2Fstraw_hat_review","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/straw-hat-labs%2Fstraw_hat_review/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/straw-hat-labs%2Fstraw_hat_review/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/straw-hat-labs%2Fstraw_hat_review/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/straw-hat-labs","download_url":"https://codeload.github.com/straw-hat-labs/straw_hat_review/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/straw-hat-labs%2Fstraw_hat_review/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264405864,"owners_count":23603027,"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":["elixir","elixir-lang","otp","reviews"],"created_at":"2024-11-20T08:08:50.820Z","updated_at":"2025-12-12T00:12:56.355Z","avatar_url":"https://github.com/straw-hat-labs.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StrawHat.Review\n\n\n[![Health Checking](https://github.com/straw-hat-team/straw_hat_review/workflows/Health%20Checking/badge.svg)](https://github.com/straw-hat-team/straw_hat_review/actions)\n[![Code Coverage](https://codecov.io/gh/straw-hat-team/straw_hat_review/branch/master/graph/badge.svg)](https://codecov.io/gh/straw-hat-team/straw_hat_review)\n[![Docs Health](https://inch-ci.org/github/straw-hat-team/straw_hat_review.svg)](https://inch-ci.org/github/straw-hat-team/straw_hat_review)\n\n`StrawHat.Review` will help you to add reviews to your systems. We took\ninspiration from Amazon, Lyf, Google, Uber and Fiverr review systems.\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `straw_hat_review` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:straw_hat_review, \"~\u003e 0.1\"}\n  ]\nend\n```\n\n## Usage\n\nWe will cover the basic interactions of the systems but please check out\neach Interactor module which are the ones that expose the API that developers\nshould be using.\n\n### Aspects\n\nLet's create some aspects based on Fiverr Reviews.\n\n```elixir\n  # id: 1\n  StrawHat.Review.Aspects.create_review(%{\n    name: \"seller_communication\"\n  })\n\n  # id: 2\n  StrawHat.Review.Aspects.create_review(%{\n    name: \"service_as_described\"\n  })\n\n  # id: 3\n  StrawHat.Review.Aspects.create_review(%{\n    name: \"would_recommend\"\n  })\n```\n\n### Reviews\n\nNow let's give some review to a user.\n\nNormally the reviewee and reviewer are just an string that your systems will\nknow how to do the aggregation with that data. For example, your system that\nuses `StrawHat.Review` knows that `\"user:\" \u003c\u003e user_id` is the way to read back\nthe user id of the reviewee and reviewer.\n\n```elixir\n  # id: 1\n  StrawHat.Review.Review.create_review(%{\n    reviewee_id: \"user:1\",\n    reviewer_id: \"user:2\",\n    comment: \"Amazing experience, I really recommended it\",\n    aspects: [\n      %{\n        aspect_id: 1, # seller_communication\n        score: 5\n      },\n      %{\n        aspect_id: 2, # service_as_described\n        score: 5\n      },\n      %{\n        aspect_id: 3, # would_recommend\n        score: 5\n      }\n    ]\n    medias: [\n      %Plug.Upload{\n        content_type: \"image/png\",\n        filename: \"some_random_file_name.png\",\n        path: \"~tmp/some_random_name.png\"\n      }\n    ]\n  })\n```\n\n### Comments\n\nNow we could add some comments to the review.\n\n```elixir\n  # id: 1\n  StrawHat.Review.Comments.create_comment(%{\n    comment: \"Really helpful review, thank you very much\",\n    owner_id: \"user:3\",\n    review_id: 1\n  })\n```\n\n### Reactions\n\nWe could create some reactions for the systems so it could be use later\non reviews and comments.\n\n```elixir\n  # id: 1\n  StrawHat.Review.Reactions.create_reaction(%{\n    name: \"like\"\n  })\n\n  # id: 2\n  StrawHat.Review.Reactions.create_reaction(%{\n    name: \"dislike\"\n  })\n```\n\nNow we could react to the reviews and comments\n\n```elixir\n  StrawHat.Review.ReviewReactions.create_review_reaction(%{\n    review_id: 1,\n    reaction_id: 1,\n    user_id: \"user:1\"\n  })\n\n  StrawHat.Review.CommentReactions.create_comment_reaction(%{\n    review_id: 1,\n    reaction_id: 1,\n    user_id: \"user:1\"\n  })\n```\n\nThat is a basic usage of the package. Check the interactor modules for more\navailable APIs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstraw-hat-labs%2Fstraw_hat_review","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstraw-hat-labs%2Fstraw_hat_review","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstraw-hat-labs%2Fstraw_hat_review/lists"}