NBeing / VSAV_MatchDB

0 stars 1 forks source link

API Design Discussion #1

Closed JayOneTheSk8 closed 2 years ago

JayOneTheSk8 commented 2 years ago
Add match payload
{
    url: <string>,
    type: <enum[Video/Fightcade]>,
    characterOne: <string>,
    characterTwo: <string>,
    timestamp?: <int>,
    playerOne?: <string>,
    playerTwo?: <string>,
    winner?: <string>
}

Controller TO-DO
youtube parsing (url) {
    edit out timestamp+query params in url
    normalise url
    save url
    get title uploader and date uploaded from youtube api
    save data
}

if type is invalid, return error

if type is video{
    if the url is youtube {
        if timestamp in payload {
            save timestamp
            youtube parsing (url)
        }

        else if url contains timestamp query param  {
            parse timestamp from url query param
            save timestamp
            youtube parsing (url)
        }

        else  {
            youtube parsing (url)
        }
    }
    save url
}

if type is fightcade {
    save url
}

Model schema
MATCH
id: UUID
type: Enum(Video/Fightcade)
url: string
p1_char: Enum(CharacterEnum)
p2_char: Enum(CharacterEnum)
created_at: string

timestamp?: int
title?: string
uploader?: string
date_uploaded?: string

p1_name?: string
p2_name?: string
winner?: boolean

Match
ID = uuid/string REQ UNIQ
Type = Video/Fightcade (Enum) REQ
URL = link to video (string) REQ UNIQ
Character 1 = Left-side character(string) REQ
Character 2 = Right-side character(string) REQ

if video
Timestamp = Start of match in video (integer/seconds) allow null
will get via youtube api
Title = Title of video (string) REQ
Uploader = Video channel (string) REQ
Date Uploaded = Time Uploaded (string) REQ

Optional
Player 1 = Left-side player(Player)
Player 2 = Right-side player(Player)
Winner = Winning character (will constrain to p1 or p2 char) (string)

Notes:
Aliasing will occur on character name on application layer
DB will ONLY accept enums

------Optional--------

Player (admin only)
ID = uuid/string REQ
Name = Gamertag (string) REQ
Main character = Main character played (string)
Characters Played = List of characters played (w/e list is in "orm") REQ
Aliases = List of accepted aliases (posssible kanji/romanji/katakana/etc) REQ (should be populated by the Name; what is searched for)

Notes = Admin only
NBeing commented 2 years ago

I think we have covered all of these bases! Look forward to chatting again.

NBeing commented 2 years ago

(Leaving the YT integration to one side)