aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/DevHive.Angular/src/app/components/post-page/post-page.component.html2
-rw-r--r--src/DevHive.Angular/src/app/components/post-page/post-page.component.ts3
-rw-r--r--src/DevHive.Angular/src/models/post-comment.ts5
-rw-r--r--src/DevHive.Angular/src/models/post.ts11
4 files changed, 12 insertions, 9 deletions
diff --git a/src/DevHive.Angular/src/app/components/post-page/post-page.component.html b/src/DevHive.Angular/src/app/components/post-page/post-page.component.html
index 5d29e5d..f22646d 100644
--- a/src/DevHive.Angular/src/app/components/post-page/post-page.component.html
+++ b/src/DevHive.Angular/src/app/components/post-page/post-page.component.html
@@ -18,7 +18,7 @@
</form>
<div>
<div class="comment" *ngFor="let comm of post?.comments">
- <app-comment [paramId]="comm.commentId.toString()"></app-comment>
+ <app-comment [paramId]="comm.id.toString()"></app-comment>
</div>
</div>
<div>
diff --git a/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts b/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts
index ef149a0..a7843e3 100644
--- a/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts
+++ b/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts
@@ -35,9 +35,6 @@ export class PostPageComponent implements OnInit {
this._postService.getPostRequest(this.postId).subscribe(
(result: object) => {
this.post = result as Post;
- this.post.comments = this.post.comments.sort((x, y) => {
- return Date.parse(y.timeCreated.toString()) - Date.parse(x.timeCreated.toString());
- });
this.editable = this.post.creatorUsername === this._tokenService.getUsernameFromSessionStorageToken();
},
(err: HttpErrorResponse) => {
diff --git a/src/DevHive.Angular/src/models/post-comment.ts b/src/DevHive.Angular/src/models/post-comment.ts
new file mode 100644
index 0000000..5d1e346
--- /dev/null
+++ b/src/DevHive.Angular/src/models/post-comment.ts
@@ -0,0 +1,5 @@
+import { Guid } from 'guid-typescript';
+
+export class PostComment {
+ public id: Guid;
+}
diff --git a/src/DevHive.Angular/src/models/post.ts b/src/DevHive.Angular/src/models/post.ts
index 4d49a06..1c6e26c 100644
--- a/src/DevHive.Angular/src/models/post.ts
+++ b/src/DevHive.Angular/src/models/post.ts
@@ -1,5 +1,6 @@
import { Guid } from 'guid-typescript';
-import {Comment} from './comment';
+import { Comment } from './comment';
+import { PostComment } from './post-comment';
export class Post {
private _postId: Guid;
@@ -8,10 +9,10 @@ export class Post {
private _creatorUsername: string;
private _message: string;
private _timeCreated: Date;
- private _comments: Comment[];
+ private _comments: PostComment[];
// _files
- constructor(postId: Guid, creatorFirstName: string, creatorLastName: string, creatorUsername: string, message: string, timeCreated: Date, comments: Comment[]) {
+ constructor(postId: Guid, creatorFirstName: string, creatorLastName: string, creatorUsername: string, message: string, timeCreated: Date, comments: PostComment[]) {
this.postId = postId;
this.creatorFirstName = creatorFirstName;
this.creatorLastName = creatorLastName;
@@ -63,10 +64,10 @@ export class Post {
this._timeCreated = v;
}
- public get comments(): Comment[] {
+ public get comments(): PostComment[] {
return this._comments;
}
- public set comments(v: Comment[]) {
+ public set comments(v: PostComment[]) {
this._comments = v;
}
}