{"id":13879349,"url":"https://github.com/solnic/rom-workshop","last_synced_at":"2025-04-24T07:16:16.026Z","repository":{"id":66168179,"uuid":"186145488","full_name":"solnic/rom-workshop","owner":"solnic","description":null,"archived":false,"fork":false,"pushed_at":"2019-05-17T18:32:36.000Z","size":28,"stargazers_count":5,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T07:16:11.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/solnic.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":"2019-05-11T14:50:32.000Z","updated_at":"2020-09-18T08:22:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"a724bbf3-ec85-45b4-877b-6dece7a12c4b","html_url":"https://github.com/solnic/rom-workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2From-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2From-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2From-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2From-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solnic","download_url":"https://codeload.github.com/solnic/rom-workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250580750,"owners_count":21453537,"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":[],"created_at":"2024-08-06T08:02:17.965Z","updated_at":"2025-04-24T07:16:16.021Z","avatar_url":"https://github.com/solnic.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Persistence with rom-rb\n\n## Exercises\n\n### Setup\n\n- [ ] `bundle install`\n\n### Getting started, writing data\n\n- [ ] Write a migration for an \"articles\" table\n  - `id` primary key, `title` text, and `published` boolean columns\n- [ ] Create a relation (with inferred schema)\n- [ ] Create a repo for the relation\n- [ ] Create some records\n  - enable `create` command on repo\n- [ ] Use `#by_pk` to read records back\n- [ ] Update some records\n  - enable `update` comand on repo using `by_pk` restriction\n\n### Building queries\n\n- [ ] Add methods to repository to query and return multiple records\n  - [ ] listing of published articles\n- [ ] Move lower-level query methods into relation\n  - `#published` method in relation\n  - update repository to use this method\n  - create some articles where published is both true and false, ensure they're returned as appropriate\n- [ ] Add methods to repository to return single records\n- [ ] Create shared `articles` method in repository to ensure all query methods return only published articles\n- [ ] Return results as custom structs via a custom struct namespace\n\n### Reading aggregates\n\n- [ ] Write a migration for an associated \"authors\" table\n  - `id` primary key and `name` text column\n  - add `author_id` foreign key to \"articles\" table\n- [ ] Add a relation for the table and declare associations\n  - declare `belongs_to :author` association in \"articles\" relation\n- [ ] Create a repository for authors, with \"create\" command enabled\n- [ ] Create author records\n- [ ] Create article records with `author_id` attribute filled\n- [ ] In \"articles\" repository, return aggregate objects including the articles' authors\n\n### Changesets\n\n- [ ] Implement `publish(author, article)` in the articles repository that will use `:create` changeset to create a new article, mark it as published and associate with the author\n- [ ] Implement `unpublish(article)` in the articles repository that will use `:update` changeset to mark the article as not published\n\n## Further exploration...\n\n### Building queries\n\n- [ ] Return custom structs using `map_to`\n- [ ] Investigate using dry-struct to build custom struct classes with strict attribute types\n\n### Testing\n\n- [ ] Write tests for your repository methods\n  - Use rom-factory to create records\n  - Write tests to assert that repository methods return appropriate records\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolnic%2From-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolnic%2From-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolnic%2From-workshop/lists"}