{"id":21179847,"url":"https://github.com/italopessoa/sfate","last_synced_at":"2026-05-17T12:33:05.012Z","repository":{"id":88414167,"uuid":"113922557","full_name":"italopessoa/sfate","owner":"italopessoa","description":"A REST API that receives a request and should select two engineers at random to both complete a half day of support each.","archived":false,"fork":false,"pushed_at":"2018-05-21T00:39:13.000Z","size":88,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T18:49:47.669Z","etag":null,"topics":["aspnetcore","dotnetcore","entity-framework-core","jwt","jwt-token","rest","rest-api","swagger","tdd","webapi","xunit"],"latest_commit_sha":null,"homepage":"https://italopessoa.gitlab.io/support-wheel-of-fate-fr","language":"C#","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/italopessoa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-12-12T00:11:27.000Z","updated_at":"2021-04-29T02:12:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4c6f53e-76dd-41b8-8c4b-353676127b35","html_url":"https://github.com/italopessoa/sfate","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/italopessoa/sfate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/italopessoa%2Fsfate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/italopessoa%2Fsfate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/italopessoa%2Fsfate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/italopessoa%2Fsfate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/italopessoa","download_url":"https://codeload.github.com/italopessoa/sfate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/italopessoa%2Fsfate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33138333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["aspnetcore","dotnetcore","entity-framework-core","jwt","jwt-token","rest","rest-api","swagger","tdd","webapi","xunit"],"created_at":"2024-11-20T17:34:32.737Z","updated_at":"2026-05-17T12:33:04.984Z","avatar_url":"https://github.com/italopessoa.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SFate - API\n\nA REST API that receives a request and should select two engineers at random to both complete a half day of support each. The API works by itself, you can do all the operations and test the results on your browser.\n\n[![Build status](https://ci.appveyor.com/api/projects/status/517lk04q410q7kyf?svg=true)](https://ci.appveyor.com/project/italopessoa/support-wheel-of-fate)\n# [Check it out ](http://swfbau.azurewebsites.net/swagger)\n\n## Controllers\n### ShiftController \n- Create and list engineer turns\n\n### AuthController\n- Authenticate users using [JWT](https://jwt.io), even though there is no solid user management implementation, token based authentication works just fine, and will make easier to integrate with other clients.\n\n### ValuesController\n- Used to list some application settings\n\n## Settings\n```json\n    \"Jwt\": {\n        \"Issuer\": \"http://localhost:5000\",\n        \"Audience\": \"http://localhost:5000\",\n        \"Key\": \"veryVerySecretKey\",\n        \"LifeTimeInMinutes\":\"30\"\n    },\n    \"App\":{\n        \"MAX_SHIFT_SUM_HOURS_DURATION\": \"8\",\n        \"WEEK_SCAN_PERIOD\" : \"1\",\n        \"SHIFT_DURATION\" : \"4\"\n    }\n```\n- MAX_SHIFT_SUM_HOURS_DURATION: \n    - maximum amount of shifts (in hours) a engineer can do on in a period of N weeks\n- WEEK_SCAN_PERIOD\n    - set how many weeks to take in count to filter engineers\n    - e.g 1: the current week and the previous one, therefore 2 weeks\n - SHIFT_DURATION\n    - how long (in hours) lasts a shift\n    \n`To avoid creating a new table with only two values that will barely change, I decided to use environment variables to store them.`\n\n## Continuous integrations \u0026 Continuous Delivery\n- AppVeyor\n- Windows Azure App Service\n\n```yaml\nversion: 1.0.{build}\nbranches:\n  only:\n  - master\nimage: Visual Studio 2017\nconfiguration: Release\nplatform: Any CPU\ndotnet_csproj:\n  patch: true\n  file: '**\\*.csproj'\n  version: '{version}'\n  package_version: '{version}'\n  assembly_version: '{version}'\n  file_version: '{version}'\n  informational_version: '{version}'\nbuild_script:\n- cmd: \u003e-\n    dotnet build BAU.Api\n\n    dotnet publish -c Release BAU.Api\ntest_script:\n- cmd: dotnet test .\\BAU.Test\\\nartifacts:\n- path: '\\BAU.Api\\bin\\Any CPU\\Release\\netcoreapp2.0\\publish'\n  name: WebApi\n  type: WebDeployPackage\ndeploy:\n- provider: Environment\n  name: BAU-production\n```\n## Architecture\n\nUsing a simple Controller-\u003e Service -\u003e Repository implementation the code is organized in folders just for simplicity and avoid configuration errors on the on the beginning of developmento. \n- Repositories are in the folder DAL (Data Access Layer)\n- Services are in the folder Service\n- Since almost everything is covered by tests, in the future, those parts should be put in separated `Class Libraries`\n- create  Startup class diferent files of to hold different settings\n\n## Packages\n- Microsoft.EntityFrameworkCore\n- Swashbuckle.AspNetCore\n- AutoMapper\n\n## Running\nSet `SqlServer` connections string value or use Entity Framework in Memory (Startup.cs).\n\nExecute\n\n```cmd\ndotnet restore\ncd BAU.Api\ndotnet run\n```\nWhen access the swagger interface use the following credentials to authenticate:\n```json\n{\n  \"username\": \"support\",\n  \"password\": \"support\"\n}\n```\n## DRAFTS\n```sql\n--engenheiros sem turno e sem turno consecutivo\nDECLARE @TODAY DATE = CONVERT(DATE, GETDATE())\nDECLARE @TOMORROW DATE = CONVERT(DATE, DATEADD(DAY,1,GETDATE()))\nDECLARE @YESTERDAY DATE = CONVERT(DATE, DATEADD(DAY,-1,GETDATE()))\nDECLARE @MAX_SHIFT_HOURS_ALLOWED INT = 8\nSELECT eg.id,EG.name\nFROM \n\tENGINEER EG \n\tLEFT JOIN ENGINEERSHIFT EGS \n\t\tON EG.ID = EGS.ENGINEERID\nWHERE \n\t(EGS.SHIFTDATE IS NOT NULL AND EGS.SHIFTDATE BETWEEN DATEADD(DAY, -13, @TODAY) AND @TODAY)\n\tOR (\n\t\tEGS.SHIFTDATE IS NULL --AINDA NAO POSSUEM TURNO\n\t\tOR (\n\t\t\tEGS.SHIFTDATE \u003c\u003e @YESTERDAY \n\t\t\tAND EGS.SHIFTDATE \u003c\u003e @TOMORROW\n\t\t\tAND EGS.SHIFTDATE \u003c\u003e @TODAY\n\t\t\t) --NAO POSSUI TURNO ONTEM, HOJE OU AMANHA\n\t\t)\nGROUP BY \n\teg.id,EG.name\nHAVING \n\tSUM(EGS.DURATION) \u003c @MAX_SHIFT_HOURS_ALLOWED OR SUM(EGS.DURATION) IS NULL\n``` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitalopessoa%2Fsfate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitalopessoa%2Fsfate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitalopessoa%2Fsfate/lists"}