diff --git a/src/app/models/blog.model.ts b/src/app/models/blog.model.ts index 9e0fe2f..366bbd6 100644 --- a/src/app/models/blog.model.ts +++ b/src/app/models/blog.model.ts @@ -10,6 +10,8 @@ export interface BlogPost { status: 'published' | 'beta' | 'draft'; publish_date: Date; created_on: Date; + reviewed: boolean; + sticky: boolean; } type BlogContent = MarkdownContent diff --git a/src/app/services/blog.service.ts b/src/app/services/blog.service.ts index 58d1962..2ceb471 100644 --- a/src/app/services/blog.service.ts +++ b/src/app/services/blog.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { orderBy, where } from '@angular/fire/firestore'; -import { Observable, of } from 'rxjs'; +import { Observable, map, of } from 'rxjs'; import { FirestoreService } from './firestore.service'; import { BlogPost } from '../models/blog.model'; @@ -17,6 +17,7 @@ export class BlogService extends FirestoreService { constructor() { super('blog'); - this.data$ = super.getDocumentStream(...this.constraints); + this.data$ = super.getDocumentStream(...this.constraints) + .pipe(map(arr => arr.sort((a) => a.sticky ? -1 : 1))); } }