1.2.1 • Published 1 year ago

firestore-base-service v1.2.1

Weekly downloads
-
License
Apache2
Repository
github
Last release
1 year ago

Firebase Firestore Base Service

Description

Base service and interface to manage the read/write to firebase firestore realtime database as item based

Installation

Add package to your project

npm i firestore-base-service

Extends your item interface from our base to preserve id property

import { ItemInterface } from 'firestore-base-service';

export interface YourItemInterface extends ItemInterface {
   // Your properties
}

Extends your item service from our base to get the functionally and add the item type string to manage on database

import { BaseService } from 'firestore-base-service';

@Injectable({
    providedIn: 'root'
})
export abstract class YourItemService<YourItemInterface> extends  BaseService {
    protected abstract readonly itemType: string = 'yourItem';  // better use an Enum with all items

    // your methods here
}