From f5548770dd432c0c89b26ec3d52527234e83d8c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 7 Feb 2020 00:19:11 +0100 Subject: [PATCH 1/2] Added first draft for restriction and presenter interfaces. --- docs/interfaces/action-service.txt | 6 +++--- docs/interfaces/presenter-service.txt | 19 +++++++++++++++++++ docs/interfaces/restriction-service.txt | 20 ++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 docs/interfaces/presenter-service.txt create mode 100644 docs/interfaces/restriction-service.txt diff --git a/docs/interfaces/action-service.txt b/docs/interfaces/action-service.txt index 5305559f6..b49c67e9e 100644 --- a/docs/interfaces/action-service.txt +++ b/docs/interfaces/action-service.txt @@ -1,4 +1,4 @@ -# Action Service Interface +# Actions Service Interface Exception ActionException(message: string); @@ -7,7 +7,7 @@ Exception ActionException(message: string); * Executes multiple actions in the conext of the user given by the user_id. * All actions are processed independently. * - * TODO: Check if we need an interface or flag to process actions all together. + * TODO: Maybe we do not want to run them independently. * * * @throws ActionException @@ -16,7 +16,7 @@ handle_request (payload: Action[], user_id: number): ActionResult[] interface Action { action: string; - data: object[]; # An array of action specific data. See JSON schema defintions. + data: object[]; # An array of action specific data. See JSON schema defintions. } interface ActionResult { diff --git a/docs/interfaces/presenter-service.txt b/docs/interfaces/presenter-service.txt new file mode 100644 index 000000000..4c27dfa5a --- /dev/null +++ b/docs/interfaces/presenter-service.txt @@ -0,0 +1,19 @@ +# Presenter Service Interface + +Exception PresenterException(message: string); + + +/** + * Presents some (restricted) data without autoupdate. + * + * @throws PresenterException + */ +handle_request (payload: Presenter[]): PresenterResult[] + +interface Presenter { + user_id: number; + presentation: TODO; +} + +/* TODO */ +interface PresenterResult {} diff --git a/docs/interfaces/restriction-service.txt b/docs/interfaces/restriction-service.txt new file mode 100644 index 000000000..de0cf74ad --- /dev/null +++ b/docs/interfaces/restriction-service.txt @@ -0,0 +1,20 @@ +# Restrictions Service Interface + +Exception RestrictionException(message: string); + + +/** + * Restricts data for given user + * + * @throws RestrictionException + */ +handle_request (payload: Restriction[]): RestrictionResult[] + +interface Restriction { + user_id: number; + fqfields: Fqfield[]; +} + +interface RestrictionResult { + : Value; +} From 73e6eddf8910d7dbf0a9815089fee4121e3ca1bf Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Tue, 17 Mar 2020 11:18:55 +0100 Subject: [PATCH 2/2] Refine presenter service --- docs/interfaces/presenter-service.txt | 52 +++++++++++++++++++++------ 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/docs/interfaces/presenter-service.txt b/docs/interfaces/presenter-service.txt index 4c27dfa5a..8d09572d0 100644 --- a/docs/interfaces/presenter-service.txt +++ b/docs/interfaces/presenter-service.txt @@ -2,18 +2,50 @@ Exception PresenterException(message: string); +/** + * Executes some presenting function on the server. The term "presenting" means + * a non writing (or modifying) idempotent request. There may be some + * side-effect allowed (like tracking calls to one presenter), but the main + * purpose is to get data of the server, which is not autoupdate-, projector-, or + * icc-data. + * + * Some purposes may be: + * - aggregating of login data + * - managing of whoami, if additional data is needed, that the auth service + * doesn't provide + * - To get history points + * - To get history data + * - To get the installed version + * - To query statistics + * - To calculate recursive trees (e.g. origins of motions; not possible with + * the autoupdate service) + * - to synchronize the servertime for countdowns + * + * @throws PresenterException This exception might be thrown, if there was an + * server error (Http-500-equivalent). For user error (e.g. wrong data) use the + * PresenterError interface + */ +handle_request(user_id: Id, payload: Presenter[]): PresenterResult[] /** - * Presents some (restricted) data without autoupdate. - * - * @throws PresenterException + * This interface specifies what presenter is used with the payload for the call */ -handle_request (payload: Presenter[]): PresenterResult[] - -interface Presenter { - user_id: number; - presentation: TODO; +Interface Presenter { + presenter: string; + data: any; +} + +/** + * A presenter may return anything. This is presenter-specific. But if there was + * an error (user error, not a PresenterException), the response for this + * presenter should follow `PresenterError`. + */ +type PresenterResult = any | PresenterError; + +/** + * A common format for errors. + */ +Interface PresenterError { + error: object; } -/* TODO */ -interface PresenterResult {}