Bladeren bron

correccion de modelos

yadid rosell 5 maanden geleden
bovenliggende
commit
8a84c72b57
4 gewijzigde bestanden met toevoegingen van 23 en 52 verwijderingen
  1. 6 14
      src/models/Home.model.ts
  2. 7 16
      src/models/Noticia.model.ts
  3. 6 14
      src/models/QuienesSomos.model.ts
  4. 4 8
      src/models/Slide.model.ts

+ 6 - 14
src/models/Home.model.ts

@@ -1,21 +1,13 @@
 export class Home {
-  id: string;
-  foto: string;
-  titulo: string;
-  descripcion: string;
-  contenido: string;
-  fecha: string;
+  id: string | undefined;
+  foto: string | undefined;  
+  titulo: string | undefined;
+  descripcion: string | undefined;
+  contenido: string | undefined;
+  fecha: string | undefined;
 
   constructor(json?: Partial<Home>) {
-    this.id = "";
-    this.foto = "";
-    this.titulo = "";
-    this.descripcion = "";
-    this.contenido = "";
-    this.fecha = "";
-    if (json !== null) {
       Object.assign(this, json);
-    }
   }
 
   static fromJson(json: Partial<Home>) {

+ 7 - 16
src/models/Noticia.model.ts

@@ -1,23 +1,14 @@
 export class Noticia {
-  id: string;
-  titulo: string;
-  introduccion: string;
-  descripcion: string;
-  fecha: string;
-  foto: string;
-  categoria: string;
+  id: string | undefined;
+  titulo: string | undefined;
+  introduccion: string | undefined;
+  descripcion: string | undefined;
+  fecha: string | undefined;
+  foto: string | undefined;
+  categoria: string | undefined;
 
   constructor(json?: Partial<Noticia>) {
-    this.id = "";
-    this.titulo = "";
-    this.introduccion = "";
-    this.descripcion = "";
-    this.fecha = "";
-    this.foto = "";
-    this.categoria = "";
-    if (json !== null) {
       Object.assign(this, json);
-    }
   }
 
   static fromJson(json: Partial<Noticia>) {

+ 6 - 14
src/models/QuienesSomos.model.ts

@@ -1,21 +1,13 @@
 export class QuienesSomos {
-  id: string;
-  foto?: string;
-  nombre: string;
-  descripcion?: string;
-  imagen?: string;
-  fecha?: string;
+  id: string | undefined;
+  foto?: string | undefined;
+  nombre: string | undefined;
+  descripcion?: string | undefined;
+  imagen?: string | undefined;
+  fecha?: string | undefined;
 
   constructor(json?: Partial<QuienesSomos>) {
-    this.id = "";
-    this.foto = "";
-    this.nombre = "";
-    this.descripcion = "";
-    this.imagen = "";
-    this.fecha = "";
-    if (json !== null) {
       Object.assign(this, json);
-    }
   }
 
   static fromJson(json: Partial<QuienesSomos>) {

+ 4 - 8
src/models/Slide.model.ts

@@ -1,15 +1,11 @@
 export class Slide {
-  id: number;
-  image: string;
-  title: string;
+  id: number | undefined;
+  image: string | undefined;
+  title: string | undefined;
 
   constructor(json?: Partial<Slide>) {
-    this.id = 0;
-    this.image = "";
-    this.title = "";
-    if (json !== null) {
       Object.assign(this, json);
-    }
+    
   }
 
   static fromJson(json: Partial<Slide>) {