From 227c254ebc67678eecfb0cc517cd0f1d433c0e02 Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Sun, 21 Feb 2021 11:11:11 +0100 Subject: [PATCH] =?UTF-8?q?creados=20api=20y=20login=20services=20con=20fu?= =?UTF-8?q?nciones=20vac=C3=ADas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api.service.spec.ts | 16 ++++++++++++++++ src/app/api.service.ts | 33 +++++++++++++++++++++++++++++++++ src/app/app.module.ts | 3 ++- src/app/discoteca.ts | 9 +++++++++ src/app/login.service.ts | 23 ++++++++++++++++++++++- src/app/user.ts | 6 ++++++ 6 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 src/app/api.service.spec.ts create mode 100644 src/app/api.service.ts create mode 100644 src/app/user.ts diff --git a/src/app/api.service.spec.ts b/src/app/api.service.spec.ts new file mode 100644 index 0000000..c0310ae --- /dev/null +++ b/src/app/api.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ApiService } from './api.service'; + +describe('ApiService', () => { + let service: ApiService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ApiService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/api.service.ts b/src/app/api.service.ts new file mode 100644 index 0000000..32381eb --- /dev/null +++ b/src/app/api.service.ts @@ -0,0 +1,33 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable, throwError } from 'rxjs'; +import { catchError, retry } from 'rxjs/operators'; +import { User } from './user'; +import { Discoteca } from './discoteca'; + +@Injectable({ + providedIn: 'root' +}) +export class ApiService { + + constructor(private http: HttpClient) { + + } + + + validateUser(loginUser: string, loginPassword: string): boolean{ + return (loginUser==''); + } + + getUser (loginUser: string): void{ + + } + + postNewUser(user: User): void{ + + } + + postNewDiscoteca(discoteca: Discoteca): void{ + + } +} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9ba0407..287c89e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; +import { HttpClientModule } from '@angular/common/http'; import { RouteReuseStrategy } from '@angular/router'; import { ReactiveFormsModule } from '@angular/forms'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; @@ -15,7 +16,7 @@ import { LoginPage } from './login/login.page'; @NgModule({ declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage], entryComponents: [], - imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule], + imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule], providers: [ StatusBar, SplashScreen, diff --git a/src/app/discoteca.ts b/src/app/discoteca.ts index 63143b7..4ba5387 100644 --- a/src/app/discoteca.ts +++ b/src/app/discoteca.ts @@ -8,6 +8,7 @@ export class Discoteca { private telefono: number; private localizacion: string; private eventos: Evento[]; + private descripcion: string; setNombre(nombre: string): void{ @@ -37,4 +38,12 @@ export class Discoteca { getEventos(): Evento[]{ return this.eventos; } + + setDescripcion(desc: string): void{ + this.descripcion = desc; + } + + get Descripcion(): string{ + return this.descripcion; + } } diff --git a/src/app/login.service.ts b/src/app/login.service.ts index 92c777e..2e1fcfe 100644 --- a/src/app/login.service.ts +++ b/src/app/login.service.ts @@ -1,9 +1,30 @@ import { Injectable } from '@angular/core'; +import { ApiService } from './api.service'; +import { User } from './user'; @Injectable({ providedIn: 'root' }) export class LoginService { - constructor() { } + private userId: number; + private sessionType: number; + private loginUser: string; + private loginPassword: string; + + constructor(private apiService: ApiService) { + + } + + validateUser(loginUser: string, loginPassword: string): boolean{ + return (loginUser==''); + } + + getUser (loginUser: string): void{ + + } + + postNewUser(user: User): void{ + + } } diff --git a/src/app/user.ts b/src/app/user.ts new file mode 100644 index 0000000..72434d2 --- /dev/null +++ b/src/app/user.ts @@ -0,0 +1,6 @@ +export interface User { + userId: number; + userType: number; + loginUser: string; + loginPassword: string; +}