{"id":20575969,"url":"https://github.com/limeskey/showcase-voter-api","last_synced_at":"2026-04-16T23:37:19.176Z","repository":{"id":259540230,"uuid":"877935353","full_name":"LimesKey/showcase-voter-api","owner":"LimesKey","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-24T22:15:54.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T19:43:21.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/LimesKey.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-10-24T13:50:06.000Z","updated_at":"2024-10-25T15:08:57.000Z","dependencies_parsed_at":"2024-10-26T10:41:44.026Z","dependency_job_id":"3ab483cb-c1dc-434a-9b03-21ff7c2ab676","html_url":"https://github.com/LimesKey/showcase-voter-api","commit_stats":null,"previous_names":["limeskey/showcase-voter-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimesKey%2Fshowcase-voter-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimesKey%2Fshowcase-voter-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimesKey%2Fshowcase-voter-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimesKey%2Fshowcase-voter-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LimesKey","download_url":"https://codeload.github.com/LimesKey/showcase-voter-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242196313,"owners_count":20087765,"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-11-16T05:44:13.337Z","updated_at":"2026-04-16T23:37:14.137Z","avatar_url":"https://github.com/LimesKey.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare Wrangler API Program\n\nThis document provides instructions and usage examples for the Cloudflare Wrangler API Program.\n\n## Table of Contents\n- [Cloudflare Wrangler API Program](#cloudflare-wrangler-api-program)\n  - [Table of Contents](#table-of-contents)\n  - [Introduction](#introduction)\n  - [Setup](#setup)\n  - [API Endpoints](#api-endpoints)\n    - [Submit Vote](#submit-vote)\n      - [Request Body](#request-body)\n      - [Response](#response)\n  - [Database Schema](#database-schema)\n    - [Users Table](#users-table)\n    - [Submissions Table](#submissions-table)\n    - [Votes Table](#votes-table)\n  - [Error Handling](#error-handling)\n    - [Example Error Response](#example-error-response)\n\n## Introduction\n\nThis API allows users to submit votes for different submissions. It ensures that users and submissions exist in the database and handles vote counting.\n\n## Setup\n\n1. **Install Dependencies**:\n    ```sh\n    pnpm install\n    ```\n\n2. **Build the Project**:\n    ```sh\n    pnpm run build\n    ```\n\n3. **Start the Development Server**:\n    ```sh\n    pnpm run dev\n    ```\n\n## API Endpoints\n\n### Submit Vote\n\n- **Endpoint**: `/vote`\n- **Method**: `POST`\n- **Description**: Submits a vote for a specific submission and category.\n\n#### Request Body\n\n```json\n{\n  \"submissionId\": \"string\",\n  \"slackID\": \"string\",\n  \"hashedSlackID\": \"string\",\n  \"category\": \"string\"\n}\n```\n\n#### Response\n\n- **Success**: \n    - **Status**: `200 OK`\n    - **Body**:\n        ```json\n        {\n          \"success\": \"Vote submitted successfully\"\n        }\n        ```\n- **Errors**:\n    - **Status**: `409 Conflict`\n        ```json\n        {\n          \"error\": \"User {slackID} has reached the maximum vote count of 3\"\n        }\n        ```\n    - **Status**: `409 Conflict`\n        ```json\n        {\n          \"error\": \"User {slackID} has already voted for submission {submissionId} in category {category}\"\n        }\n        ```\n    - **Status**: `500 Internal Server Error`\n        ```json\n        {\n          \"error\": \"Failed to submit vote\"\n        }\n        ```\n\n## Database Schema\n\n### Users Table\n\n| Column       | Type    | Description                  |\n|--------------|---------|------------------------------|\n| slack_id     | TEXT    | Unique identifier for the user|\n| hashed_slackid | TEXT  | Hashed Slack ID              |\n| username     | TEXT    | Username of the user         |\n| vote_count   | INTEGER | Number of votes cast by the user |\n\n### Submissions Table\n\n| Column         | Type    | Description                  |\n|----------------|---------|------------------------------|\n| submission_id  | TEXT    | Unique identifier for the submission |\n| category       | TEXT    | Category of the submission   |\n| votes          | INTEGER | Number of votes for the submission |\n\n### Votes Table\n\n| Column         | Type    | Description                  |\n|----------------|---------|------------------------------|\n| submission_id  | INTEGER | ID of the submission         |\n| slack_id       | TEXT    | ID of the user               |\n| category       | TEXT    | Category of the vote         |\n\n## Error Handling\n\nErrors are returned with appropriate HTTP status codes and a JSON body containing the error message.\n\n### Example Error Response\n\n```json\n{\n  \"error\": \"User {slackID} has reached the maximum vote count of 3\"\n}\n```\n\nEnsure to handle errors gracefully in your client application by checking the status codes and displaying relevant messages to the user.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimeskey%2Fshowcase-voter-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimeskey%2Fshowcase-voter-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimeskey%2Fshowcase-voter-api/lists"}