Coder Social home page Coder Social logo

zpi-2023 / sensobackend Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 376 KB

Backend of the application made for the Team Project course taken in the last semester of BSc studies. Built in ASP.NET. ๐Ÿ‘ด๐Ÿ“ฑ

C# 99.74% Dockerfile 0.20% Shell 0.06%
asp-net thesis-project zpi

sensobackend's People

Contributors

daxin18 avatar jakubzehner avatar tchojnacki avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

sensobackend's Issues

Add profile creation endpoint

Blocked by:


POST /api/v1/account/profiles/senior

  • no payload
  • response:
    • 204 No Content and creates a senior profile if this account doesn't have it already
    • 409 Conflict if this account already has a senior profile

GET /api/v1/account/profiles/senior - used to display QR code as a senior

  • no payload
  • response:
    • 200 OK with { "encodedSeniorId": string } if this account has a senior profile, this response should be encoded the same way as POST /api/v1/account/profiles/caretaker
    • 404 Not Found if this account doesn't have a senior profile

POST /api/v1/account/profiles/caretaker - called after scanning a senior's QR code

  • payload: { "encodedSeniorId": string, "seniorAlias": string } - account ID of senior which you want to pair with, encoded with a symmetric algorithm and a secret key
  • response:
    • 204 No Content and creates the caretaker profile if the encodedSeniorId matches an existing senior in the DB
    • 403 Forbidden if the encodedSeniorId is invalid

NOTE: GET /api/v1/account/profiles/caretaker should not exist, since we always pair starting with senior for safety/security reasons

Explore NSubstitute usage in tests

Discovered during #20.

The tests using Moq are pretty ugly, don't interplay with FluentAssertions and require a lot of boilerplate. Check if NSubstitute would be any better.

Setup CI

Tests, code formatter, artifacts?

Add git hooks

We can use for example: Husky.Net
We should have rule that does not allow to commit to main
and to commit only correctly formatted code by csharpier

Add dashboard controller and tiles endpoint

GET /api/v1/dashboard/:seniorId
PUT /api/v1/dashboard/:seniorId

Example response (up to consideration):

{
  "gadgets": ["games", "medication"]
}
  • Backend uses account ID from token combined with seniorId from path to determine the correct dashboard.
  • Get and update should be supported.
  • Many forms of data storage should be considered: Postgres JSON blob, Postgres array type, 3NF3.
  • There should be some validation in place, for example regarding the maximum length.

Research and implement CQRS pattern on backend

Deploy backend to the web

We need a public deployment of the app to have it actually work. We should probably use Azure or FlyIO.

Add LICENSE

  • Add LICENSE section to README
  • Add LICENSE file to the project

Create a healthcheck endpoint

A lot of things can go wrong with the frontend<->backend communication: server down, configuration issues, invalid auth, etc. We can rule out many of such failure causes using a healthcheck route. It would be a simple endpoint which returns a 200 OK status code if the server is ready and other status codes for failures.

We can then call this endpoint from frontend at the start of an app and display an error in case of failure to easily detect issues with invalid backend setup. Without this, if we for instance get errors on the login screen, we cannot be immediately sure whether it is bug in the app or an issue with connection, hosting, CORS, etc.

Additionally, Dockerfiles support HEALTHCHECK instructions which can help us detect regressions.

GET /api/v1/health

Add account controller and profiles endpoint

Blocked by:

GET /api/v1/account/profiles

Example response:

{
  "profiles": [
    { "type": "caretaker", "seniorId": 2137, "seniorAlias": "John" },
    { "type": "caretaker", "seniorId": 123, "seniorAlias": "Kate" },
    { "type": "senior", "seniorId": 789 }
  ]
}
  • Backend uses the token from the request to find account's profiles and returns all of them.
    • The endpoint may also return 0, or 1 entries.
  • There can be only one entry with type senior per account.
  • seniorId is unique within the list and required on each entry.
    • For type caretaker, seniorId of senior taken care of should be returned and their seniorAlias set by this caretaker.
    • For type senior, seniorId should be this account's ID.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.