{"id":22868297,"url":"https://github.com/markfchavez/gr_backend","last_synced_at":"2026-01-28T06:06:15.459Z","repository":{"id":68182926,"uuid":"168146505","full_name":"MarkFChavez/gr_backend","owner":"MarkFChavez","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-29T12:15:03.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T15:53:11.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/MarkFChavez.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-01-29T11:53:04.000Z","updated_at":"2019-01-29T12:15:05.000Z","dependencies_parsed_at":"2023-02-26T19:00:46.147Z","dependency_job_id":null,"html_url":"https://github.com/MarkFChavez/gr_backend","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/MarkFChavez%2Fgr_backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkFChavez%2Fgr_backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkFChavez%2Fgr_backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkFChavez%2Fgr_backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkFChavez","download_url":"https://codeload.github.com/MarkFChavez/gr_backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246458022,"owners_count":20780675,"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-12-13T12:33:12.522Z","updated_at":"2026-01-28T06:06:15.416Z","avatar_url":"https://github.com/MarkFChavez.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"I only added the columns to which I feel plays an important role to make all\nof this work.\n\nWe create a `users` table that stores the record of both sellers and \ncustomers. I come up with this decision because I feel that a seller can also\nbuy a product from different sellers. Thus, acting as both a `seller` and a\n`customer`. \n\nThe `products` table simply stores the seller's collection of products. We\nadd an index to `seller_id` so that we can efficiently query the products that\na seller offers.\n\n## Solution\n\n`Users` table\n\n| Name          | Type           |\n| ------------- |:-------------: |\n| first_name    | string         |\n| last_name     | string         |\n| email         | string         |\n\n`Products` table\n\n| Name          | Type           |\n| ------------- |:-------------: |\n| name          | string         |\n| image         | string         |\n| description   | text           |\n| price         | decimal        |\n| seller_id     | integer **(indexed)** |\n\n`Orders` table\n\n| Name          | Type           |\n| ------------- |:-------------: |\n| ref_no        | string         |\n| price         | decimal        |\n| product_id    | integer **(indexed)** |\n| customer_id   | integer **(indexed)** |\n| purchased_at  | datetime **(indexed)** |\n| refunded_at   | datetime **(indexed)** |\n\n\n## Concerns\n\n\u003e How can each purchase increase the seller's balance?\n\nWe compute seller's total current balance by getting the total of all the orders\nwhich are not refunded. Every addition of an order record should essentially \nincrease the seller's balance.\n\n\u003e How do a seller refund a purchase?\n\nWe simply update the order's `refunded_at` column to the current time. This will\nmark the order as refunded. I was thinking of using a `status` column but I feel\nlike recording a timestamp is a far better solution because it lets us query the\nrefunded orders based on date range.\n\nWhen a purchase is refunded, it should decrease the seller's balance.\n\n\u003e How do the rolling payouts work?\n\nIf we want to roll a payout for a specific time period, we can do that by\ngetting all non-refunded orders with `purchased_at` only within the given\ntime period.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkfchavez%2Fgr_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkfchavez%2Fgr_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkfchavez%2Fgr_backend/lists"}