💻 Sync with local
This commit is contained in:
parent
5e42d23577
commit
3df6f57d19
|
@ -48,7 +48,7 @@ class District {
|
||||||
this.districtName = name
|
this.districtName = name
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getWealth (type: DistrictWealthType): Promise<any> {
|
public async getWealth (type: DistrictWealthType): Promise<number> {
|
||||||
switch (type.toUpperCase()) {
|
switch (type.toUpperCase()) {
|
||||||
case 'ALL':
|
case 'ALL':
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
|
@ -105,7 +105,7 @@ class District {
|
||||||
axios.get(`${userURL}/getSenators`)
|
axios.get(`${userURL}/getSenators`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const data: any[] = response.data
|
const data: any[] = response.data
|
||||||
if (district !== undefined) {
|
if (district !== undefined && district !== 'ALL') {
|
||||||
const found = data.find(user => user.district === district)
|
const found = data.find(user => user.district === district)
|
||||||
resolve(found)
|
resolve(found)
|
||||||
} else if (district === 'ALL') {
|
} else if (district === 'ALL') {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
// SpookVooper API - modules/interfaces/Interfaces.ts
|
// SpookVooper API - modules/interfaces/Interfaces.ts
|
||||||
// Written by Brendan Lane - https://brndnln.dev/
|
// Written by Brendan Lane - https://brndnln.dev/
|
||||||
|
|
||||||
|
import { DistrictWealthType, SenatorDistrict } from '../types/Types'
|
||||||
|
|
||||||
interface EntityUser {
|
interface EntityUser {
|
||||||
|
svid: string
|
||||||
|
apikey: string
|
||||||
getUser: () => Promise<any>
|
getUser: () => Promise<any>
|
||||||
getUsername: () => Promise<any>
|
getUsername: () => Promise<any>
|
||||||
getBalance: () => Promise<any>
|
getBalance: () => Promise<any>
|
||||||
|
@ -11,24 +15,36 @@ interface EntityUser {
|
||||||
getStockOffers: () => Promise<any>
|
getStockOffers: () => Promise<any>
|
||||||
buyStock: () => Promise<any>
|
buyStock: () => Promise<any>
|
||||||
sellStock: () => Promise<any>
|
sellStock: () => Promise<any>
|
||||||
svid: string
|
|
||||||
apikey: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ConfigUser {
|
|
||||||
svid: string
|
|
||||||
apikey?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EntityGroup {
|
interface EntityGroup {
|
||||||
svid: string
|
svid: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AuthConfig {
|
interface EntityDistrict {
|
||||||
|
name: string
|
||||||
|
getWealth: (type: DistrictWealthType) => Promise<number>
|
||||||
|
getSenator: (district: SenatorDistrict) => Promise<ReturnedUser>
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Class Constructor Configuration
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface ConfigUser {
|
||||||
|
svid: string
|
||||||
|
apikey?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ConfigAuth {
|
||||||
clientid: string
|
clientid: string
|
||||||
clientsecret: string
|
clientsecret: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Returned values from SVAPI
|
||||||
|
*/
|
||||||
|
|
||||||
interface ReturnedUser {
|
interface ReturnedUser {
|
||||||
userName: string
|
userName: string
|
||||||
twitch_id: string | null
|
twitch_id: string | null
|
||||||
|
@ -61,9 +77,13 @@ interface ReturnedUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
// API Entities
|
||||||
EntityUser,
|
EntityUser,
|
||||||
EntityGroup,
|
EntityGroup,
|
||||||
|
EntityDistrict,
|
||||||
|
// Class Config Interfaces
|
||||||
ConfigUser,
|
ConfigUser,
|
||||||
AuthConfig,
|
ConfigAuth,
|
||||||
|
// API Return Values
|
||||||
ReturnedUser
|
ReturnedUser
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// SpookVooper API - modules/types/Types.ts
|
// SpookVooper API - modules/types/Types.ts
|
||||||
// Written by Brendan Lane - https://brndnln.dev/
|
// Written by Brendan Lane - https://brndnln.dev/
|
||||||
|
|
||||||
import { EntityUser, AuthConfig as AuthConfigInt } from './../interfaces/Interfaces'
|
import { EntityUser, ConfigAuth } from './../interfaces/Interfaces'
|
||||||
|
|
||||||
type CreditAmount = string | number
|
type CreditAmount = string | number
|
||||||
type PaymentEntity = string | EntityUser
|
type PaymentEntity = string | EntityUser
|
||||||
type AuthEntity = EntityUser
|
type AuthEntity = EntityUser
|
||||||
type GroupMember = string | EntityUser
|
type GroupMember = string | EntityUser
|
||||||
type AuthConfig = AuthConfigInt
|
type AuthConfig = ConfigAuth
|
||||||
type District = 'Voopmont' | 'New Yam' | 'San Vooperisco' | 'Medievala' | 'Landing Cove' | 'New Spudland' | 'Vooperia City' | 'Corgi' | 'Old Yam' | 'New Vooperis' | 'The Netherlands' | 'Queensland' | 'Servers Past' | 'Los Vooperis' | 'Old King Peninsula'
|
type District = 'Voopmont' | 'New Yam' | 'San Vooperisco' | 'Medievala' | 'Landing Cove' | 'New Spudland' | 'Vooperia City' | 'Corgi' | 'Old Yam' | 'New Vooperis' | 'The Netherlands' | 'Queensland' | 'Servers Past' | 'Los Vooperis' | 'Old King Peninsula'
|
||||||
type DistrictWealthType = 'ALL' | 'USER' | 'GROUP'
|
type DistrictWealthType = 'ALL' | 'USER' | 'GROUP'
|
||||||
type SenatorDistrict = District | 'ALL'
|
type SenatorDistrict = District | 'ALL'
|
||||||
|
|
Loading…
Reference in New Issue