Refactor Search Service
- Move the request part to the service - Switch to @angular/common/http because @angular/http is deprecatedmaster
parent
659630d96e
commit
cd75738210
@ -0,0 +1,20 @@
|
||||
import {IUser} from './IUser';
|
||||
|
||||
export interface IGroup {
|
||||
|
||||
id: number;
|
||||
|
||||
name: string;
|
||||
|
||||
creator: IUser;
|
||||
|
||||
admins: IUser[];
|
||||
|
||||
members: IUser[];
|
||||
|
||||
chat: any;
|
||||
|
||||
events: any;
|
||||
|
||||
joined: boolean;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import {IUser} from './IUser';
|
||||
import {IGroup} from './IGroup';
|
||||
|
||||
export interface ISearchResult {
|
||||
users: IUser[];
|
||||
|
||||
groups: IGroup[];
|
||||
|
||||
posts: any[];
|
||||
|
||||
events: any[];
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
import {IGroup} from './IGroup';
|
||||
|
||||
export interface IUser {
|
||||
|
||||
id: number;
|
||||
|
||||
name: string;
|
||||
|
||||
handle: string;
|
||||
|
||||
profilePicture?: string;
|
||||
|
||||
level: number;
|
||||
|
||||
points: number;
|
||||
|
||||
numberOfPosts: number;
|
||||
|
||||
postCount: number;
|
||||
|
||||
posts: any[];
|
||||
|
||||
joinedAt: Date;
|
||||
|
||||
friendCount: number;
|
||||
|
||||
friends: IUser[];
|
||||
|
||||
groupCount: number;
|
||||
|
||||
groups: IGroup[];
|
||||
|
||||
eventCount: number;
|
||||
|
||||
events: any[];
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpHeaders} from '@angular/common/http';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export abstract class BaseService {
|
||||
protected headers: HttpHeaders;
|
||||
|
||||
protected constructor() {
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers.set('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
abstract buildRequestBody(...params: any): any;
|
||||
}
|
Loading…
Reference in New Issue