1.0.4 • Published 3 years ago

@inclouded/tmf-inventory v1.0.4

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

TMF Inventory Firestore SDK

npm install --save @inclouded/tmf-inventory

Introduction

In the repository the Firebase Cloud Firestore SDK can be found that was made for the TMF Inventory resource in an installable Angular folder form. The SDK can be installed for every Angular 2+ project. The SDK accomplishes the necessary CRUD operations.

Usage

  1. For using the SDK an Angular 2+ project is needed, in which we can establish a connection to a Firestore database instance. (configured in environments.ts)

  2. The SDK can be used in a Service in the following way:

import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AngularFirestore } from '@angular/fire/firestore';
import { InventoryApi, Paging, OrderBy } from '@inclouded/tmf-inventory'

@Injectable()
export class InventoryService {

    InventoryApi: InventoryApi;
    constructor(private afs: AngularFirestore) {
        this.InventoryApi = new InventoryApi(this.afs);
    }

    addInventory(service: any, id?: string) {
        return this.InventoryApi.add(service, id);
    }

    getAllInventory() {
        return this.InventoryApi.getAll();
    }

    deleteInventory(serviceId: string) {
        return this.InventoryApi.delete(serviceId);
    }

    updateInventory(service: any) {
        return this.InventoryApi.update(service);
    }

    getInventoryById(id: string) {
        return this.InventoryApi.getById(id);
    }

    getInventoryByRelatedParty(relatedParty: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByRelatedParty(relatedParty);
    }
  
    getInventoryByProductCharacteristic(productCharacteristic: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByProductCharacteristic(productCharacteristic);
    }

    getInventoryByType(serviceType: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByType(serviceType);
    }

    getInventoryByTypeAndDistributor(serviceType: string, distributorId: string, status?: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByTypeAndDistributor(serviceType, distributorId, status);
    }

    getInventoryByTypeAndInstaller(serviceType: string, installerId: string, status?: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByTypeAndInstaller(serviceType, installerId, status);
    }

    getInventoryByTypeAndCustomer(serviceType: string, customerId: string, status?: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByTypeAndCustomer(serviceType, customerId, status);
    }

    getInventoryByTypeAndOwner(serviceType: string, ownerId: string, status?: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByTypeAndOwner(serviceType, ownerId, status);
    }

    getInventoryByNameSubStr(nameSubStr: string, orderBy?: OrderBy, paging?: Paging) {
        return this.InventoryApi.getInventoryByNameSubStr(nameSubStr);
    }

Developer: Zoltán R. Jánki (jankiz@inf.u-szeged.hu), Gábor Simon (simonovszkij@gmail.com)