-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0417d7d
commit c08b656
Showing
10 changed files
with
95 additions
and
55 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
expo-boomboomapp/src/api/MatchApiService/MatchApiMockService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { singleton } from "tsyringe"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
import { MatchApiServiceI } from "./MatchApiServiceI"; | ||
import { user_helena, user_isabella, user_jessica } from "../../mocks/mokes"; | ||
import { StackProfileI } from "../ProfileApiService/ProfileApiServiceI"; | ||
|
||
@singleton() | ||
export class MatchApiMockService implements MatchApiServiceI { | ||
async getProfiles(): Promise<StackProfileI[]> { | ||
const stackProfiles = [user_isabella, user_helena, user_jessica]; | ||
return Promise.resolve( | ||
stackProfiles.map(({ user, songs }) => { | ||
return { | ||
user: { | ||
...user, | ||
id: uuidv4(), | ||
}, | ||
songs, | ||
}; | ||
}), | ||
); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
expo-boomboomapp/src/api/MatchApiService/MatchApiService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { inject, singleton } from "tsyringe"; | ||
|
||
import { MatchApiServiceI } from "./MatchApiServiceI"; | ||
import ConfigurationService from "../../services/ConfigurationService/ConfigurationService"; | ||
import ErrorService from "../../services/ErrorService/ErrorService"; | ||
import StorageService from "../../services/StorageService/StorageService"; | ||
import ServiceInterface from "../../tsyringe/ServiceInterface"; | ||
import { ApiService } from "../ApiService"; | ||
import { StackProfileI } from "../ProfileApiService/ProfileApiServiceI"; | ||
|
||
@singleton() | ||
export class MatchApiService extends ApiService implements MatchApiServiceI { | ||
constructor( | ||
@inject(ServiceInterface.StorageServiceI) | ||
protected storageService: StorageService, | ||
@inject(ServiceInterface.ConfigurationService) | ||
protected configurationService: ConfigurationService, | ||
@inject(ServiceInterface.ErrorService) | ||
protected errorService: ErrorService, | ||
) { | ||
super("matches", storageService, configurationService, errorService); | ||
} | ||
|
||
async getProfiles(): Promise<StackProfileI[]> { | ||
const res = await this.apiRequester.get<StackProfileI[]>("/"); | ||
console.log(res.data[0].user); | ||
console.log(res.data[0].songs); | ||
return res.data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { StackProfileI } from "../ProfileApiService/ProfileApiServiceI"; | ||
|
||
export abstract class MatchApiServiceI { | ||
abstract getProfiles(): Promise<StackProfileI[]>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters