Giter VIP home page Giter VIP logo

mapper-influence's People

Contributors

112batuhan avatar boraarslan avatar dependabot[bot] avatar fursum avatar

Watchers

 avatar  avatar

mapper-influence's Issues

get_user endpoint needs to return different data

get_user function should return:

  • user id
  • user name
  • avatar url
  • background url
  • user title
  • number of users influenced
  • user group array:
    • group color

      hexcode

    • group short name

      ex: NAT

    • group long name

      ex: Nomination Assesment Team

Store timestamps of influences

We want to store the timestamp of creation and the last modification of the influence.

API should return both properties

Basic Authentication

A /login and /logout endpoint is required.

Login endpoint

// Request 
POST API_URL/login
body: {
  code: "xxx",
}

// Response 201
{
  token: "xxx",
  user: { // This is the bare minimum info to populate the header. {id} will be used as a link
    id: number,
    username: string,
    avatarUrl: string,
    groups?: Group[] // This might not be needed, maybe can be used to color the avatar border
  }
}

Logout endpoint

// Request
DELETE API_URL/logout
body: {
  token: "xxx"
}

// Response 204
no content

Create endpoints to return user data

Two endpoints are needed:

1 - Base user info

Returns basic user information such as user id, name and avatar url.
This is just a proxy for the osu api, there is probably a function that implements the api request already.

2 - Extended user info

Returns the information needed to populate the profile page.
This includes their bio, influences and mentions on top of the base user info.


Up to you if you want to include the base info in the extended info endpoint.
If you want a more specific return type, tag me.

Need public leaderboard api

The leaderboard is shown in the homepage, so it shouldnt have authorization requirement
Number of users returned could be a dynamic number from the query, with max and min values of course.

Returned array of values:

  • user data

    same as get_user

  • influence count

    number of users who added this person

array should be ordered by influence count

Handle expired cookies

Backend should control and handle expired cookies

  • Delete cookie when user session is expired

route user to /dashboard from landing page if they are logged in

when opening the site while logged in, the landing page is shown until the user is fetched.
we can redirect the user to /dashboard before getting the user info from the backend

we can redirect the user to /dashboard after logging in as well, easy to change in env vars

Confirm users granted the correct permissions

It is possible to manipulate the scopes when redirected to Osu! OAuth page. For example, if a user removes public from the query parameter scope and we try to make an Osu! Request that depends on that scope with that user's token, API fails because of insufficient permissions.

We want to know if the user granted us the correct permissions before letting them use the site.

Add an endpoint for profile page data

Current endpoints arent enough to construct the profile page.
Connected to this issue: #65

Needed fields:

  • boolean for if the user has already added this person

    can use the cookie to get the requesting user,
    can be a separate endpoint

  • influence data
    • influence array of:
        - influenced user  ->  same with get_user data
        - influence strength
        - influence description
        - example maps  ->  should have the function to pull map info
      
    • mentions array of:
        - connected user  ->  same with get_user data
        - boolean if the user entered a description
      
  • map count info

    graved, pending, ranked etc. maps

  • user bio

    moved from get_user to this endpoint

  • featured maps

    area under bio in which the user can showcase their maps, this can either be just the map id or map information such as song metadata and difficulty name

This is the information needed to fill the profile page. Reference design:

image

User leaderboard return data has irrelevant data

Currently, we use the user id to generate their cards. Those ids are fetching their user data individually.
The current return is this:

type LeaderboardResponse = {
  id: number;
  user_name: string;
  profile_picture: string;
  ranked_map_count: number;
  influence_count?: number;
};

We only need the id and probably influence count. We could access the influence count from the user data so it is not mandatory. Would be nice to have though.
An alternative is to have all of the base user data to immediately render the users.

Proposed return type:

type LeaderboardResponse = {
  id: number;
  influence_count: number;
};

Need a leaderboard api

either need pagination or dynamic size query, can be hardcoded for now

would be nice to have map leaderboards alongside user leaderboards

returns array of:

{
  user: // base user data for card
  count: // influence count for scoring 
}

or for maps

{
  map: // base map data for card
  count: // influence count for scoring 
}

image

Refactor SQLx tests to reduce connection errors

SQLx creates a separate database for each test annotated with #[sqlx::test], and sometimes our test suite fails because SQLx can't connect to the database. Ideally, we want as few tests as possible so we won't get database connection errors when running the tests.

One way to solve this would be merging similar tests into one test. Such as:

#[sqlx::test]
async fn test_insert_user(db: PgPool) { /* ... */ }

#[sqlx::test]
async fn test_insert_no_bio(db: PgPool) { /* ... */ }

#[sqlx::test]
async fn test_insert_same_id(db: PgPool) { /* ... */ }

// These three tests can be merged into one test

#[sqlx::test]
async fn test_insert_user(db: PgPool) { /* We test all of the insert scenarios here */ }

Update CI

Currently, our CI workflow is very redundant and it makes it harder for us to edit/update/add jobs. Ideally, we want to use a matrix to set up the redundant CI commands.

In addition to that our tests are dependent on various services so it might be better to use our build commands instead of cargo actions. (not really sure about this)

need a user search endpoint

the endpoint should return the base user data (see #65)
with that, a boolean for whether the user has already registered to the site or not would be nice.

could use path parameters for request because there is a 13 char limit to usernames:

GET .../search/:string
[
  {
    "user": { ... },
    "registered": true
  }
]

`/v1/user/get/:user_id` not working

2 problems:

  1. Empty user_id request not working. Should be returning user connected to the cookie sent
  2. Both valid and invalid user_id throws Unsupported type `core::option::Option<i64>

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.