creados api y login services con funciones vacías

This commit is contained in:
onsaliyo 2021-02-21 11:11:11 +01:00
parent b086fd9eb2
commit 227c254ebc
6 changed files with 88 additions and 2 deletions

View File

@ -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();
});
});

33
src/app/api.service.ts Normal file
View File

@ -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{
}
}

View File

@ -1,5 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { RouteReuseStrategy } from '@angular/router'; import { RouteReuseStrategy } from '@angular/router';
import { ReactiveFormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
@ -15,7 +16,7 @@ import { LoginPage } from './login/login.page';
@NgModule({ @NgModule({
declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage], declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage],
entryComponents: [], entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule], imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule],
providers: [ providers: [
StatusBar, StatusBar,
SplashScreen, SplashScreen,

View File

@ -8,6 +8,7 @@ export class Discoteca {
private telefono: number; private telefono: number;
private localizacion: string; private localizacion: string;
private eventos: Evento[]; private eventos: Evento[];
private descripcion: string;
setNombre(nombre: string): void{ setNombre(nombre: string): void{
@ -37,4 +38,12 @@ export class Discoteca {
getEventos(): Evento[]{ getEventos(): Evento[]{
return this.eventos; return this.eventos;
} }
setDescripcion(desc: string): void{
this.descripcion = desc;
}
get Descripcion(): string{
return this.descripcion;
}
} }

View File

@ -1,9 +1,30 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ApiService } from './api.service';
import { User } from './user';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class LoginService { 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{
}
} }

6
src/app/user.ts Normal file
View File

@ -0,0 +1,6 @@
export interface User {
userId: number;
userType: number;
loginUser: string;
loginPassword: string;
}