BuddyGG / buddy_matching

Somewhat generic player matching service built with Elixir and Phoenix
https://www.buddy.gg
GNU Affero General Public License v3.0
64 stars 7 forks source link

Unify request and response data #135

Closed Hanspagh closed 4 years ago

Hanspagh commented 5 years ago

Currently we are using the follow format

export interface AgeGroups {
    interval1: boolean;
    interval2: boolean;
    interval3: boolean;
}

export interface VoiceChat {
    YES: boolean;
    NO: boolean;
}

export interface Criteria {
    ageGroups: AgeGroups;
    voiceChat: VoiceChat;
    ignoreLanguage: boolean;
}

export interface GameCriteria {
    minGamesPlayed: number;
}

export interface GameInfo {
    platform: string;
    gamesPlayed: number;
    gameCriteria: GameCriteria;
}

export interface FortnitePlayerStats {
    name: String;
    id: String;
    game: String;

    total: {
        gamesWon: number,
        gamesPlayed: number
    };
    solo: {
        top25finishes: number,
        top10finishes: number,
        killDeathRatio: number,
        gamesWon: number,
        gamesPlayed: number
    };
    duo: {
        top12finishes: number,
        top5finishes: number,
        killDeathRatio: number,
        gamesWon: number,
        gamesPlayed: number
    };
    squad: {
        top6finishes: number,
        top3finishes: number,
        killDeathRatio: number,
        gamesWon: number,
        gamesPlayed: number
    };
    voiceChat: boolean[];
    ageGroup: string;
    comment: string;
    languages: string[];
    criteria: Criteria;
    gameInfo: GameInfo;
}
ecly commented 5 years ago

We want to implement the GameInfo game specific behaviour either within the API apps, or depend on buddy matching from the APIs and return GameInfo instances.

ecly commented 5 years ago

Currently a few issues with this. The specific infos need to know their critieria, which would then seem silly to implement in a different module - but at the same time, game criteria should be buddy_matching's responsibility. I'm thinking the simplest solution currently is just to make the API responses 1:1 compatible with their corresponding GameInfo - but keeping the GameInfo in buddy_matching.

ecly commented 5 years ago

So based on the discussion today, the way we would do this would be to basically add a key under gameInfo which would contain all the API results. This way it could just be glued directly under there.