changement des url des requêtes sur l'api
continuous-integration/drone/push Build is passing Details

peristanceBDD
Thomas Chazot 2 years ago
parent c1212ed509
commit 1958934bf7

@ -9,6 +9,8 @@ export class LoaderConversationApi implements ILoaderConversation{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
loadAllConversation(): Promise<Conversation[]> {
throw new Error("Method not implemented.");
}
@ -18,7 +20,7 @@ export class LoaderConversationApi implements ILoaderConversation{
async loadByUser(u: User): Promise<Conversation[]> {
let tabConv:Conversation[]=[];
const url='http://localhost:8888/api-rest/index.php/getConversations/' +u.getId();
const url=this.baseUrl+'getConversations/' +u.getId();
await this.axios({
method: 'get',
url: url,

@ -9,10 +9,12 @@ export class SaverConversationApi implements ISaverConversation{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
async saveConversation(name: string, user:User, tabId:number[], firstMessage:string, messageDate:Date): Promise<Conversation | null>{
let conv:Conversation | null=null;
let url='http://localhost:8888/api-rest/index.php/postConversation/' + name + "/" +user.getId();
let url= this.baseUrl + 'postConversation/' + name + "/" +user.getId();
tabId.forEach(id => {
url=url + "," + id;
});
@ -47,7 +49,7 @@ export class SaverConversationApi implements ISaverConversation{
async addMessage(idConv:number, content: string, messageDate:Date, user: User): Promise<Message | null> {
let message:Message | null=null;
let url='http://localhost:8888/api-rest/index.php/addMessageToConversation/' + content + "/" + user.getId() + "/" + idConv + "/" + messageDate.toISOString().split('T')[0] + " " + messageDate.getHours() + ":" + messageDate.getMinutes() + ":" + messageDate.getSeconds();
let url=this.baseUrl+ 'addMessageToConversation/' + content + "/" + user.getId() + "/" + idConv + "/" + messageDate.toISOString().split('T')[0] + " " + messageDate.getHours() + ":" + messageDate.getMinutes() + ":" + messageDate.getSeconds();
await this.axios({
method: 'put',
url: url,
@ -63,7 +65,7 @@ export class SaverConversationApi implements ISaverConversation{
throw new Error("Method not implemented.");
}
async deleteUserToConversation(c: Conversation, u: User): Promise<void> {
let url='http://localhost:8888/api-rest/index.php/deleteUserFromConversation/' + c.getId() + "/" +u.getId();
let url=this.baseUrl+'deleteUserFromConversation/' + c.getId() + "/" +u.getId();
await this.axios({
method: 'put',
url: url,
@ -72,7 +74,7 @@ export class SaverConversationApi implements ISaverConversation{
async deleteConversation(c: Conversation): Promise<void> {
let url='http://localhost:8888/api-rest/index.php/deleteConversation/' + c.getId();
let url=this.baseUrl+'deleteConversation/' + c.getId();
await this.axios({
method: 'delete',
url: url,

@ -8,10 +8,11 @@ export default class LoaderGameApi implements ILoaderGame{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
async loadAllGames(): Promise<Game[]> {
let tab: Game[]=[];
const url="http://localhost:8888/api-rest/index.php/getGames";
const url=this.baseUrl+"http://localhost:8888/api-rest/index.php/getGames";
await this.axios({
method: 'get',
url: url,
@ -48,7 +49,7 @@ export default class LoaderGameApi implements ILoaderGame{
}
async loadByID(id: number): Promise<Game | null> {
let game: Game|null=null;
const url="http://localhost:8888/api-rest/index.php/getGameById/" + id;
const url=this.baseUrl + "getGameById/" + id;
await this.axios({
method: 'get',
url: url,

@ -12,6 +12,8 @@ export default class LoaderMatchApi implements ILoaderMatch{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
async loadAllMatch(): Promise<Match[]> {
throw new Error("Method not implemented.");
@ -19,7 +21,7 @@ export default class LoaderMatchApi implements ILoaderMatch{
async loadByID(id: number): Promise<Match | null> {
let match:Match|null=null;
const url='http://localhost:8888/api-rest/index.php/getMatchById/' + id;
const url=this.baseUrl + 'getMatchById/' + id;
await this.axios({
method: 'get',
url: url,

@ -12,11 +12,15 @@ import { MANAGER_MATCH } from "../../../appManagers";
export default class SaverMatchApi implements ISaverMatch{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
async saveMatch(u:User, g:Game): Promise<Match> {
let id=0;
let url='http://localhost:8888/api-rest/index.php/postMatch/' + g.id + "/" + u.id;
let url=this.baseUrl + 'postMatch/' + g.id + "/" + u.id;
await this.axios({
method: 'post',
url: url,
@ -32,7 +36,7 @@ export default class SaverMatchApi implements ISaverMatch{
}
async deleteMatch(m: Match): Promise<void> {
let url='http://localhost:8888/api-rest/index.php/deleteMatch/' + m.getCode();
let url=this.baseUrl + 'deleteMatch/' + m.getCode();
await this.axios({
method: 'delete',
url: url,
@ -40,16 +44,20 @@ export default class SaverMatchApi implements ISaverMatch{
}
async deleteUserFromMatch(u: User): Promise<void> {
let url='http://localhost:8888/api-rest/deleteUserFromMatch.php/' + u.id;
let url=this.baseUrl + 'deleteUserFromMatch.php/' + u.id;
await this.axios({
method: 'put',
url: url,
});
}
updateMatch(m: Match): Promise<void> {
throw new Error("Method not implemented.");
}
async joinMatch(u:User, id:number): Promise<Match | null>{
let match:Match|null=null;
let url='http://localhost:8888/api-rest/index.php/addUserToMatch/' + id + "/" + u.id;
let url=this.baseUrl + 'addUserToMatch/' + id + "/" + u.id;
await MANAGER_MATCH.getLoaderMatch().loadByID(id).then(async (response)=>{
if (response!==undefined && response !== null){

@ -5,13 +5,16 @@ export default class LoaderSkinApi implements ILoaderSkin{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
/**
* loadAllSkin methode that load every Skin from the data management system
* return an array of Skin
*/
async loadAllSkin(): Promise<Skin[]>{
let tabSkin: Skin[]=[];
const url='http://localhost:8888/api-rest/index.php/getSkins';
const url=this.baseUrl+'getSkins';
await this.axios({
method: 'get',
url: url,
@ -33,7 +36,7 @@ export default class LoaderSkinApi implements ILoaderSkin{
*/
async loadByID(id:number): Promise<Skin | null>{
let skin: Skin | null= null;
const url='http://localhost:8888/api-rest/index.php/getSkins';
const url=this.baseUrl + 'getSkins';
await this.axios({
method: 'get',
url: url,

@ -4,24 +4,13 @@ import { Skin } from "../../core/skin";
import { User } from "../../core/User/user";
import ILoaderUser from "./ILoaderUser";
class Test{
public completed:boolean;
public id: number;
public title: String;
public userId: number;
constructor(completed: boolean, id:number, title:String, userId: number){
this.completed=completed;
this.id=id;
this.title=title;
this.userId=userId;
}
}
export default class LoaderUserApi implements ILoaderUser{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
async loadAllUser() : Promise<User[]> {
throw new Error("Method not implemented.");
@ -30,7 +19,7 @@ export default class LoaderUserApi implements ILoaderUser{
async loadByID(id: number): Promise<User | null> {
let us:User | null=null;
const url='http://localhost:8888/api-rest/index.php/getUserById/'+ id;
const url=this.baseUrl + 'getUserById/'+ id;
await this.axios({
method: 'get',
url: url,
@ -46,7 +35,7 @@ export default class LoaderUserApi implements ILoaderUser{
async loadByUsername(username: string): Promise<User | null> {
let us:User | null=null;
const url='http://localhost:8888/api-rest/index.php/getUserByUsername/'+ username;
const url=this.baseUrl + 'getUserByUsername/'+ username;
await this.axios({
method: 'get',
url: url,
@ -61,7 +50,7 @@ export default class LoaderUserApi implements ILoaderUser{
async loadByUsernamePassword(username: string, password: string): Promise<User | null>{
let us:User | null=null;
const url='http://localhost:8888/api-rest/index.php/getUserForConnection/'+ username + "/" + password;
const url=this.baseUrl + 'getUserForConnection/'+ username + "/" + password;
await this.axios({
method: 'get',
url: url,

@ -8,9 +8,11 @@ export default class SaverUserApi implements ISaverUser{
private axios = require('axios').default;
private baseUrl = "https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-api-bobParty/index.php/"
async saveUser(username:string, password:string, nationality:string, sexe:string, date:Date): Promise<User | null> {
let us:User|null=null;
const url='http://localhost:8888/api-rest/index.php/postUser/'+ username + "/" + password + "/" + nationality + "/" + sexe + "/" + date.toISOString().split('T')[0] ;
const url=this.baseUrl + 'postUser/'+ username + "/" + password + "/" + nationality + "/" + sexe + "/" + date.toISOString().split('T')[0] ;
await this.axios({
method: 'post',
url: url,
@ -24,7 +26,7 @@ export default class SaverUserApi implements ISaverUser{
}
async updateUser(u: User): Promise<void> {
let us:User|null=null;
const url='http://localhost:8888/api-rest/index.php/putUser/'+ u.getId() + "/" + u.getUsername() + "/" + u.getPassword() + "/" + u.getSexe() + "/" + u.getNationality() + "/" + u.getCurrentCoins() + "/" + u.getTotalCoins() + "/" + u.getGamesPlayed() + "/" + u.getCurrentSkin().getSkinId();
const url=this.baseUrl + 'putUser/'+ u.getId() + "/" + u.getUsername() + "/" + u.getPassword() + "/" + u.getSexe() + "/" + u.getNationality() + "/" + u.getCurrentCoins() + "/" + u.getTotalCoins() + "/" + u.getGamesPlayed() + "/" + u.getCurrentSkin().getSkinId();
await this.axios({
method: 'put',
url: url,
@ -33,7 +35,7 @@ export default class SaverUserApi implements ISaverUser{
async addSkinList(u: User, s:Skin): Promise<void> {
let us:User|null=null;
const url='http://localhost:8888/api-rest/index.php/putSkinList/'+ u.getId() + "/" + s.getSkinId();
const url=this.baseUrl + 'putSkinList/'+ u.getId() + "/" + s.getSkinId();
await this.axios({
method: 'put',
url: url,

Loading…
Cancel
Save