org.schoellerfamily.gedbrowser.api.controller.HeadController Maven / Gradle / Ivy
package org.schoellerfamily.gedbrowser.api.controller;
import org.schoellerfamily.gedbrowser.api.crud.HeadCrud;
import org.schoellerfamily.gedbrowser.api.crud.ObjectCrud;
import org.schoellerfamily.gedbrowser.api.datamodel.ApiHead;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author Dick Schoeller
*/
@CrossOrigin(origins = {
"http://largo.schoellerfamily.org:4200", "http://localhost:4200" })
@Controller
public class HeadController extends CrudInvoker {
/**
* @return the CRUD object for manipulating the DB header
*/
private ObjectCrud crud() {
return new HeadCrud(getLoader(), getConverter(), getManager());
}
/**
* @param db the name of the db to access
* @return the list of sources
*/
@GetMapping(value = "/v1/dbs/{db}")
@ResponseBody
public ApiHead read(@PathVariable final String db) {
return crud().readOne(db, "");
}
}