浏览代码

se mejoro el modelo de Publicacion

yadid rosell 3 月之前
父节点
当前提交
4da041fe7a
共有 1 个文件被更改,包括 7 次插入15 次删除
  1. 7 15
      src/models/Publicacion.model.ts

+ 7 - 15
src/models/Publicacion.model.ts

@@ -1,21 +1,13 @@
 export class Publicacion {
-  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<Publicacion>) {
-    this.id = "";
-    this.foto = "";
-    this.titulo = "";
-    this.descripcion = "";
-    this.contenido = "";
-    this.fecha = "";
-    if (json !== null) {
-      Object.assign(this, json);
-    }
+    Object.assign(this, json);
   }
 
   static fromJson(json: Partial<Publicacion>) {