leaderboardsgg / leaderboard-backend

The backend for Leaderboards.gg. Also holds public-facing APIs.
https://info.leaderboards.gg
GNU General Public License v3.0
12 stars 16 forks source link

Restore leaderboards #250

Closed zysim closed 1 month ago

zysim commented 1 month ago

Closes: #240

I do not know how to write these dang tests. I now do know how to write these dang tests.

Eein commented 1 month ago

If leaderboard change is successful, frontend will probably want the leaderboard returned with the changes instead of a NoContent;

They will likely have to update a local cache/store - so this is better than making another request.

zysim commented 1 month ago

I think we forgot to cover the case where the board can't be restored because its slug has been reclaimed by another board. Shall we simply have it return a 409 and possibly the conflicting board or at least the ID of the conflicting board?

409'ing sounds fair. I should add that in. I'll return the full board; better visibility that way.

Eein commented 1 month ago

I think we forgot to cover the case where the board can't be restored because its slug has been reclaimed by another board. Shall we simply have it return a 409 and possibly the conflicting board or at least the ID of the conflicting board?

409'ing sounds fair. I should add that in. I'll return the full board; better visibility that way.

Is this even possible? If a leaderboard is deleted, it should still retain the unique slug index no?

TheTedder commented 1 month ago

I think we forgot to cover the case where the board can't be restored because its slug has been reclaimed by another board. Shall we simply have it return a 409 and possibly the conflicting board or at least the ID of the conflicting board?

409'ing sounds fair. I should add that in. I'll return the full board; better visibility that way.

Is this even possible? If a leaderboard is deleted, it should still retain the unique index no?

We decided that deleted LBs should get excluded from the unique index for slugs. This is achieved by filtering the index to only cover LBs that are not deleted. This means that when you delete an LB, its slug is freed. Alternatively, we could ask for a slug to use when restoring the LB to prevent the annoying and confusing case of having to give a deleted LB new slug before you restore it. In addition or perhaps instead, we could have it so that deleting a board automatically clears its slug.

zysim commented 1 month ago

Reflecting what I've said on Discord; I won't be implementing the ability to pass a new slug in to restore a board, nor am I clearing a board's slug on deletion. If a board conflicts, it conflicts.