-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable publications to link to annotations (#6315)
* add schema change, publicationDAO * add one more step * add backend routes for publication * fix csv file * add more * update db queries * reformat * remove unnecessary parts * remove unnecessary parts * bump schema.sql version to 84 * remove unneeded import * add Changelog entry * incroporate feedback * update evolution * use comma instead of semicolon * remove unused variables * update schema version * adds frontend for new publication API * lint * fixes * rename /publication/:id -> /publications/:id * remove publication from datasets * e2e * rm CompactPublicationService * pr feedback * pr feedback * snapshots * remove unused stuff Co-authored-by: Florian M <[email protected]> Co-authored-by: Norman Rzepka <[email protected]> Co-authored-by: Florian M <[email protected]>
- Loading branch information
1 parent
b93e00e
commit ae0b8b5
Showing
27 changed files
with
402 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package controllers | ||
|
||
import com.mohiva.play.silhouette.api.Silhouette | ||
import com.scalableminds.util.tools.{Fox, FoxImplicits} | ||
import com.scalableminds.webknossos.datastore.helpers.ProtoGeometryImplicits | ||
import io.swagger.annotations._ | ||
import javax.inject.Inject | ||
import models.binary.{PublicationDAO, PublicationService} | ||
import oxalis.security.WkEnv | ||
import play.api.libs.json._ | ||
import play.api.mvc.{Action, AnyContent} | ||
import utils.ObjectId | ||
|
||
import scala.concurrent.ExecutionContext | ||
|
||
@Api | ||
class PublicationController @Inject()(publicationService: PublicationService, | ||
publicationDAO: PublicationDAO, | ||
sil: Silhouette[WkEnv])(implicit ec: ExecutionContext) | ||
extends Controller | ||
with ProtoGeometryImplicits | ||
with FoxImplicits { | ||
|
||
@ApiOperation(value = "Information about a publication", nickname = "publicationInfo") | ||
@ApiResponses( | ||
Array(new ApiResponse(code = 200, message = "JSON object containing information about this publication."), | ||
new ApiResponse(code = 400, message = badRequestLabel))) | ||
def read(@ApiParam(value = "The id of the publication") publicationId: String): Action[AnyContent] = | ||
sil.UserAwareAction.async { implicit request => | ||
for { | ||
publication <- publicationDAO.findOne(ObjectId(publicationId)) ?~> "publication.notFound" ~> NOT_FOUND | ||
js <- publicationService.publicWrites(publication) | ||
} yield Ok(js) | ||
} | ||
|
||
def listPublications: Action[AnyContent] = sil.UserAwareAction.async { implicit request => | ||
{ | ||
for { | ||
publications <- publicationDAO.findAll ?~> "publication.notFound" ~> NOT_FOUND | ||
jsResult <- Fox.serialCombined(publications)(publicationService.publicWrites) | ||
} yield Ok(Json.toJson(jsResult)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
START TRANSACTION; | ||
|
||
DROP VIEW webknossos.annotations_; | ||
ALTER TABLE webknossos.annotations | ||
ADD COLUMN _publication CHAR(24), | ||
ADD CONSTRAINT publication_ref FOREIGN KEY(_publication) REFERENCES webknossos.publications(_id) DEFERRABLE; | ||
|
||
CREATE VIEW webknossos.annotations_ AS SELECT * FROM webknossos.annotations WHERE NOT isDeleted; | ||
|
||
UPDATE webknossos.releaseInformation SET schemaVersion = 85; | ||
|
||
COMMIT TRANSACTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
START TRANSACTION; | ||
|
||
DROP VIEW webknossos.annotations_; | ||
ALTER TABLE webknossos.annotations | ||
DROP COLUMN _publication CHAR(24); | ||
|
||
CREATE VIEW webknossos.annotations_ AS SELECT * FROM webknossos.annotations WHERE NOT isDeleted; | ||
|
||
UPDATE webknossos.releaseInformation SET schemaVersion = 84; | ||
|
||
COMMIT TRANSACTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.