defichain-api / dobby

DeFiChain collateral ratio tracker
4 stars 2 forks source link

#136 User Settings #137

Closed adrian-schnell closed 2 years ago

adrian-schnell commented 2 years ago

implement #136

adrian-schnell commented 2 years ago

new endpoints: https://api.defichain-dobby.com/list/summary_interval:

{
  "summaryInterval": [
    "none",
    "daily",
    "daily_2x",
    "daily_3x",
    "hourly"
  ]
}

https://api.defichain-dobby.com/list/timezones:

{
  "timezones": {
    "Pacific/Midway": "(GMT-11:00) Midway Island",
    "US/Samoa": "(GMT-11:00) Samoa",
    "US/Hawaii": "(GMT-10:00) Hawaii",
    "US/Alaska": "(GMT-09:00) Alaska",
    "US/Pacific": "(GMT-08:00) Pacific Time (US & Canada)",
   [....]
    "Asia/Vladivostok": "(GMT+11:00) Vladivostok",
    "Asia/Magadan": "(GMT+12:00) Magadan",
    "Pacific/Auckland": "(GMT+12:00) Auckland",
    "Pacific/Fiji": "(GMT+12:00) Fiji"
  }
}
adrian-schnell commented 2 years ago

user object at GET /user has a new structure:


{
    "userId": "527e5018-d3e2-4f59-99bb-5dacb96422aa",
    "settings": {
        "language": "de",
        "summaryInterval": "hourly",
        "currentRatioEnabled": true,
        "timezone": "UTC",
        "uiPrivacyEnabled": true,
        "uiDashboardHealthSummaryEnabled": false,
        "uiDashboardCollateralInfoEnabled": false,
        "uiDashboardCollateralWaypointsEnabled": true,
        "uiTheme": "auto"
    },
    "vaults": [...]
}
``
adrian-schnell commented 2 years ago

update user settings at endpoint:

PUT /user/settings/

{
    "uiTheme": "dark",
    "language": "de",
    "summaryInterval": "daily_2x",
    "currentRatioEnabled": true,
    "uiPrivacyEnabled": false,
    "uiDashboardHealthSummaryEnabled": false,
    "uiDashboardCollateralInfoEnabled": true,
    "uiDashboardCollateralWaypointsEnabled": false,
    "timezone": "Europe/Berlin"
}

(all attributes are optional!)

codecov[bot] commented 2 years ago

Codecov Report

Merging #137 (034a6e4) into master (fe743e0) will decrease coverage by 0.12%. The diff coverage is 0.00%.

:exclamation: Current head 034a6e4 differs from pull request most recent head d08ddb1. Consider uploading reports for the commit d08ddb1 to get more accurate results

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #137      +/-   ##
===========================================
- Coverage      2.49%   2.37%   -0.13%     
- Complexity      386     409      +23     
===========================================
  Files           102     105       +3     
  Lines          1642    1728      +86     
===========================================
  Hits             41      41              
- Misses         1601    1687      +86     
Flag Coverage Δ
unittests 2.37% <0.00%> (-0.13%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
app/Api/Controller/ListController.php 0.00% <0.00%> (ø)
app/Api/Controller/UserController.php 0.00% <0.00%> (ø)
app/Api/Requests/SetupRequest.php 0.00% <0.00%> (ø)
app/Api/Requests/UpdateUserRequest.php 0.00% <0.00%> (ø)
app/Api/Service/UserService.php 0.00% <0.00%> (ø)
...ole/Commands/CurrentSummaryNotificationCommand.php 0.00% <0.00%> (ø)
app/Console/Kernel.php 18.18% <0.00%> (ø)
app/Http/Resources/UserResource.php 0.00% <0.00%> (ø)
app/Http/Resources/UserSettingResource.php 0.00% <0.00%> (ø)
app/Listeners/VaultUpdatingRatioListener.php 0.00% <0.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ca68756...d08ddb1. Read the comment docs.