center.service.ts 920 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import {Injectable} from '@angular/core';
  2. import {ISchema, Resource, Service} from 'ngx-jsonapi';
  3. @Injectable()
  4. export class CentersService extends Service<Center> {
  5. public resource = Center;
  6. public type = 'centers';
  7. }
  8. export class Center extends Resource {
  9. public attributes: {
  10. lat: string,
  11. lng: string,
  12. address: string,
  13. department: string,
  14. };
  15. get lat(): string {
  16. return this.attributes.lat;
  17. }
  18. set lat(lat: string) {
  19. this.attributes.lat = lat;
  20. }
  21. get lng(): string {
  22. return this.attributes.lng;
  23. }
  24. set lng(lng: string) {
  25. this.attributes.lng = lng;
  26. }
  27. get address(): string {
  28. return this.attributes.address;
  29. }
  30. set address(address: string) {
  31. this.attributes.address = address;
  32. }
  33. get department(): string {
  34. return this.attributes.department;
  35. }
  36. set department(department: string) {
  37. this.attributes.department = department;
  38. }
  39. }