Skip to content

Instantly share code, notes, and snippets.

@raininglemons
Last active October 20, 2016 10:28
Show Gist options
  • Save raininglemons/3a9e56a8badfd4ad43a5aea7373897b0 to your computer and use it in GitHub Desktop.
Save raininglemons/3a9e56a8badfd4ad43a5aea7373897b0 to your computer and use it in GitHub Desktop.
// @flow
/*
* Core Structure for CasinoGames redux store
*/
type CasinoGamesStore = {
categories: Object<CategoryId, Category>,
currencies: Object<CurrencyId, Currency>,
games: Object<GameId, Game>,
jackpots: Object<JackpotId, Jackpot>,
langPack: LanguagePack<string, string>,
lastUpdated: Object<ApiId, ApiLastUpdated>,
winners: Winner[],
};
/*
* Games Reducer
*/
type GameId = mixed;
type Game = {
title: string,
description: string,
thumbnail: GameThumbnail,
type: ?string,
width: ?number,
height: ?number,
sticker: ?string,
jackpotGroup: ?JackpotId,
featured: ?boolean,
};
type GameThumbnail = {
default: string,
featured: ?string,
video: ?string,
};
type GameStub = {
id: GameId,
sticker: ?string,
featured: ?boolean,
};
/*
* Categories Reducer
*/
type CategoryId = mixed;
type Category = {
title: string,
isDefault: ?boolean,
position: number,
seoPath: ?string,
games: GameStub[],
};
/*
* Jackpots Reducer
*/
type JackpotId = mixed;
type Jackpot = {
title: string,
amount: number,
currency: CurrencyId,
subJackpots: SubJackpot[],
games: GameStub[],
};
type SubJackpot = {
title: string,
amount: number,
};
/*
* Winners Reducer
*/
type Winner = {
username: string,
game: WinnerStub,
amount: number,
currency: CurrencyId,
timestamp: number, // time converted to ms since epoch, can then be converted to date object as necessary
};
type WinnerStub = {
id: GameId,
title: ?string,
};
/*
* Currencies Reducer
*/
type CurrencyId = String;
type Currency = {
format: string,
symbol: string,
symbolBefore: boolean,
};
/*
* LangPack Reducer
*/
type LanguagePack = {
playNow: string,
showMore: string,
addToFavourites: string,
recentWinners: string,
favourites: string,
search: string,
searchPlaceholder: string,
sort: string,
sortGrid: string,
sortList: string,
sortAlphabetically: string,
sortPopular: string,
winnersUsername: string,
winnersAmount: string,
winnersTimestamp: string,
winnersGame: string,
};
/*
* Api Metadata Reducer
*/
type ApiId = String;
type ApiLastUpdated = {
lastUpdated: ?number,
lastRequested: ?number,
};
/*
* Core Structure for User redux store
*/
type UserStore = {
id: ?UserId,
username: ?string,
balances: Balance[],
recommendedGames: GameId[],
favouriteGames: GameId[],
recentGames: RecentGame,
sessionId: ?string,
}
/*
* id reducer
*/
type UserId = mixed;
/*
* Balances reducer
*/
type Balance = {
balance: number,
currency: CurrencyId,
type: string,
};
/*
* Recent games reducer
*/
type RecentGame = {
id: GameId,
lastPlayed: number, // timestamp
playCount: number,
score: number,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment