@inclouded/slm-sdk
v0.3.4
Published
``` npm install --save @inclouded/slm-sdk ```
Downloads
3
Keywords
Readme
Slack Leave Management Angular SDK
npm install --save @inclouded/slm-sdk
Introduction
This library contains a Firebase SDK that is compatible with projects built in Angular 2+ frameworks. This SDK achieves the basic CRUD operations.
Usage
The SDK needs an Angular 2+ project in which an existing Firebase project is integrated.
We recommend to call SDK methods in Angular services:
import { Injectable } from '@angular/core';
import { Event, EventApi, Request, RequestApi, User, UserApi, Holiday, HolidayApi } from '@inclouded/slm-sdk';
import { Observable } from 'rxjs';
import { AngularFirestore } from '@angular/fire/firestore';
@Injectable()
export class SLMService {
eventApi: EventApi;
requestApi: RequestApi;
userApi: UserApi;
holidayApi: HolidayApi;
constructor(private afs: AngularFirestore) {
this.eventApi = new EventApi(this.afs);
this.requestApi = new RequestApi(this.afs);
this.userApi = new UserApi(this.afs);
this.holidayApi = new HolidayApi(this.afs);
}
addUser(user: User) {
return this.userApi.add(user);
}
getAllUsers(): Observable<User[]> {
return this.userApi.getAll();
}
addRequest(user: Request) {
return this.requestApi.add(user);
}
getAllRequests(): Observable<Request[]> {
return this.requestApi.getAll();
}
addEvent(user: Event) {
return this.eventApi.add(user);
}
getAllEvents(): Observable<Event[]> {
return this.eventApi.getAll();
}
addHoliday(holiday: Holiday) {
return this.holidayApi.add(holiday);
}
getAllHolidays(): Observable<Holiday[]> {
return this.holidayApi.getAll();
}
}
Developer: Zoltán R. Jánki ([email protected])