extend
This commit is contained in:
parent
dfaa41cc33
commit
83db076e2d
4 changed files with 27 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.sap.tamagotchi.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.sap.tamagotchi.model.Device;
|
||||
|
@ -25,4 +26,13 @@ public class DeviceController {
|
|||
public Device getDevice(String deviceId) {
|
||||
return tamagotchiService.getDevice(deviceId);
|
||||
}
|
||||
|
||||
@RequestMapping("devices")
|
||||
public Collection<Device> getDevices() {
|
||||
return tamagotchiService.getDevices();
|
||||
}
|
||||
//TODO postmapping create
|
||||
//request payload
|
||||
// owner String
|
||||
// color
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package com.sap.tamagotchi.model;
|
||||
|
||||
public class CreateDevicePayload {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.sap.tamagotchi.model;
|
||||
|
||||
public class Owner {
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package com.sap.tamagotchi.service;
|
||||
|
||||
import com.sap.tamagotchi.model.Device;
|
||||
import com.sap.tamagotchi.publisher.PublisherService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -10,8 +12,15 @@ import java.util.Map;
|
|||
@Service
|
||||
public class TamagotchiService {
|
||||
|
||||
private final PublisherService publisherService;
|
||||
|
||||
private final Map<String, Device> deviceRegistry = new HashMap<>();
|
||||
|
||||
@Autowired
|
||||
public TamagotchiService(PublisherService publisherService) {
|
||||
this.publisherService = publisherService;
|
||||
}
|
||||
|
||||
public Device getDevice(String deviceId) {
|
||||
return deviceRegistry.get(deviceId);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue