Jaime Ramírez
2020-06-11 d4efcf556bee5599b87a18da9420df2143e1c757
commit | author | age
bae328 1 import { AnimalService } from "./AnimalService";
JR 2 import { Animal } from "../Models/Animal";
3 import { delay } from "./Delayer";
9f69d1 4 import {AnimalNotificationRequest} from "../Models/AnimalNotificationRequest";
bae328 5
JR 6
7 export default class AnimalFakeService implements AnimalService {
8
9     public async create(): Promise<string> {
10         console.log("AnimalFakeService: create() was called!");
11         return delay(() => "fake-animal-id");
12     }
13
14     public async getAllAdoptable(): Promise<Animal[]> {
15         return delay(() => ([
16             {
17                 animalId: "a1",
18                 animalName: "Dog 1",
19                 breed: "Shepherd",
20                 shelterId: "s1",
21                 adoptable: true,
22                 weight: 100,
23                 approximateSize: "L",
24                 residencyRequired: "HOUSE",
25                 squareFootageOfHome: 800,
26                 childSafe: true,
9f69d1 27                 otherDogSafe: true,
J 28                 photoUrl: ""
bae328 29             },
JR 30             {
31                 animalId: "a1",
32                 animalName: "Dog 1",
33                 breed: "Shepherd",
34                 shelterId: "s1",
35                 adoptable: true,
36                 weight: 100,
37                 approximateSize: "L",
38                 residencyRequired: "HOUSE",
39                 squareFootageOfHome: 800,
40                 childSafe: true,
9f69d1 41                 otherDogSafe: true,
J 42                 photoUrl: ""
bae328 43             },
JR 44             {
45                 animalId: "a1",
46                 animalName: "Dog 1",
47                 breed: "Shepherd",
48                 shelterId: "s1",
49                 adoptable: true,
50                 weight: 100,
51                 approximateSize: "L",
52                 residencyRequired: "HOUSE",
53                 squareFootageOfHome: 800,
54                 childSafe: true,
9f69d1 55                 otherDogSafe: true,
J 56                 photoUrl: ""
bae328 57             },
JR 58             {
59                 animalId: "a1",
60                 animalName: "Dog 1",
61                 breed: "Shepherd",
62                 shelterId: "s1",
63                 adoptable: true,
64                 weight: 100,
65                 approximateSize: "L",
66                 residencyRequired: "HOUSE",
67                 squareFootageOfHome: 800,
68                 childSafe: true,
9f69d1 69                 otherDogSafe: true,
J 70                 photoUrl: ""
bae328 71             }
JR 72         ]));
9f69d1 73     }
J 74
75     public async subscribeNotifications(animalNotificationRequest: AnimalNotificationRequest): Promise<void> {
d4efcf 76         console.log("AnimalFakeService.subscribeNotifications", animalNotificationRequest);
bae328 77     }
JR 78
79     public async getById(): Promise<Animal> {
80         return delay(() => ({
81             animalId: "a1",
82             animalName: "Dog 1",
83             breed: "Shepherd",
84             shelterId: "s1",
85             adoptable: true,
86             weight: 100,
87             approximateSize: "L",
88             residencyRequired: "HOUSE",
89             squareFootageOfHome: 800,
90             childSafe: true,
9f69d1 91             otherDogSafe: true,
J 92             photoUrl: ""
bae328 93         }));
JR 94     }
95
96 }