Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d41cdbbe2 | ||
|
|
2081bd18c3 | ||
|
|
44e53ce2ce | ||
|
|
118fe395b0 | ||
|
|
0fd297231b | ||
|
|
539e3cbb5e | ||
|
|
79cfaa951a | ||
|
|
fb8d674637 | ||
|
|
165b012571 | ||
|
|
4aeda1c634 | ||
|
|
68855f6fad | ||
|
|
25b4c0c2f6 | ||
|
|
64bdc3dd6b | ||
|
|
67219a3d20 | ||
|
|
f81483f004 | ||
|
|
3623078235 | ||
|
|
0047ae56dc | ||
|
|
a9e43321ed | ||
|
|
9fd2ccd0a5 | ||
|
|
22555f2603 | ||
|
|
c17cbdae63 | ||
|
|
3d8272b28e | ||
|
|
3e9a14a970 | ||
|
|
480ccdb3b6 | ||
|
|
d4cbf7e4d5 | ||
|
|
1f2001daf8 | ||
|
|
9b029c8edf | ||
|
|
b9f557e95b | ||
|
|
60b01e5a16 | ||
|
|
ffb30a7aa3 | ||
|
|
b328df67a3 | ||
|
|
fc356e22c6 | ||
|
|
f512784dd3 | ||
|
|
ed39f83688 | ||
|
|
95c9f654e1 | ||
|
|
55447bd05c | ||
|
|
27fa24cf4d | ||
|
|
448546e487 | ||
|
|
835ad82916 | ||
|
|
a316341226 | ||
|
|
58619484b6 | ||
|
|
ea2f721377 | ||
|
|
2cb86c90dc | ||
|
|
ed828685f6 | ||
|
|
4279ea2827 | ||
|
|
95928e0585 | ||
|
|
658dcca9d6 | ||
|
|
2f6d46c06e | ||
|
|
82b158c170 | ||
|
|
b1725b8f59 | ||
|
|
886579942f | ||
|
|
0452100242 | ||
|
|
74e4508b8f | ||
|
|
bb7cea03df | ||
|
|
770ecf8786 | ||
|
|
98b797a95d | ||
|
|
4ddac65367 | ||
|
|
2570192e06 | ||
|
|
297e3ad96e | ||
|
|
705ac823ce | ||
|
|
6141f39bf8 | ||
|
|
d0b95eee58 | ||
|
|
bbf503a7d7 | ||
|
|
0f33e25c83 | ||
|
|
6f298c36fe | ||
|
|
ec538f524d | ||
|
|
887e064ae9 | ||
|
|
fc418e63ac | ||
|
|
de7e68c97a | ||
|
|
2f1b7fb6b8 | ||
|
|
c1afce7bdb | ||
|
|
ace32a2a3d | ||
|
|
cfea0edb97 | ||
|
|
e9e2b56360 | ||
|
|
99db968edf | ||
|
|
564635c776 |
@@ -0,0 +1,270 @@
|
||||
name: Module Package Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
description: Existing protected version tag to publish
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
publish-packages:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: "22"
|
||||
- name: Select and validate protected release tag
|
||||
shell: bash
|
||||
env:
|
||||
REQUESTED_TAG: ${{ inputs.release_tag }}
|
||||
TRIGGER_TAG: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tag="${REQUESTED_TAG:-$TRIGGER_TAG}"
|
||||
case "$tag" in
|
||||
v[0-9]*.[0-9]*.[0-9]*) ;;
|
||||
*) echo "Release tag must start with a SemVer-shaped vX.Y.Z value" >&2; exit 1 ;;
|
||||
esac
|
||||
git fetch --force origin "refs/tags/$tag:refs/tags/$tag" refs/heads/main:refs/remotes/origin/main
|
||||
tag_commit="$(git rev-list -n 1 "$tag")"
|
||||
git merge-base --is-ancestor "$tag_commit" refs/remotes/origin/main || {
|
||||
echo "Release tag is not contained in main" >&2
|
||||
exit 1
|
||||
}
|
||||
git checkout --detach "$tag"
|
||||
printf 'RELEASE_TAG=%s\n' "$tag" >> "$GITEA_ENV"
|
||||
printf 'SOURCE_DATE_EPOCH=%s\n' "$(git show -s --format=%ct HEAD)" >> "$GITEA_ENV"
|
||||
- name: Validate package versions
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
import os
|
||||
import re
|
||||
import tomllib
|
||||
|
||||
tag = os.environ["RELEASE_TAG"]
|
||||
expected = tag.removeprefix("v")
|
||||
project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]
|
||||
if project.get("version") != expected:
|
||||
raise SystemExit(f"pyproject version {project.get('version')!r} does not match {tag}")
|
||||
if re.fullmatch(r"govoplan-[a-z0-9-]+", str(project.get("name", ""))) is None:
|
||||
raise SystemExit("Python distribution name must use the govoplan-* namespace")
|
||||
webui = Path("webui/package.json")
|
||||
if webui.is_file():
|
||||
package = json.loads(webui.read_text(encoding="utf-8"))
|
||||
if package.get("version") != expected:
|
||||
raise SystemExit(f"WebUI version {package.get('version')!r} does not match {tag}")
|
||||
if re.fullmatch(r"@govoplan/[a-z0-9-]+-webui", str(package.get("name", ""))) is None:
|
||||
raise SystemExit("WebUI package name must use the @govoplan/*-webui namespace")
|
||||
release = Path("webui/package.release.json")
|
||||
if release.is_file():
|
||||
release_package = json.loads(release.read_text(encoding="utf-8"))
|
||||
if (
|
||||
release_package.get("name") != package.get("name")
|
||||
or release_package.get("version") != expected
|
||||
):
|
||||
raise SystemExit("WebUI release package identity does not match package.json and the release tag")
|
||||
PY
|
||||
- name: Build immutable package artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python -m pip install --disable-pip-version-check build==1.5.0 twine==7.0.0
|
||||
rm -rf dist .package-webui
|
||||
python -m build --wheel --outdir dist
|
||||
python -m twine check dist/*.whl
|
||||
if [[ -f webui/package.json ]]; then
|
||||
mkdir .package-webui
|
||||
cp -a webui/. .package-webui/
|
||||
rm -rf .package-webui/node_modules .package-webui/dist
|
||||
if [[ -f .package-webui/package.release.json ]]; then
|
||||
cp .package-webui/package.release.json .package-webui/package.json
|
||||
fi
|
||||
node <<'NODE'
|
||||
const fs = require("node:fs");
|
||||
const path = ".package-webui/package.json";
|
||||
const packageJson = JSON.parse(fs.readFileSync(path, "utf8"));
|
||||
const groups = ["dependencies", "optionalDependencies", "peerDependencies"];
|
||||
for (const group of groups) {
|
||||
for (const [name, specifier] of Object.entries(packageJson[group] || {})) {
|
||||
if (!name.startsWith("@govoplan/")) continue;
|
||||
if (typeof specifier !== "string") {
|
||||
throw new Error(`${group}.${name} must use a string version`);
|
||||
}
|
||||
const packageSlug = name.slice("@govoplan/".length);
|
||||
if (!packageSlug.endsWith("-webui")) {
|
||||
throw new Error(`${group}.${name} is outside the WebUI package namespace`);
|
||||
}
|
||||
const repository = `govoplan-${packageSlug.slice(0, -"-webui".length)}`;
|
||||
const escapedRepository = repository.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const gitTag = specifier.match(
|
||||
new RegExp(
|
||||
`^git\\+(?:ssh://git@|https://)git\\.add-ideas\\.de/(?:GovOPlaN|add-ideas)/${escapedRepository}\\.git#v([0-9]+\\.[0-9]+\\.[0-9]+)$`,
|
||||
),
|
||||
);
|
||||
if (gitTag) {
|
||||
packageJson[group][name] = gitTag[1];
|
||||
continue;
|
||||
}
|
||||
if (specifier.startsWith("file:") || specifier.startsWith("git+")) {
|
||||
throw new Error(
|
||||
`${group}.${name} must resolve to an exact registry version for publication`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
delete packageJson.private;
|
||||
fs.writeFileSync(path, `${JSON.stringify(packageJson, null, 2)}\n`);
|
||||
NODE
|
||||
npm pkg delete private --prefix .package-webui
|
||||
(cd .package-webui && npm pack --ignore-scripts --pack-destination ../dist)
|
||||
fi
|
||||
python - <<'PY'
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
artifacts = []
|
||||
for path in sorted(Path("dist").iterdir()):
|
||||
if path.suffix not in {".whl", ".tgz"}:
|
||||
continue
|
||||
digest = hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
artifacts.append({"filename": path.name, "sha256": digest, "size": path.stat().st_size})
|
||||
payload = {
|
||||
"schema_version": "1",
|
||||
"repository": os.environ["GITEA_REPOSITORY"],
|
||||
"tag": os.environ["RELEASE_TAG"],
|
||||
"commit": subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip(),
|
||||
"artifacts": artifacts,
|
||||
}
|
||||
Path("dist/package-artifacts.json").write_text(
|
||||
json.dumps(payload, indent=2, sort_keys=True) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
PY
|
||||
- name: Retain package hash evidence
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
||||
with:
|
||||
name: module-packages-${{ gitea.ref_name }}
|
||||
path: dist/package-artifacts.json
|
||||
- name: Check immutable registry state
|
||||
shell: bash
|
||||
env:
|
||||
PACKAGE_TOKEN: ${{ secrets.GOVOPLAN_PACKAGE_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$PACKAGE_TOKEN"
|
||||
python - <<'PY'
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import tomllib
|
||||
from urllib.error import HTTPError
|
||||
from urllib.parse import quote
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
api_root = "https://git.add-ideas.de/api/v1/packages/GovOPlaN"
|
||||
token = os.environ["PACKAGE_TOKEN"]
|
||||
|
||||
def should_publish(kind, name, version, path):
|
||||
package_url = "/".join(
|
||||
(api_root, kind, quote(name, safe=""), quote(version, safe=""), "files")
|
||||
)
|
||||
request = Request(
|
||||
package_url,
|
||||
headers={"Accept": "application/json", "Authorization": f"token {token}"},
|
||||
)
|
||||
try:
|
||||
with urlopen(request, timeout=30) as response:
|
||||
files = json.load(response)
|
||||
except HTTPError as exc:
|
||||
if exc.code == 404:
|
||||
print(f"{kind} package {name}=={version} is not published yet")
|
||||
return True
|
||||
raise
|
||||
if not isinstance(files, list) or len(files) != 1:
|
||||
raise SystemExit(
|
||||
f"immutable {kind} package {name}=={version} has an unexpected file set"
|
||||
)
|
||||
expected_sha256 = hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
if files[0].get("sha256") != expected_sha256:
|
||||
raise SystemExit(
|
||||
f"immutable {kind} package {name}=={version} already exists with a different SHA-256"
|
||||
)
|
||||
print(f"verified existing {kind} package {name}=={version} ({expected_sha256})")
|
||||
return False
|
||||
|
||||
project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]
|
||||
wheels = tuple(Path("dist").glob("*.whl"))
|
||||
if len(wheels) != 1:
|
||||
raise SystemExit("release build must contain exactly one wheel")
|
||||
publish_pypi = should_publish(
|
||||
"pypi", str(project["name"]), str(project["version"]), wheels[0]
|
||||
)
|
||||
|
||||
tarballs = tuple(Path("dist").glob("*.tgz"))
|
||||
if len(tarballs) > 1:
|
||||
raise SystemExit("release build must contain at most one npm package")
|
||||
publish_npm = False
|
||||
if tarballs:
|
||||
webui = json.loads(
|
||||
Path(".package-webui/package.json").read_text(encoding="utf-8")
|
||||
)
|
||||
publish_npm = should_publish(
|
||||
"npm", str(webui["name"]), str(webui["version"]), tarballs[0]
|
||||
)
|
||||
|
||||
with Path(os.environ["GITEA_ENV"]).open("a", encoding="utf-8") as env_file:
|
||||
env_file.write(f"PUBLISH_PYPI={int(publish_pypi)}\n")
|
||||
env_file.write(f"PUBLISH_NPM={int(publish_npm)}\n")
|
||||
PY
|
||||
- name: Publish wheel and WebUI package
|
||||
shell: bash
|
||||
env:
|
||||
PACKAGE_USERNAME: ${{ secrets.GOVOPLAN_PACKAGE_USERNAME }}
|
||||
PACKAGE_TOKEN: ${{ secrets.GOVOPLAN_PACKAGE_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$PACKAGE_USERNAME"
|
||||
test -n "$PACKAGE_TOKEN"
|
||||
if [[ "$PUBLISH_PYPI" == 1 ]]; then
|
||||
TWINE_USERNAME="$PACKAGE_USERNAME" TWINE_PASSWORD="$PACKAGE_TOKEN" \
|
||||
python -m twine upload --non-interactive \
|
||||
--repository-url https://git.add-ideas.de/api/packages/GovOPlaN/pypi \
|
||||
dist/*.whl
|
||||
else
|
||||
echo "Exact wheel is already present; skipping immutable retry."
|
||||
fi
|
||||
shopt -s nullglob
|
||||
webui_packages=(dist/*.tgz)
|
||||
if (( ${#webui_packages[@]} )) && [[ "$PUBLISH_NPM" == 1 ]]; then
|
||||
npmrc="$(mktemp)"
|
||||
trap 'rm -f "$npmrc"' EXIT
|
||||
chmod 600 "$npmrc"
|
||||
printf '%s\n' \
|
||||
'@govoplan:registry=https://git.add-ideas.de/api/packages/GovOPlaN/npm/' \
|
||||
"//git.add-ideas.de/api/packages/GovOPlaN/npm/:_authToken=$PACKAGE_TOKEN" \
|
||||
> "$npmrc"
|
||||
NPM_CONFIG_USERCONFIG="$npmrc" npm publish "./${webui_packages[0]}" \
|
||||
--ignore-scripts --access public \
|
||||
--registry https://git.add-ideas.de/api/packages/GovOPlaN/npm/
|
||||
elif (( ${#webui_packages[@]} )); then
|
||||
echo "Exact WebUI package is already present; skipping immutable retry."
|
||||
fi
|
||||
@@ -0,0 +1,16 @@
|
||||
# GovOPlaN Scheduling Codex Guide
|
||||
|
||||
## Scope
|
||||
|
||||
This repository owns poll-backed meeting scheduling, candidate slots, participants, constraints, availability, reminders, decisions, and Calendar handoff.
|
||||
|
||||
## Documentation Contract
|
||||
|
||||
- Treat documentation as part of every behavior change. Update this module's manifest-driven `DocumentationTopic` contributions for affected user and administrator behavior.
|
||||
- Keep feature content here; `govoplan-docs` projects it without importing Scheduling internals.
|
||||
- Maintain a static user/admin baseline and run `/mnt/DATA/git/govoplan/tools/checks/check-manifest-shapes.py` after behavior or manifest changes.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Poll owns reusable responses; Calendar owns events and free/busy; Notifications and Mail own delivery.
|
||||
- Keep optional integrations capability-driven and preserve signed-link privacy and abuse controls.
|
||||
@@ -0,0 +1,235 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
govoplan-files
|
||||
Copyright (C) 2026 add-ideas
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||
@@ -1,12 +1,17 @@
|
||||
# GovOPlaN Scheduling
|
||||
|
||||
<!-- govoplan-repository-type:start -->
|
||||
**Repository type:** module (domain).
|
||||
<!-- govoplan-repository-type:end -->
|
||||
|
||||
GovOPlaN Scheduling owns meeting scheduling and `Terminfindung`: finding
|
||||
suitable times across people, resources, calendars, constraints, and scheduling
|
||||
polls.
|
||||
|
||||
This repository is currently a tag-only scaffold. It should gain package
|
||||
metadata, a backend manifest, and a WebUI package together when the first
|
||||
implementation slice is designed.
|
||||
This repository is initialized as a discoverable module seed. It exposes the
|
||||
module manifest, permission surface, role templates, and documentation metadata
|
||||
before runtime APIs, database models, migrations, and WebUI routes are
|
||||
introduced.
|
||||
|
||||
The core boundary decision register is in
|
||||
`/mnt/DATA/git/govoplan-core/docs/MODULE_ARCHITECTURE.md`.
|
||||
@@ -15,7 +20,7 @@ The core boundary decision register is in
|
||||
|
||||
Scheduling owns:
|
||||
|
||||
- meeting scheduling polls and proposals
|
||||
- meeting scheduling polls and proposals built on `govoplan-poll`
|
||||
- participant availability collection
|
||||
- time-window and resource constraints
|
||||
- candidate-slot ranking and conflict explanation
|
||||
@@ -56,6 +61,18 @@ Participant availability is sensitive operational data. Scheduling must record:
|
||||
Availability responses should be removable or redacted after the poll decision
|
||||
unless a configured process requires longer evidence retention.
|
||||
|
||||
Scheduling publishes `privacy.dsar.scheduling` for Core's governed
|
||||
data-subject-request workflow. It projects tenant-scoped participant, request,
|
||||
candidate-slot, and notification-envelope metadata while omitting Poll and
|
||||
invitation identifiers, public-link and proof material, Calendar identifiers,
|
||||
free/busy detail, notification content and errors, password hashes, opaque
|
||||
metadata, and unrelated participants. Poll owns the actual availability choices
|
||||
and response-retirement evidence; Calendar owns event and hold state. Terminal,
|
||||
responded, or notified records are retained or manually reviewed. Only a truly
|
||||
unengaged participant can be anonymized automatically, after tenant, identity,
|
||||
request status, invitation, response, enrollment, and notification state are
|
||||
revalidated under lock.
|
||||
|
||||
## Candidate Capabilities
|
||||
|
||||
- `scheduling.polls`
|
||||
@@ -64,24 +81,244 @@ unless a configured process requires longer evidence retention.
|
||||
- `scheduling.decisionHandoff`
|
||||
- `scheduling.portalParticipation`
|
||||
|
||||
## Manifest Dependency Decision
|
||||
|
||||
The Scheduling manifest declares `poll` as a required dependency because
|
||||
availability collection and option/date poll primitives belong in
|
||||
`govoplan-poll`.
|
||||
|
||||
Scheduling should model each meeting-finding flow as a poll-backed workflow:
|
||||
Poll owns candidate options, signed participation links, responses, visibility,
|
||||
and result aggregation. Scheduling stores the scheduling-specific context and
|
||||
uses Poll context fields to point back to its request or proposal resource.
|
||||
Typical workflow steps are collect availability, rank candidates, decide, notify
|
||||
participants, and hand off to Calendar or Appointments.
|
||||
|
||||
The manifest declares `access`, `addresses`, and `evaluation` as optional
|
||||
dependencies. Scheduling uses Core's principal-aware people-search boundary to
|
||||
combine only the account and contact records visible to the current organizer;
|
||||
it never calls the instance-wide Identity search. It may trigger post-event or
|
||||
post-appointment feedback through Evaluation, and must not require any of these
|
||||
optional modules just to find a meeting time.
|
||||
|
||||
## Expected Integrations
|
||||
|
||||
- `govoplan-poll`: required availability matrix and lightweight poll primitives
|
||||
- `govoplan-evaluation`: optional post-event, post-appointment, or process feedback
|
||||
- `govoplan-calendar`: availability, calendars, resources, rooms, recurrence, Open-Xchange/calendar adapters
|
||||
- `govoplan-appointments`: conversion from a selected meeting time into a booked appointment where appropriate
|
||||
- `govoplan-access` and `govoplan-idm`: participants, groups, directory lookup, permissions
|
||||
- `govoplan-access` and `govoplan-idm`: optional participants, groups, directory lookup, permissions
|
||||
- `govoplan-mail` and `govoplan-notifications`: invitations, reminders, confirmations
|
||||
- `govoplan-portal`: external participant scheduling flows
|
||||
- `govoplan-workflow` and `govoplan-tasks`: follow-up work after a time is selected
|
||||
|
||||
## Participant selection boundary
|
||||
|
||||
The editor uses Core's shared `PeoplePicker`. Its server-side search aggregates
|
||||
the optional `access.people_search` and `addresses.people_search` capabilities,
|
||||
and each provider applies the active principal and tenant visibility rules
|
||||
before returning a candidate. Scheduling exposes only the fields needed to
|
||||
select a person; provider provenance, address-book topology, group membership,
|
||||
and other internals are not returned by its picker endpoint.
|
||||
|
||||
An account selection becomes an internal participant bound to that account.
|
||||
A visible address-book contact becomes an external participant with a bounded
|
||||
directory-selection reference and revision for later organizer editing. Manual
|
||||
name-and-email entry is available only while the request allows external
|
||||
participants. The picker stores neither provider-internal provenance nor a
|
||||
global Identity record reference in participant metadata.
|
||||
|
||||
## First Package Scaffold Decision
|
||||
|
||||
The first scaffold should include both backend and WebUI package metadata once
|
||||
implementation starts:
|
||||
The first backend implementation slice adds runtime APIs and storage around
|
||||
poll-backed scheduling requests:
|
||||
|
||||
- backend manifest, permissions, DTOs, and APIs for internal polls
|
||||
- WebUI route contribution for poll creation and response collection
|
||||
- capability contracts for calendar free/busy, access/IDM lookup,
|
||||
mail/notification sending, portal participation links, appointment handoff,
|
||||
and workflow/task follow-up
|
||||
- scheduling request, candidate slot, and participant storage
|
||||
- automatic `govoplan-poll` availability poll creation
|
||||
- signed poll invitations for internal or external participants
|
||||
- request lifecycle APIs: draft, collecting, closed, decided, handed off, cancelled
|
||||
- result summaries sourced from Poll response aggregation
|
||||
- optional Calendar free/busy checks, tentative holds, and final event creation
|
||||
- notification outbox jobs for invitations, reminders, decisions,
|
||||
cancellations, and participant access changes
|
||||
- a first Scheduling WebUI package with request creation, slot matrix, Calendar
|
||||
actions, decisions, and notification-job creation
|
||||
|
||||
## Interface workflow and contextual guidance
|
||||
|
||||
The route-by-route migration record and verification contract are documented in
|
||||
[`docs/INTERFACE_PATTERN_MIGRATION.md`](docs/INTERFACE_PATTERN_MIGRATION.md).
|
||||
|
||||
The request detail projects the existing backend lifecycle into three stable
|
||||
user stages: prepare the request, collect participation, and decide. Draft,
|
||||
collecting, closed, decided, handed-off, cancelled, and archived records remain
|
||||
the authoritative backend states; the stage rail is only a readable projection
|
||||
and does not invent a second workflow state machine. Cancelled requests keep the
|
||||
reached stage visible as stopped, while later stages remain locked.
|
||||
|
||||
Unavailable Calendar coordination and public guest participation use Core's
|
||||
action-blocker pattern. The UI names the reason, required remediation,
|
||||
responsible administrator, and destination instead of displaying a generic
|
||||
disabled control. Stable help links resolve to the configured Docs module when
|
||||
present and to the hosted documentation otherwise. Scheduling contributes the
|
||||
`scheduling.find-and-decide-meeting-time`, `scheduling.calendar-coordination`,
|
||||
and `scheduling.participation-governance` topics; it does not import Docs,
|
||||
Calendar, Poll, Policy, or Access implementation code.
|
||||
|
||||
The next slices should add generic self-enrolment links after their abuse and
|
||||
identity policy is agreed, Calendar hold cleanup after decision, and advanced
|
||||
scoring constraints such as required participants and quorum rules.
|
||||
|
||||
The active backlog lives in Gitea issues.
|
||||
|
||||
## Signed-participation policy gate
|
||||
|
||||
Scheduling persists the response policy and snapshots it onto each governed
|
||||
Poll invitation. Public access uses
|
||||
`/scheduling/public/{request_id}/{token}`; Poll's ordinary public routes reject
|
||||
these gateway-bound tokens, so callers cannot bypass Scheduling's password and
|
||||
request checks. Passwords are write-only, stored only as salted PBKDF2 hashes,
|
||||
and failed checks are throttled through Redis when configured with a bounded
|
||||
in-process fallback.
|
||||
|
||||
Poll is the transactional authority for response rules. Its governed submission
|
||||
holds the Poll-row lock while enforcing single choice, `Maybe`, participant
|
||||
email, comments, idempotency and per-option capacity. Scheduling then updates
|
||||
its participant projection in the same database transaction. Candidate-slot
|
||||
add/remove and participant-link revocation also go through the governed Poll
|
||||
capability; exact retries are idempotent, and option mutations invalidate only
|
||||
the affected answers.
|
||||
|
||||
Public submissions lock the Scheduling request and participant rows before
|
||||
entering Poll, matching organizer edit lock order and making first-use email
|
||||
binding atomic. Both authenticated and public submission paths independently
|
||||
require the Scheduling request to be collecting and its deadline not to have
|
||||
passed, so a stale or incorrectly reopened Poll projection cannot accept a
|
||||
response. Changing a request deadline transactionally updates each governed
|
||||
invitation's expiry in Poll under owner- and gateway-bound row locks. The same
|
||||
link and invitation identity survive future, past, extended, and cleared
|
||||
deadlines: a past deadline makes the link unusable, a later extension makes the
|
||||
same link usable again, and clearing the deadline removes its expiry. No raw
|
||||
replacement token crosses the PATCH response, and existing responses plus
|
||||
participant status remain attached to the same durable respondent identity.
|
||||
|
||||
Cancellation closes the backing Poll, so submission fails, while active links
|
||||
remain usable as a reduced cancellation notice for a bounded period. The
|
||||
deployment setting `SCHEDULING_CANCELLATION_NOTICE_DAYS` defaults to 30 and is
|
||||
bounded to 1–90 days. Cancellation transactionally aligns governed invitation
|
||||
expiry with that timestamp. The public projection contains only the request
|
||||
title and cancellation timestamps; descriptions, locations, candidate slots,
|
||||
comments, and previous answers are omitted. After the bound, access fails with
|
||||
the same generic response as an invalid or expired link.
|
||||
|
||||
If the governed capability is absent, API responses advertise that policy
|
||||
enforcement is unavailable and restricted links fail closed. Plaintext
|
||||
passwords, token hashes, response-gateway internals and the participant roster
|
||||
are not exposed by the public response model.
|
||||
|
||||
Authenticated participant list/detail projections likewise omit tenant,
|
||||
organizer, Poll and Calendar identifiers, connector metadata, invitation and
|
||||
identity bindings. Free/busy conflicts are reduced to useful time/status
|
||||
fields. Organizers and scheduling administrators retain the full management
|
||||
projection; participants retain candidate-slot revisions, their own marker and
|
||||
email, response settings, aggregates, and any roster names/statuses permitted
|
||||
by the configured privacy policy.
|
||||
|
||||
The WebUI package registers `/scheduling/public/{request}/{token}` through
|
||||
Core's explicit, backend-allowlisted public-route contract. The guest page uses
|
||||
the shared UI components, prompts for email/password only when needed, prefills
|
||||
an existing response, and enforces the snapshotted response rules. The token
|
||||
stays in the path and is never copied into query parameters or browser storage.
|
||||
Signed-in users also receive an in-app deep link without weakening the signed
|
||||
guest-link boundary.
|
||||
|
||||
Creating, editing, and opening a request never issue public tokens or enqueue
|
||||
invitation delivery. The deprecated `create_participant_invitations` request
|
||||
field remains accepted for compatibility, defaults to `false`, and has no side
|
||||
effect. Authenticated in-module responses can still lazily create a
|
||||
gateway-bound invitation whose token is discarded.
|
||||
|
||||
Organizers and Scheduling administrators use the participant-specific
|
||||
invitation action instead:
|
||||
|
||||
- `POST /scheduling/requests/{request_id}/participants/{participant_id}/invitation`
|
||||
with `{"action":"copy","participant_revision":"..."}` rotates the previous
|
||||
invitation and returns the new relative action URL once. The response is
|
||||
marked `no-store`.
|
||||
- The same endpoint with `{"action":"send"}` rotates the invitation and passes
|
||||
its URL directly to the notification dispatch job; it also requires the
|
||||
current `participant_revision`. Neither the API response nor Scheduling's
|
||||
durable notification projection contains the token.
|
||||
- `DELETE` on the same resource uses a JSON body containing the current
|
||||
`participant_revision` and revokes the active link immediately. A revoke
|
||||
against the refreshed no-link projection is an idempotent replay.
|
||||
|
||||
The semantic participant revision includes the current invitation identity.
|
||||
It is checked after the participant row is locked, so stale copy, send, and
|
||||
revoke commands return `409` before rotating a newer link or delivering to a
|
||||
changed recipient.
|
||||
|
||||
The participant DataGrid presents copy, send, and revoke as a fixed icon-only
|
||||
action group. Authorized but unavailable actions remain visible and explain
|
||||
why they are disabled: for example, delivery is disabled without a dispatch
|
||||
provider or recipient target, and revoke is disabled when no active link
|
||||
exists. The delivery capability is exposed only in management projections.
|
||||
Copy accepts only the same-origin Scheduling public path and does not persist
|
||||
the bearer URL in component state, logs, or browser storage.
|
||||
|
||||
Links can be issued in any request state. Collection state and deadline checks
|
||||
remain independent submission requirements, so a link to a draft, closed, or
|
||||
decided request is read-only. Issue, copy, send-request, and revoke actions are
|
||||
audited with request and participant identifiers but never a bearer token.
|
||||
Only an organizer (under the ordinary Scheduling write policy) or a tenant-wide
|
||||
Scheduling administrator can use these actions. If notification delivery is
|
||||
not installed, `send` fails before rotating the current link and the organizer
|
||||
can use `copy` for separate distribution.
|
||||
|
||||
Participant edits carry a semantic revision so a stale organizer form cannot
|
||||
overwrite an invitation or response change. Corrections that retain a stable
|
||||
account or directory identity update the existing participant. A display-name
|
||||
correction keeps its invitation; changing a delivery email revokes the stale
|
||||
link but keeps a response tied to the unchanged account identity.
|
||||
|
||||
Changing the canonical identity creates a new participant instead of assigning
|
||||
the former participant's response to another person. In the same transaction,
|
||||
Scheduling revokes the old invitation and Poll soft-deletes every matching
|
||||
live response. Poll retains the answers and a bounded retirement record for
|
||||
audit, while result summaries and capacity checks immediately exclude them.
|
||||
Removing an invited or responding participant follows the same retirement
|
||||
path. Scheduling records privacy-safe audit facts and queues a removal or
|
||||
replacement notice to the former recipient without placing email addresses or
|
||||
response contents in the audit event.
|
||||
|
||||
## FieldLabel omission register
|
||||
|
||||
Scheduling uses the shared `FieldLabel` for form controls that need explanatory
|
||||
inline help. The only intentional omissions are:
|
||||
|
||||
- Candidate-slot and participant DataGrid cells: column headers supply the
|
||||
visible label and each interactive cell has an accessible name.
|
||||
- Per-slot availability selects: the enclosing visible slot/date text is the
|
||||
native label for that individual choice.
|
||||
|
||||
There are no other authorized Scheduling omissions. Inline help remains
|
||||
controlled by the user's shared interface setting; hiding it does not remove
|
||||
accessible labels.
|
||||
|
||||
## Git-source WebUI package
|
||||
|
||||
The repository root exposes `@govoplan/scheduling-webui` for Git-tagged release
|
||||
dependencies. It mirrors the owning `webui/package.json` version, public
|
||||
TypeScript/CSS exports and peer requirements, with entry paths under
|
||||
`webui/src`. Consumers provide the shared Core/React peers; the facade runs no
|
||||
development or install scripts. The source archive contains `webui/src`, this
|
||||
README and any repository license file. Run module development checks from `webui/`; Python
|
||||
installation remains governed by `pyproject.toml`.
|
||||
|
||||
Das Repository stellt `@govoplan/scheduling-webui` am Wurzelpfad für versionierte
|
||||
Git-Abhängigkeiten bereit. Version, öffentliche TypeScript-/CSS-Exporte und
|
||||
Peer-Anforderungen entsprechen `webui/package.json`; die Einstiegspfade liegen
|
||||
unter `webui/src`. Gemeinsame Core-/React-Peers stellt die einbindende Anwendung
|
||||
bereit. Die Fassade führt keine Entwicklungs- oder Installationsskripte aus.
|
||||
Entwicklungsprüfungen bleiben in `webui/`, die Python-Installation weiterhin in
|
||||
`pyproject.toml` definiert.
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# Scheduling Interface Pattern Migration
|
||||
|
||||
Scheduling implements the platform interface pattern language on its owned
|
||||
surfaces without importing optional module internals.
|
||||
|
||||
## Surface Map
|
||||
|
||||
| Surface | Pattern | Consequential actions | Help context |
|
||||
| --- | --- | --- | --- |
|
||||
| `/scheduling` request list and detail | Persistent list-detail workspace with a lifecycle rail | Open, close, remind, decide, create holds, create final event | `scheduling.list`, `scheduling.request` |
|
||||
| `/scheduling` create/edit | Bounded editor with unsaved-change guard and typed Core controls | Save or discard a request definition | `scheduling.editor` |
|
||||
| `/scheduling/public/:requestId/:token` | Privacy-bounded public participation form | Submit or replace the invited participant's response | `scheduling.public-participation` |
|
||||
| `scheduling.widget.open-requests` | Compact dashboard contribution | Navigate to the selected request | `scheduling.request` |
|
||||
|
||||
## Interaction Contract
|
||||
|
||||
- Closing a poll, creating reminder jobs or Calendar objects, and deciding a
|
||||
final slot require a shared confirmation dialog. Invitation-link revocation
|
||||
uses the same component with danger emphasis.
|
||||
- Disabled actions expose the active busy, permission, immutable-response, or
|
||||
optional-capability reason through Core's action-tooltip and blocker
|
||||
components.
|
||||
- Calendar selection uses the optional `calendar.picker` UI capability and
|
||||
bounded Calendar scopes. Scheduling never imports Calendar WebUI code.
|
||||
- Participant selection uses Core's provider-backed `PeoplePicker`; public
|
||||
participation receives only the privacy-bounded request projection.
|
||||
- Stable documentation topics are available from the list, editor, detail,
|
||||
public participation page, and dashboard widget. Core resolves them through
|
||||
Docs when enabled and through hosted documentation otherwise.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
cd webui
|
||||
npm run test:view-model
|
||||
npm run test:ui-structure
|
||||
```
|
||||
|
||||
The structural check guards shared components, optional-module boundaries,
|
||||
confirmation gates, contextual documentation, public credential controls, and
|
||||
request-specific widget navigation. Backend tests validate manifest metadata,
|
||||
permission boundaries, lifecycle transitions, public participation, and
|
||||
Calendar capability behavior.
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@govoplan/scheduling-webui",
|
||||
"version": "0.1.22",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "webui/src/index.ts",
|
||||
"module": "webui/src/index.ts",
|
||||
"types": "webui/src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./webui/src/index.ts",
|
||||
"import": "./webui/src/index.ts"
|
||||
},
|
||||
"./styles/scheduling.css": "./webui/src/styles/scheduling.css"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@govoplan/core-webui": "^0.1.45",
|
||||
"lucide-react": "^1.23.0",
|
||||
"react": ">=19.2.7 <20",
|
||||
"react-dom": ">=19.2.7 <20",
|
||||
"react-router": ">=8.3.0 <9",
|
||||
"@vitejs/plugin-react": "^5.2.0",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^7.3.6"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@govoplan/core-webui": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"webui/src",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=69", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "govoplan-scheduling"
|
||||
version = "0.1.22"
|
||||
description = "GovOPlaN meeting scheduling and Terminfindung module seed."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
license = { file = "LICENSE" }
|
||||
authors = [{ name = "GovOPlaN" }]
|
||||
dependencies = [
|
||||
"govoplan-core>=0.1.45",
|
||||
"govoplan-poll>=0.1.18",
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
govoplan_scheduling = ["py.typed"]
|
||||
|
||||
[project.entry-points."govoplan.modules"]
|
||||
scheduling = "govoplan_scheduling.backend.manifest:get_manifest"
|
||||
@@ -0,0 +1,5 @@
|
||||
"""GovOPlaN Scheduling module."""
|
||||
|
||||
__all__ = ["__version__"]
|
||||
|
||||
__version__ = "0.1.22"
|
||||
@@ -0,0 +1 @@
|
||||
"""Backend package for the GovOPlaN Scheduling module."""
|
||||
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingNotification,
|
||||
SchedulingParticipant,
|
||||
SchedulingPublicEnrollmentLink,
|
||||
SchedulingRequest,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"SchedulingCandidateSlot",
|
||||
"SchedulingNotification",
|
||||
"SchedulingParticipant",
|
||||
"SchedulingPublicEnrollmentLink",
|
||||
"SchedulingRequest",
|
||||
]
|
||||
@@ -0,0 +1,198 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import Boolean, DateTime, ForeignKey, Index, Integer, JSON, String, Text, UniqueConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from govoplan_core.db.base import Base, TimestampMixin
|
||||
|
||||
|
||||
def new_uuid() -> str:
|
||||
return str(uuid.uuid4())
|
||||
|
||||
|
||||
class SchedulingRequest(Base, TimestampMixin):
|
||||
__tablename__ = "scheduling_requests"
|
||||
__table_args__ = (
|
||||
Index("ix_scheduling_requests_tenant_status", "tenant_id", "status"),
|
||||
Index("ix_scheduling_requests_tenant_poll", "tenant_id", "poll_id"),
|
||||
Index("ix_scheduling_requests_deadline", "tenant_id", "deadline_at"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_uuid)
|
||||
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
|
||||
title: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(Text)
|
||||
location: Mapped[str | None] = mapped_column(String(500))
|
||||
timezone: Mapped[str] = mapped_column(String(100), default="UTC", nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(40), default="draft", nullable=False, index=True)
|
||||
poll_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
selected_slot_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
organizer_user_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
deadline_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, index=True)
|
||||
allow_external_participants: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
allow_participant_updates: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
result_visibility: Mapped[str] = mapped_column(String(30), default="after_close", nullable=False)
|
||||
participant_visibility: Mapped[str] = mapped_column(String(32), default="aggregates_only", nullable=False)
|
||||
notify_on_answers: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
single_choice: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
max_participants_per_option: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
allow_maybe: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
allow_comments: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
participant_email_required: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
anonymous_password_protection_enabled: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
anonymous_password_hash: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
calendar_integration_enabled: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
calendar_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
calendar_freebusy_enabled: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
calendar_hold_enabled: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
create_calendar_event_on_decision: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
calendar_event_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
handed_off_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
cancelled_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
cancellation_notice_until: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
deleted_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, index=True)
|
||||
metadata_: Mapped[dict[str, Any] | None] = mapped_column("metadata", JSON, nullable=True)
|
||||
|
||||
slots: Mapped[list["SchedulingCandidateSlot"]] = relationship(
|
||||
back_populates="request",
|
||||
cascade="all, delete-orphan",
|
||||
order_by="SchedulingCandidateSlot.position",
|
||||
)
|
||||
participants: Mapped[list["SchedulingParticipant"]] = relationship(
|
||||
back_populates="request",
|
||||
cascade="all, delete-orphan",
|
||||
order_by="SchedulingParticipant.created_at",
|
||||
)
|
||||
enrollment_links: Mapped[list["SchedulingPublicEnrollmentLink"]] = relationship(
|
||||
back_populates="request",
|
||||
cascade="all, delete-orphan",
|
||||
order_by="SchedulingPublicEnrollmentLink.created_at",
|
||||
)
|
||||
|
||||
|
||||
class SchedulingPublicEnrollmentLink(Base, TimestampMixin):
|
||||
"""Reusable public credential that may create bounded participants."""
|
||||
|
||||
__tablename__ = "scheduling_public_enrollment_links"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("token_hash", name="uq_scheduling_enrollment_link_token_hash"),
|
||||
Index("ix_scheduling_enrollment_links_request", "tenant_id", "request_id"),
|
||||
Index("ix_scheduling_enrollment_links_expiry", "tenant_id", "expires_at"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_uuid)
|
||||
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
|
||||
request_id: Mapped[str] = mapped_column(
|
||||
ForeignKey("scheduling_requests.id", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
token_hash: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
max_enrollments: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
expires_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, index=True)
|
||||
allow_anonymous: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
allow_authenticated: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
created_by: Mapped[str | None] = mapped_column(String(255), nullable=True, index=True)
|
||||
revoked_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, index=True)
|
||||
metadata_: Mapped[dict[str, Any] | None] = mapped_column("metadata", JSON, nullable=True)
|
||||
|
||||
request: Mapped[SchedulingRequest] = relationship(back_populates="enrollment_links")
|
||||
|
||||
|
||||
class SchedulingCandidateSlot(Base, TimestampMixin):
|
||||
__tablename__ = "scheduling_candidate_slots"
|
||||
__table_args__ = (
|
||||
Index("ix_scheduling_candidate_slots_request_position", "request_id", "position"),
|
||||
Index("ix_scheduling_candidate_slots_range", "tenant_id", "start_at", "end_at"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_uuid)
|
||||
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
|
||||
request_id: Mapped[str] = mapped_column(ForeignKey("scheduling_requests.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
poll_option_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
label: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(Text)
|
||||
start_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, index=True)
|
||||
end_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, index=True)
|
||||
timezone: Mapped[str] = mapped_column(String(100), default="UTC", nullable=False)
|
||||
location: Mapped[str | None] = mapped_column(String(500))
|
||||
position: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
freebusy_checked_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
freebusy_status: Mapped[str | None] = mapped_column(String(40), nullable=True, index=True)
|
||||
freebusy_conflicts: Mapped[list[dict[str, Any]]] = mapped_column(JSON, default=list, nullable=False)
|
||||
tentative_hold_event_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
deleted_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, index=True)
|
||||
metadata_: Mapped[dict[str, Any] | None] = mapped_column("metadata", JSON, nullable=True)
|
||||
|
||||
request: Mapped[SchedulingRequest] = relationship(back_populates="slots")
|
||||
|
||||
|
||||
class SchedulingParticipant(Base, TimestampMixin):
|
||||
__tablename__ = "scheduling_participants"
|
||||
__table_args__ = (
|
||||
Index("ix_scheduling_participants_request", "tenant_id", "request_id"),
|
||||
Index("ix_scheduling_participants_request_email", "request_id", "email"),
|
||||
Index("ix_scheduling_participants_request_respondent", "request_id", "respondent_id"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_uuid)
|
||||
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
|
||||
request_id: Mapped[str] = mapped_column(ForeignKey("scheduling_requests.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
respondent_id: Mapped[str | None] = mapped_column(String(255), nullable=True, index=True)
|
||||
display_name: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
email: Mapped[str | None] = mapped_column(String(320), nullable=True, index=True)
|
||||
participant_type: Mapped[str] = mapped_column(String(30), default="external", nullable=False, index=True)
|
||||
required: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(40), default="invited", nullable=False, index=True)
|
||||
poll_invitation_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
participation_gateway: Mapped[str | None] = mapped_column(String(40), nullable=True)
|
||||
self_enrollment_link_id: Mapped[str | None] = mapped_column(
|
||||
ForeignKey("scheduling_public_enrollment_links.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
self_enrollment_proof_hash: Mapped[str | None] = mapped_column(String(64), nullable=True)
|
||||
bound_account_id: Mapped[str | None] = mapped_column(String(255), nullable=True, index=True)
|
||||
account_bound_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
last_invited_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
responded_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
response_comment: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
deleted_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, index=True)
|
||||
metadata_: Mapped[dict[str, Any] | None] = mapped_column("metadata", JSON, nullable=True)
|
||||
|
||||
request: Mapped[SchedulingRequest] = relationship(back_populates="participants")
|
||||
|
||||
|
||||
class SchedulingNotification(Base, TimestampMixin):
|
||||
__tablename__ = "scheduling_notifications"
|
||||
__table_args__ = (
|
||||
Index("ix_scheduling_notifications_request_status", "request_id", "status"),
|
||||
Index("ix_scheduling_notifications_tenant_status", "tenant_id", "status"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_uuid)
|
||||
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
|
||||
request_id: Mapped[str] = mapped_column(ForeignKey("scheduling_requests.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
participant_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
event_kind: Mapped[str] = mapped_column(String(40), nullable=False, index=True)
|
||||
channel: Mapped[str] = mapped_column(String(40), default="mail", nullable=False, index=True)
|
||||
recipient: Mapped[str | None] = mapped_column(String(500), nullable=True, index=True)
|
||||
status: Mapped[str] = mapped_column(String(40), default="pending", nullable=False, index=True)
|
||||
payload: Mapped[dict[str, Any]] = mapped_column(JSON, default=dict, nullable=False)
|
||||
error: Mapped[str | None] = mapped_column(Text)
|
||||
sent_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
metadata_: Mapped[dict[str, Any] | None] = mapped_column("metadata", JSON, nullable=True)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"SchedulingCandidateSlot",
|
||||
"SchedulingNotification",
|
||||
"SchedulingParticipant",
|
||||
"SchedulingPublicEnrollmentLink",
|
||||
"SchedulingRequest",
|
||||
"new_uuid",
|
||||
]
|
||||
@@ -0,0 +1,891 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping, Sequence
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy import func, or_
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from govoplan_core.core.dsar import (
|
||||
DsarErasureActionRef,
|
||||
DsarExecutionResultRef,
|
||||
DsarRecordRef,
|
||||
DsarSubjectRef,
|
||||
dsar_capability_name,
|
||||
)
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingNotification,
|
||||
SchedulingParticipant,
|
||||
SchedulingRequest,
|
||||
)
|
||||
|
||||
|
||||
SCHEDULING_DSAR_CAPABILITY = dsar_capability_name("scheduling")
|
||||
_MAX_RECORDS = 5_000
|
||||
_TERMINAL_REQUEST_STATUSES = frozenset(
|
||||
{"decided", "handed_off", "cancelled", "archived"}
|
||||
)
|
||||
_TERMINAL_NOTIFICATION_STATUSES = frozenset({"sent", "failed", "skipped", "cancelled"})
|
||||
|
||||
|
||||
class SchedulingDsarProvider:
|
||||
provider_id = "scheduling"
|
||||
module_id = "scheduling"
|
||||
|
||||
def search_subject(
|
||||
self,
|
||||
session: object,
|
||||
*,
|
||||
tenant_id: str,
|
||||
subject: DsarSubjectRef,
|
||||
) -> Sequence[DsarRecordRef]:
|
||||
db = _session(session)
|
||||
references = _scheduling_references(subject)
|
||||
membership_ids = _membership_ids(subject)
|
||||
respondent_ids = _respondent_ids(subject)
|
||||
account_ids = _account_ids(subject)
|
||||
email = _subject_email(subject)
|
||||
if not any(
|
||||
(
|
||||
references,
|
||||
membership_ids,
|
||||
respondent_ids,
|
||||
account_ids,
|
||||
email,
|
||||
)
|
||||
):
|
||||
return ()
|
||||
|
||||
participants = _matching_participants(
|
||||
db,
|
||||
tenant_id=tenant_id,
|
||||
participant_id=references.get("participant"),
|
||||
respondent_ids=respondent_ids,
|
||||
account_ids=account_ids,
|
||||
email=email,
|
||||
)
|
||||
participant_ids = {row.id for row in participants}
|
||||
request_ids = {row.request_id for row in participants}
|
||||
if references.get("request"):
|
||||
request_ids.add(references["request"])
|
||||
requests = _matching_requests(
|
||||
db,
|
||||
tenant_id=tenant_id,
|
||||
request_ids=request_ids,
|
||||
organizer_ids=membership_ids,
|
||||
)
|
||||
requests_by_id = {row.id: row for row in requests}
|
||||
request_ids = set(requests_by_id)
|
||||
notifications = _matching_notifications(
|
||||
db,
|
||||
tenant_id=tenant_id,
|
||||
request_ids=request_ids,
|
||||
participant_ids=participant_ids,
|
||||
respondent_ids=respondent_ids,
|
||||
email=email,
|
||||
)
|
||||
notifications_by_participant: dict[str, list[SchedulingNotification]] = {}
|
||||
for notification in notifications:
|
||||
if notification.participant_id:
|
||||
notifications_by_participant.setdefault(
|
||||
notification.participant_id, []
|
||||
).append(notification)
|
||||
|
||||
records: list[DsarRecordRef] = []
|
||||
|
||||
def append(record: DsarRecordRef) -> None:
|
||||
if len(records) >= _MAX_RECORDS:
|
||||
raise ValueError(
|
||||
"Scheduling DSAR match limit exceeded; narrow the subject selectors."
|
||||
)
|
||||
records.append(record)
|
||||
|
||||
for request in requests:
|
||||
participant_context = request.id in {row.request_id for row in participants}
|
||||
organizer_context = bool(
|
||||
request.organizer_user_id
|
||||
and request.organizer_user_id in membership_ids
|
||||
)
|
||||
immutable = _request_is_evidence(request)
|
||||
append(
|
||||
_record(
|
||||
"scheduling_request",
|
||||
request.id,
|
||||
"scheduling_request",
|
||||
request.title,
|
||||
{
|
||||
"match_fields": (
|
||||
["organizer_user_id"] if organizer_context else []
|
||||
),
|
||||
"participant_context": participant_context,
|
||||
"title": request.title,
|
||||
"description": request.description,
|
||||
"location": request.location,
|
||||
"timezone": request.timezone,
|
||||
"status": request.status,
|
||||
"deadline_at": _iso(request.deadline_at),
|
||||
"allow_external_participants": request.allow_external_participants,
|
||||
"allow_participant_updates": request.allow_participant_updates,
|
||||
"result_visibility": request.result_visibility,
|
||||
"participant_visibility": request.participant_visibility,
|
||||
"notify_on_answers": request.notify_on_answers,
|
||||
"single_choice": request.single_choice,
|
||||
"max_participants_per_option": request.max_participants_per_option,
|
||||
"allow_maybe": request.allow_maybe,
|
||||
"allow_comments": request.allow_comments,
|
||||
"participant_email_required": request.participant_email_required,
|
||||
"calendar_integration_enabled": request.calendar_integration_enabled,
|
||||
"calendar_freebusy_enabled": request.calendar_freebusy_enabled,
|
||||
"calendar_hold_enabled": request.calendar_hold_enabled,
|
||||
"create_calendar_event_on_decision": request.create_calendar_event_on_decision,
|
||||
"handed_off_at": _iso(request.handed_off_at),
|
||||
"cancelled_at": _iso(request.cancelled_at),
|
||||
"deleted_at": _iso(request.deleted_at),
|
||||
},
|
||||
observed_at=request.updated_at,
|
||||
immutable=immutable,
|
||||
retention_reason=(
|
||||
"Decided, handed-off, cancelled, archived, or deleted scheduling state is institutional decision and coordination evidence."
|
||||
if immutable
|
||||
else None
|
||||
),
|
||||
source_path=f"/scheduling?request={request.id}",
|
||||
)
|
||||
)
|
||||
|
||||
for slot in _candidate_slots(
|
||||
db,
|
||||
tenant_id=tenant_id,
|
||||
request_ids=request_ids,
|
||||
):
|
||||
request = requests_by_id[slot.request_id]
|
||||
immutable = _request_is_evidence(request) or slot.deleted_at is not None
|
||||
append(
|
||||
_record(
|
||||
"scheduling_candidate_slot",
|
||||
slot.id,
|
||||
"scheduling_candidate_context",
|
||||
slot.label,
|
||||
{
|
||||
"request_id": slot.request_id,
|
||||
"label": slot.label,
|
||||
"description": slot.description,
|
||||
"start_at": _iso(slot.start_at),
|
||||
"end_at": _iso(slot.end_at),
|
||||
"timezone": slot.timezone,
|
||||
"location": slot.location,
|
||||
"position": slot.position,
|
||||
"freebusy_checked_at": _iso(slot.freebusy_checked_at),
|
||||
"freebusy_status": slot.freebusy_status,
|
||||
"deleted_at": _iso(slot.deleted_at),
|
||||
},
|
||||
observed_at=slot.updated_at,
|
||||
immutable=immutable,
|
||||
retention_reason=(
|
||||
"Candidate timing retained with terminal Scheduling decision evidence."
|
||||
if immutable
|
||||
else None
|
||||
),
|
||||
source_path=f"/scheduling?request={slot.request_id}",
|
||||
)
|
||||
)
|
||||
|
||||
for participant in participants:
|
||||
request = requests_by_id.get(participant.request_id)
|
||||
if request is None:
|
||||
continue
|
||||
matching_fields = _participant_matching_fields(
|
||||
participant,
|
||||
participant_id=references.get("participant"),
|
||||
respondent_ids=respondent_ids,
|
||||
account_ids=account_ids,
|
||||
email=email,
|
||||
)
|
||||
immutable = _request_is_evidence(request) or _participant_is_evidence(
|
||||
participant,
|
||||
notifications_by_participant.get(participant.id, ()),
|
||||
)
|
||||
erasable_without_coordination = not immutable and _participant_is_unengaged(
|
||||
participant,
|
||||
notifications_by_participant.get(participant.id, ()),
|
||||
)
|
||||
append(
|
||||
_record(
|
||||
"scheduling_participant",
|
||||
participant.id,
|
||||
"scheduling_participation",
|
||||
participant.display_name or "Scheduling participant",
|
||||
{
|
||||
"match_fields": matching_fields,
|
||||
"request_id": participant.request_id,
|
||||
"display_name": participant.display_name,
|
||||
"email": _normalized_email(participant.email),
|
||||
"participant_type": participant.participant_type,
|
||||
"required": participant.required,
|
||||
"status": participant.status,
|
||||
"account_bound_at": _iso(participant.account_bound_at),
|
||||
"last_invited_at": _iso(participant.last_invited_at),
|
||||
"responded_at": _iso(participant.responded_at),
|
||||
"response_comment": _bounded_text(participant.response_comment),
|
||||
"deleted_at": _iso(participant.deleted_at),
|
||||
"erasable_without_coordination": erasable_without_coordination,
|
||||
},
|
||||
observed_at=participant.updated_at,
|
||||
immutable=immutable,
|
||||
retention_reason=(
|
||||
"Responded, notified, removed, or terminal participant state is retained with Poll and Scheduling decision evidence."
|
||||
if immutable
|
||||
else None
|
||||
),
|
||||
source_path=f"/scheduling?request={participant.request_id}",
|
||||
)
|
||||
)
|
||||
|
||||
for notification in notifications:
|
||||
immutable = bool(
|
||||
notification.sent_at
|
||||
or notification.status in _TERMINAL_NOTIFICATION_STATUSES
|
||||
)
|
||||
append(
|
||||
_record(
|
||||
"scheduling_notification",
|
||||
notification.id,
|
||||
"scheduling_notification_evidence",
|
||||
f"Scheduling {notification.event_kind} notification",
|
||||
{
|
||||
"match_fields": _notification_matching_fields(
|
||||
notification,
|
||||
participant_ids=participant_ids,
|
||||
respondent_ids=respondent_ids,
|
||||
email=email,
|
||||
),
|
||||
"request_id": notification.request_id,
|
||||
"participant_id": (
|
||||
notification.participant_id
|
||||
if notification.participant_id in participant_ids
|
||||
else None
|
||||
),
|
||||
"event_kind": notification.event_kind,
|
||||
"channel": notification.channel,
|
||||
"recipient": _matching_recipient(
|
||||
notification.recipient,
|
||||
respondent_ids=respondent_ids,
|
||||
email=email,
|
||||
),
|
||||
"status": notification.status,
|
||||
"sent_at": _iso(notification.sent_at),
|
||||
},
|
||||
observed_at=notification.updated_at,
|
||||
immutable=immutable,
|
||||
retention_reason=(
|
||||
"Terminal Scheduling notification state is delivery and participant-access evidence."
|
||||
if immutable
|
||||
else None
|
||||
),
|
||||
)
|
||||
)
|
||||
return tuple(records)
|
||||
|
||||
def plan_erasure(
|
||||
self,
|
||||
session: object,
|
||||
*,
|
||||
tenant_id: str,
|
||||
subject: DsarSubjectRef,
|
||||
records: Sequence[DsarRecordRef],
|
||||
) -> Sequence[DsarErasureActionRef]:
|
||||
del session
|
||||
actions: list[DsarErasureActionRef] = []
|
||||
for record in records:
|
||||
if (
|
||||
record.provider_id != self.provider_id
|
||||
or record.module_id != self.module_id
|
||||
):
|
||||
raise ValueError("Scheduling DSAR received a foreign provider record.")
|
||||
actions.append(
|
||||
_action(
|
||||
f"scheduling:{'retain' if record.immutable_evidence else 'review'}:{record.resource_type}:{record.resource_id}",
|
||||
"retain" if record.immutable_evidence else "manual_review",
|
||||
record,
|
||||
f"{'Retain' if record.immutable_evidence else 'Review'} {record.title}",
|
||||
record.retention_reason
|
||||
or "Scheduling data can overlap Poll responses, Calendar effects, shared participants, and institutional decisions; review it through the owning lifecycle controls.",
|
||||
executable=False,
|
||||
)
|
||||
)
|
||||
if (
|
||||
record.resource_type == "scheduling_participant"
|
||||
and record.data.get("erasable_without_coordination") is True
|
||||
and record.data.get("match_fields")
|
||||
):
|
||||
actions.append(
|
||||
_action(
|
||||
f"scheduling:anonymize:scheduling_participant:{record.resource_id}",
|
||||
"anonymize",
|
||||
record,
|
||||
"Anonymize unengaged Scheduling participant",
|
||||
"A participant without invitation, response, self-enrollment, notification, or terminal decision evidence can be removed without changing Poll or Calendar state.",
|
||||
executable=True,
|
||||
irreversible=True,
|
||||
metadata={"tenant_id": tenant_id},
|
||||
)
|
||||
)
|
||||
action_ids = [action.action_id for action in actions]
|
||||
if len(action_ids) != len(set(action_ids)):
|
||||
raise ValueError("Scheduling DSAR produced duplicate action ids.")
|
||||
return tuple(actions)
|
||||
|
||||
def execute_erasure(
|
||||
self,
|
||||
session: object,
|
||||
*,
|
||||
tenant_id: str,
|
||||
subject: DsarSubjectRef,
|
||||
actions: Sequence[DsarErasureActionRef],
|
||||
request_id: str,
|
||||
) -> Sequence[DsarExecutionResultRef]:
|
||||
db = _session(session)
|
||||
results: list[DsarExecutionResultRef] = []
|
||||
for action in actions:
|
||||
if (
|
||||
action.provider_id != self.provider_id
|
||||
or action.module_id != self.module_id
|
||||
or action.metadata.get("tenant_id") != tenant_id
|
||||
or not action.action_id.startswith(
|
||||
"scheduling:anonymize:scheduling_participant:"
|
||||
)
|
||||
):
|
||||
results.append(
|
||||
_blocked(action, "The Scheduling DSAR action is stale or invalid.")
|
||||
)
|
||||
continue
|
||||
results.append(
|
||||
_anonymize_unengaged_participant(
|
||||
db,
|
||||
tenant_id=tenant_id,
|
||||
subject=subject,
|
||||
action=action,
|
||||
request_id=request_id,
|
||||
)
|
||||
)
|
||||
db.flush()
|
||||
return tuple(results)
|
||||
|
||||
|
||||
def _matching_participants(
|
||||
session: Session,
|
||||
*,
|
||||
tenant_id: str,
|
||||
participant_id: str | None,
|
||||
respondent_ids: set[str],
|
||||
account_ids: set[str],
|
||||
email: str | None,
|
||||
) -> list[SchedulingParticipant]:
|
||||
conditions = []
|
||||
if participant_id:
|
||||
conditions.append(SchedulingParticipant.id == participant_id)
|
||||
if respondent_ids:
|
||||
conditions.append(SchedulingParticipant.respondent_id.in_(respondent_ids))
|
||||
if account_ids:
|
||||
conditions.append(SchedulingParticipant.bound_account_id.in_(account_ids))
|
||||
if email:
|
||||
conditions.append(func.lower(SchedulingParticipant.email) == email)
|
||||
if not conditions:
|
||||
return []
|
||||
candidates = _bounded_rows(
|
||||
session.query(SchedulingParticipant)
|
||||
.filter(SchedulingParticipant.tenant_id == tenant_id, or_(*conditions))
|
||||
.order_by(SchedulingParticipant.id)
|
||||
)
|
||||
return [
|
||||
row
|
||||
for row in candidates
|
||||
if _participant_matching_fields(
|
||||
row,
|
||||
participant_id=participant_id,
|
||||
respondent_ids=respondent_ids,
|
||||
account_ids=account_ids,
|
||||
email=email,
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
def _matching_requests(
|
||||
session: Session,
|
||||
*,
|
||||
tenant_id: str,
|
||||
request_ids: set[str],
|
||||
organizer_ids: set[str],
|
||||
) -> list[SchedulingRequest]:
|
||||
conditions = []
|
||||
if request_ids:
|
||||
conditions.append(SchedulingRequest.id.in_(request_ids))
|
||||
if organizer_ids:
|
||||
conditions.append(SchedulingRequest.organizer_user_id.in_(organizer_ids))
|
||||
if not conditions:
|
||||
return []
|
||||
return _bounded_rows(
|
||||
session.query(SchedulingRequest)
|
||||
.filter(SchedulingRequest.tenant_id == tenant_id, or_(*conditions))
|
||||
.order_by(SchedulingRequest.id)
|
||||
)
|
||||
|
||||
|
||||
def _candidate_slots(
|
||||
session: Session,
|
||||
*,
|
||||
tenant_id: str,
|
||||
request_ids: set[str],
|
||||
) -> list[SchedulingCandidateSlot]:
|
||||
if not request_ids:
|
||||
return []
|
||||
return _bounded_rows(
|
||||
session.query(SchedulingCandidateSlot)
|
||||
.filter(
|
||||
SchedulingCandidateSlot.tenant_id == tenant_id,
|
||||
SchedulingCandidateSlot.request_id.in_(request_ids),
|
||||
)
|
||||
.order_by(SchedulingCandidateSlot.request_id, SchedulingCandidateSlot.position)
|
||||
)
|
||||
|
||||
|
||||
def _matching_notifications(
|
||||
session: Session,
|
||||
*,
|
||||
tenant_id: str,
|
||||
request_ids: set[str],
|
||||
participant_ids: set[str],
|
||||
respondent_ids: set[str],
|
||||
email: str | None,
|
||||
) -> list[SchedulingNotification]:
|
||||
if not request_ids:
|
||||
return []
|
||||
conditions = []
|
||||
if participant_ids:
|
||||
conditions.append(SchedulingNotification.participant_id.in_(participant_ids))
|
||||
if respondent_ids:
|
||||
conditions.append(SchedulingNotification.recipient.in_(respondent_ids))
|
||||
if email:
|
||||
conditions.append(func.lower(SchedulingNotification.recipient) == email)
|
||||
if not conditions:
|
||||
return []
|
||||
candidates = _bounded_rows(
|
||||
session.query(SchedulingNotification)
|
||||
.filter(
|
||||
SchedulingNotification.tenant_id == tenant_id,
|
||||
SchedulingNotification.request_id.in_(request_ids),
|
||||
or_(*conditions),
|
||||
)
|
||||
.order_by(SchedulingNotification.id)
|
||||
)
|
||||
return [
|
||||
row
|
||||
for row in candidates
|
||||
if _notification_matching_fields(
|
||||
row,
|
||||
participant_ids=participant_ids,
|
||||
respondent_ids=respondent_ids,
|
||||
email=email,
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
def _participant_matching_fields(
|
||||
row: SchedulingParticipant,
|
||||
*,
|
||||
participant_id: str | None,
|
||||
respondent_ids: set[str],
|
||||
account_ids: set[str],
|
||||
email: str | None,
|
||||
) -> list[str]:
|
||||
fields = []
|
||||
if participant_id and row.id == participant_id:
|
||||
fields.append("id")
|
||||
if row.respondent_id and row.respondent_id in respondent_ids:
|
||||
fields.append("respondent_id")
|
||||
if row.bound_account_id and row.bound_account_id in account_ids:
|
||||
fields.append("bound_account_id")
|
||||
if email and _normalized_email(row.email) == email:
|
||||
fields.append("email")
|
||||
return fields
|
||||
|
||||
|
||||
def _notification_matching_fields(
|
||||
row: SchedulingNotification,
|
||||
*,
|
||||
participant_ids: set[str],
|
||||
respondent_ids: set[str],
|
||||
email: str | None,
|
||||
) -> list[str]:
|
||||
fields = []
|
||||
if row.participant_id and row.participant_id in participant_ids:
|
||||
fields.append("participant_id")
|
||||
recipient = str(row.recipient or "").strip()
|
||||
if recipient in respondent_ids:
|
||||
fields.append("recipient")
|
||||
if email and _normalized_email(recipient) == email:
|
||||
fields.append("recipient")
|
||||
return list(dict.fromkeys(fields))
|
||||
|
||||
|
||||
def _matching_recipient(
|
||||
value: object,
|
||||
*,
|
||||
respondent_ids: set[str],
|
||||
email: str | None,
|
||||
) -> str | None:
|
||||
candidate = str(value or "").strip()
|
||||
if candidate in respondent_ids:
|
||||
return candidate
|
||||
if email and _normalized_email(candidate) == email:
|
||||
return email
|
||||
return None
|
||||
|
||||
|
||||
def _request_is_evidence(row: SchedulingRequest) -> bool:
|
||||
return bool(
|
||||
row.status in _TERMINAL_REQUEST_STATUSES
|
||||
or row.handed_off_at
|
||||
or row.cancelled_at
|
||||
or row.deleted_at
|
||||
)
|
||||
|
||||
|
||||
def _participant_is_evidence(
|
||||
row: SchedulingParticipant,
|
||||
notifications: Sequence[SchedulingNotification],
|
||||
) -> bool:
|
||||
return bool(
|
||||
row.poll_invitation_id
|
||||
or row.responded_at
|
||||
or row.response_comment
|
||||
or row.self_enrollment_link_id
|
||||
or row.self_enrollment_proof_hash
|
||||
or row.status in {"responded", "removed"}
|
||||
or notifications
|
||||
)
|
||||
|
||||
|
||||
def _participant_is_unengaged(
|
||||
row: SchedulingParticipant,
|
||||
notifications: Sequence[SchedulingNotification],
|
||||
) -> bool:
|
||||
return bool(
|
||||
row.deleted_at is None
|
||||
and row.status in {"draft", "invited"}
|
||||
and row.poll_invitation_id is None
|
||||
and row.responded_at is None
|
||||
and not row.response_comment
|
||||
and row.self_enrollment_link_id is None
|
||||
and row.self_enrollment_proof_hash is None
|
||||
and not notifications
|
||||
)
|
||||
|
||||
|
||||
def _anonymize_unengaged_participant(
|
||||
session: Session,
|
||||
*,
|
||||
tenant_id: str,
|
||||
subject: DsarSubjectRef,
|
||||
action: DsarErasureActionRef,
|
||||
request_id: str,
|
||||
) -> DsarExecutionResultRef:
|
||||
row = (
|
||||
session.query(SchedulingParticipant)
|
||||
.filter(
|
||||
SchedulingParticipant.id == action.resource_id,
|
||||
SchedulingParticipant.tenant_id == tenant_id,
|
||||
)
|
||||
.with_for_update()
|
||||
.one_or_none()
|
||||
)
|
||||
if row is None:
|
||||
return _result(
|
||||
action,
|
||||
"unchanged",
|
||||
"The Scheduling participant was already absent.",
|
||||
{"request_id": request_id},
|
||||
)
|
||||
if _participant_is_anonymized(row):
|
||||
return _result(
|
||||
action,
|
||||
"unchanged",
|
||||
"The Scheduling participant was already anonymized.",
|
||||
{"request_id": request_id},
|
||||
)
|
||||
if not _participant_matches_subject(row, subject):
|
||||
return _blocked(
|
||||
action, "The Scheduling participant identity changed after planning."
|
||||
)
|
||||
request = (
|
||||
session.query(SchedulingRequest)
|
||||
.filter(
|
||||
SchedulingRequest.id == row.request_id,
|
||||
SchedulingRequest.tenant_id == tenant_id,
|
||||
)
|
||||
.with_for_update()
|
||||
.one_or_none()
|
||||
)
|
||||
if request is None or _request_is_evidence(request):
|
||||
return _blocked(
|
||||
action,
|
||||
"The Scheduling request is absent or became retained decision evidence.",
|
||||
)
|
||||
notifications = _participant_notifications(session, row)
|
||||
if not _participant_is_unengaged(row, notifications):
|
||||
return _blocked(
|
||||
action,
|
||||
"The participant gained invitation, response, enrollment, or notification evidence after planning.",
|
||||
)
|
||||
|
||||
now = datetime.now(timezone.utc)
|
||||
row.respondent_id = None
|
||||
row.display_name = None
|
||||
row.email = None
|
||||
row.status = "removed"
|
||||
row.poll_invitation_id = None
|
||||
row.participation_gateway = None
|
||||
row.self_enrollment_link_id = None
|
||||
row.self_enrollment_proof_hash = None
|
||||
row.bound_account_id = None
|
||||
row.account_bound_at = None
|
||||
row.last_invited_at = None
|
||||
row.responded_at = None
|
||||
row.response_comment = None
|
||||
row.deleted_at = now
|
||||
row.metadata_ = None
|
||||
return _result(
|
||||
action,
|
||||
"executed",
|
||||
"The unengaged Scheduling participant was anonymized and retired.",
|
||||
{"request_id": request_id},
|
||||
)
|
||||
|
||||
|
||||
def _participant_notifications(
|
||||
session: Session,
|
||||
row: SchedulingParticipant,
|
||||
) -> list[SchedulingNotification]:
|
||||
conditions = [SchedulingNotification.participant_id == row.id]
|
||||
email = _normalized_email(row.email)
|
||||
if email:
|
||||
conditions.append(func.lower(SchedulingNotification.recipient) == email)
|
||||
return _bounded_rows(
|
||||
session.query(SchedulingNotification)
|
||||
.filter(
|
||||
SchedulingNotification.tenant_id == row.tenant_id,
|
||||
SchedulingNotification.request_id == row.request_id,
|
||||
or_(*conditions),
|
||||
)
|
||||
.order_by(SchedulingNotification.id)
|
||||
)
|
||||
|
||||
|
||||
def _participant_matches_subject(
|
||||
row: SchedulingParticipant,
|
||||
subject: DsarSubjectRef,
|
||||
) -> bool:
|
||||
return bool(
|
||||
_participant_matching_fields(
|
||||
row,
|
||||
participant_id=_scheduling_references(subject).get("participant"),
|
||||
respondent_ids=_respondent_ids(subject),
|
||||
account_ids=_account_ids(subject),
|
||||
email=_subject_email(subject),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _participant_is_anonymized(row: SchedulingParticipant) -> bool:
|
||||
return bool(
|
||||
row.deleted_at is not None
|
||||
and row.status == "removed"
|
||||
and row.respondent_id is None
|
||||
and row.display_name is None
|
||||
and row.email is None
|
||||
and row.poll_invitation_id is None
|
||||
and row.self_enrollment_link_id is None
|
||||
and row.self_enrollment_proof_hash is None
|
||||
and row.bound_account_id is None
|
||||
and row.response_comment is None
|
||||
and row.metadata_ is None
|
||||
)
|
||||
|
||||
|
||||
def _scheduling_references(subject: DsarSubjectRef) -> dict[str, str]:
|
||||
aliases = {
|
||||
"scheduling.request": "request",
|
||||
"scheduling.request_id": "request",
|
||||
"scheduling.participant": "participant",
|
||||
"scheduling.participant_id": "participant",
|
||||
}
|
||||
references: dict[str, str] = {}
|
||||
for key, target in aliases.items():
|
||||
value = str(subject.external_references.get(key) or "").strip()
|
||||
if value and target not in references:
|
||||
references[target] = value
|
||||
return references
|
||||
|
||||
|
||||
def _membership_ids(subject: DsarSubjectRef) -> set[str]:
|
||||
values = [subject.membership_id]
|
||||
values.extend(
|
||||
subject.external_references.get(key)
|
||||
for key in (
|
||||
"scheduling.user",
|
||||
"scheduling.membership",
|
||||
"access.membership",
|
||||
"membership_id",
|
||||
)
|
||||
)
|
||||
return _identifiers(values)
|
||||
|
||||
|
||||
def _respondent_ids(subject: DsarSubjectRef) -> set[str]:
|
||||
values = [subject.membership_id, subject.identity_id, subject.account_id]
|
||||
values.extend(
|
||||
subject.external_references.get(key)
|
||||
for key in (
|
||||
"scheduling.respondent",
|
||||
"poll.respondent",
|
||||
"access.membership",
|
||||
"membership_id",
|
||||
"identity_id",
|
||||
"account_id",
|
||||
)
|
||||
)
|
||||
return _identifiers(values)
|
||||
|
||||
|
||||
def _account_ids(subject: DsarSubjectRef) -> set[str]:
|
||||
values = [subject.account_id]
|
||||
values.extend(
|
||||
subject.external_references.get(key)
|
||||
for key in ("scheduling.account", "access.account", "account_id")
|
||||
)
|
||||
return _identifiers(values)
|
||||
|
||||
|
||||
def _identifiers(values: Sequence[object]) -> set[str]:
|
||||
return {text for value in values if (text := str(value or "").strip())}
|
||||
|
||||
|
||||
def _subject_email(subject: DsarSubjectRef) -> str | None:
|
||||
candidates = [subject.email]
|
||||
candidates.extend(
|
||||
subject.external_references.get(key)
|
||||
for key in ("scheduling.email", "scheduling.participant_email")
|
||||
)
|
||||
normalized = {
|
||||
email for value in candidates if (email := _normalized_email(value)) is not None
|
||||
}
|
||||
return normalized.pop() if len(normalized) == 1 else None
|
||||
|
||||
|
||||
def _normalized_email(value: object) -> str | None:
|
||||
if not isinstance(value, str):
|
||||
return None
|
||||
normalized = value.strip().casefold()
|
||||
return normalized or None
|
||||
|
||||
|
||||
def _bounded_text(value: str | None) -> str | None:
|
||||
return value[:2_000] if value else None
|
||||
|
||||
|
||||
def _record(
|
||||
resource_type: str,
|
||||
resource_id: str,
|
||||
category: str,
|
||||
title: str,
|
||||
data: Mapping[str, object],
|
||||
*,
|
||||
observed_at: datetime | None = None,
|
||||
immutable: bool = False,
|
||||
retention_reason: str | None = None,
|
||||
source_path: str | None = None,
|
||||
) -> DsarRecordRef:
|
||||
return DsarRecordRef(
|
||||
provider_id="scheduling",
|
||||
module_id="scheduling",
|
||||
resource_type=resource_type,
|
||||
resource_id=resource_id,
|
||||
category=category,
|
||||
title=title,
|
||||
data=data,
|
||||
observed_at=observed_at,
|
||||
immutable_evidence=immutable,
|
||||
retention_reason=retention_reason,
|
||||
source_path=source_path,
|
||||
)
|
||||
|
||||
|
||||
def _action(
|
||||
action_id: str,
|
||||
kind: str,
|
||||
record: DsarRecordRef,
|
||||
title: str,
|
||||
rationale: str,
|
||||
*,
|
||||
executable: bool,
|
||||
irreversible: bool = False,
|
||||
metadata: Mapping[str, object] | None = None,
|
||||
) -> DsarErasureActionRef:
|
||||
return DsarErasureActionRef(
|
||||
action_id=action_id,
|
||||
provider_id="scheduling",
|
||||
module_id="scheduling",
|
||||
kind=kind, # type: ignore[arg-type]
|
||||
resource_type=record.resource_type,
|
||||
resource_id=record.resource_id,
|
||||
title=title,
|
||||
rationale=rationale,
|
||||
executable=executable,
|
||||
irreversible=irreversible,
|
||||
metadata=metadata or {},
|
||||
)
|
||||
|
||||
|
||||
def _result(
|
||||
action: DsarErasureActionRef,
|
||||
status: str,
|
||||
summary: str,
|
||||
evidence: Mapping[str, object] | None = None,
|
||||
) -> DsarExecutionResultRef:
|
||||
return DsarExecutionResultRef(
|
||||
action_id=action.action_id,
|
||||
status=status, # type: ignore[arg-type]
|
||||
summary=summary,
|
||||
evidence=evidence or {},
|
||||
)
|
||||
|
||||
|
||||
def _blocked(action: DsarErasureActionRef, summary: str) -> DsarExecutionResultRef:
|
||||
return _result(action, "blocked", summary)
|
||||
|
||||
|
||||
def _session(value: object) -> Session:
|
||||
if not isinstance(value, Session):
|
||||
raise TypeError("Scheduling DSAR provider requires a SQLAlchemy session.")
|
||||
return value
|
||||
|
||||
|
||||
def _bounded_rows(query: object) -> list[object]:
|
||||
rows = query.limit(_MAX_RECORDS + 1).all() # type: ignore[attr-defined]
|
||||
if len(rows) > _MAX_RECORDS:
|
||||
raise ValueError(
|
||||
"Scheduling DSAR match limit exceeded; narrow the subject selectors."
|
||||
)
|
||||
return rows
|
||||
|
||||
|
||||
def _iso(value: datetime | None) -> str | None:
|
||||
if value is None:
|
||||
return None
|
||||
if value.tzinfo is None:
|
||||
value = value.replace(tzinfo=timezone.utc)
|
||||
return value.isoformat()
|
||||
|
||||
|
||||
__all__ = ["SCHEDULING_DSAR_CAPABILITY", "SchedulingDsarProvider"]
|
||||
@@ -0,0 +1,66 @@
|
||||
"""German translations for public structured documentation metadata."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
GERMAN_STRUCTURED_TRANSLATIONS: dict[str, dict[str, Any]] = {'scheduling.find-and-decide-meeting-time': {'outcome': 'Eine aufgezeichnete '
|
||||
'Terminplanungsentscheidung mit begrenzter '
|
||||
'Teilnahme und optionaler '
|
||||
'Kalenderübergabe.',
|
||||
'steps': ['Bereiten Sie Kandidatenzeiten und '
|
||||
'Teilnahmekontrollen vor.',
|
||||
'Erfassen und Überprüfen der Verfügbarkeit.',
|
||||
'Schließen Sie die Umfrage und bestätigen '
|
||||
'Sie die gewählte Zeit.',
|
||||
'Geben Sie die Entscheidung an den '
|
||||
'Kalender, wenn er konfiguriert ist.'],
|
||||
'verification': 'Das Anforderungsdetail zeigt den '
|
||||
'entschiedenen Slot, den '
|
||||
'Lebenszykluszustand, das '
|
||||
'Teilnehmeraggregat und jede '
|
||||
'Kalenderereignisreferenz.'},
|
||||
'scheduling.privacy.data-subject-requests': {'limitations': ['Umfragen und Einladungsbeweise '
|
||||
'werden nicht in den Export von '
|
||||
'Scheduling kopiert.',
|
||||
'Die Löschung der Teilnehmer bleibt '
|
||||
'manuell, wenn gemeinsame Antworten, '
|
||||
'Lieferung, Selbsteinschreibung, '
|
||||
'Kalendereffekte oder '
|
||||
'Terminalentscheidungen vorliegen.'],
|
||||
'prerequisites': ['Die Datenschutzanfrage und die '
|
||||
'Planungsauswahl wurden unabhängig '
|
||||
'autorisiert und bestätigt.',
|
||||
'Der Rezensent kann sich mit Poll- '
|
||||
'und Kalenderbesitzern abstimmen, '
|
||||
'wenn eine Antwort oder ein '
|
||||
'Ereignis involviert ist.'],
|
||||
'steps': ['Führen Sie die Scheduling-Provider-Such- '
|
||||
'und Überprüfungsdispositionen für '
|
||||
'Teilnehmer, Anfrage, Slot und '
|
||||
'Benachrichtigung aus.',
|
||||
'Führen Sie den Umfrageanbieter für '
|
||||
'tatsächliche Verfügbarkeitsoptionen und '
|
||||
'den Kalenderanbieter für Ereignis oder '
|
||||
'Haltezustand aus.',
|
||||
'Bewahren Sie die Entscheidung und den '
|
||||
'Liefernachweis mit dem Grund auf.',
|
||||
'Anonymisierung nur für einen zugelassenen '
|
||||
'Teilnehmer durchführen, der nach der '
|
||||
'Revalidierung als nicht engagiert '
|
||||
'eingestuft wurde.']},
|
||||
'scheduling.public-self-enrollment': {'steps': ['Wählen Sie eine begrenzte Kapazität, Ablauf und '
|
||||
'erlaubte Identitätsmodi.',
|
||||
'Kopieren Sie den neu ausgestellten Link; der '
|
||||
'Rohnachweis wird nur einmal angezeigt.',
|
||||
'Überwachen Sie die Anzahl der Registrierungen '
|
||||
'und widerrufen Sie den Link, wenn er nicht mehr '
|
||||
'benötigt wird.',
|
||||
'Erfordern Sie einen Wiederherstellungsnachweis, '
|
||||
'bevor Sie eine anonyme Antwort aktualisieren '
|
||||
'oder binden.'],
|
||||
'verification': 'Die Linkliste zeigt Status, Ablauf, '
|
||||
'Kapazitätsnutzung, Zugriffsmodi und '
|
||||
'Widerruf an, ohne die Anmeldeinformationen '
|
||||
'erneut anzuzeigen.'}}
|
||||
@@ -0,0 +1,826 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from govoplan_core.core.modules import with_documentation_structured_translations
|
||||
from govoplan_scheduling.backend.german_structured_documentation import GERMAN_STRUCTURED_TRANSLATIONS
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from govoplan_core.core.access import (
|
||||
CAPABILITY_AUTH_PERMISSION_EVALUATOR,
|
||||
CAPABILITY_AUTH_PRINCIPAL_RESOLVER,
|
||||
)
|
||||
from govoplan_core.core.calendar import CAPABILITY_CALENDAR_SCHEDULING
|
||||
from govoplan_core.core.module_guards import (
|
||||
drop_table_retirement_provider,
|
||||
persistent_table_uninstall_guard,
|
||||
)
|
||||
from govoplan_core.core.modules import (
|
||||
CapabilityDocumentation,
|
||||
DocumentationTopic,
|
||||
DocumentationCondition,
|
||||
DocumentationLink,
|
||||
FrontendModule,
|
||||
FrontendRoute,
|
||||
MigrationSpec,
|
||||
ModuleContext,
|
||||
ModuleInterfaceProvider,
|
||||
ModuleInterfaceRequirement,
|
||||
ModuleManifest,
|
||||
NavItem,
|
||||
PermissionDefinition,
|
||||
ProductAreaContribution,
|
||||
PublicFrontendRoute,
|
||||
RoleTemplate,
|
||||
)
|
||||
from govoplan_core.core.provider_governance import declared_module_architecture
|
||||
from govoplan_core.core.people import (
|
||||
CAPABILITY_ACCESS_PEOPLE_SEARCH,
|
||||
CAPABILITY_ADDRESSES_PEOPLE_SEARCH,
|
||||
)
|
||||
from govoplan_core.core.poll import CAPABILITY_POLL_SCHEDULING, PollCapabilityError
|
||||
from govoplan_core.core.poll_participation import (
|
||||
CAPABILITY_POLL_PARTICIPATION_GATEWAY,
|
||||
PollResponseGatewayRef,
|
||||
poll_participation_gateway_provider,
|
||||
)
|
||||
from govoplan_core.core.policy import CAPABILITY_POLICY_SCHEDULING_PARTICIPANT_PRIVACY
|
||||
from govoplan_core.core.views import ViewSurface
|
||||
from govoplan_core.db.base import Base
|
||||
from govoplan_scheduling.backend.db import models as scheduling_models # noqa: F401 - populate Scheduling ORM metadata
|
||||
from govoplan_scheduling.backend.dsar_provider import SCHEDULING_DSAR_CAPABILITY
|
||||
|
||||
MODULE_ID = "scheduling"
|
||||
MODULE_NAME = "Scheduling"
|
||||
MODULE_VERSION = "0.1.22"
|
||||
READ_SCOPE = "scheduling:schedule:read"
|
||||
WRITE_SCOPE = "scheduling:schedule:write"
|
||||
ADMIN_SCOPE = "scheduling:schedule:admin"
|
||||
RESPOND_SCOPE = "scheduling:availability:write"
|
||||
|
||||
|
||||
def _permission(scope: str, label: str, description: str) -> PermissionDefinition:
|
||||
module_id, resource, action = scope.split(":", 2)
|
||||
return PermissionDefinition(
|
||||
scope=scope,
|
||||
label=label,
|
||||
description=description,
|
||||
category="Scheduling",
|
||||
level="tenant",
|
||||
module_id=module_id,
|
||||
resource=resource,
|
||||
action=action,
|
||||
)
|
||||
|
||||
|
||||
PERMISSIONS = (
|
||||
_permission(
|
||||
READ_SCOPE,
|
||||
"View scheduling",
|
||||
"Read scheduling polls, proposals, participant state, and selected outcomes.",
|
||||
),
|
||||
_permission(
|
||||
WRITE_SCOPE,
|
||||
"Manage own scheduling",
|
||||
"Create scheduling polls and manage requests for which the account is the organizer.",
|
||||
),
|
||||
_permission(
|
||||
ADMIN_SCOPE,
|
||||
"Administer scheduling",
|
||||
"Manage every tenant scheduling request and configure scheduling policies, external participation, and retention defaults.",
|
||||
),
|
||||
_permission(
|
||||
RESPOND_SCOPE,
|
||||
"Respond to scheduling polls",
|
||||
"Submit and update own scheduling availability responses.",
|
||||
),
|
||||
)
|
||||
|
||||
ROLE_TEMPLATES = (
|
||||
RoleTemplate(
|
||||
slug="scheduling_manager",
|
||||
name="Scheduling manager",
|
||||
description="Create scheduling polls and manage candidate slots and outcomes for requests the account organizes.",
|
||||
permissions=(READ_SCOPE, WRITE_SCOPE, RESPOND_SCOPE),
|
||||
),
|
||||
RoleTemplate(
|
||||
slug="scheduling_participant",
|
||||
name="Scheduling participant",
|
||||
description="Read assigned scheduling polls and submit own availability.",
|
||||
permissions=(READ_SCOPE, RESPOND_SCOPE),
|
||||
),
|
||||
)
|
||||
|
||||
DOCUMENTATION = (
|
||||
DocumentationTopic(
|
||||
id="scheduling.workspace-layout",
|
||||
title="Scheduling workspace layout",
|
||||
summary="Find workspace actions and read consistently arranged content.",
|
||||
body="The workspace always keeps Reload and New scheduling request at the upper right, including empty, detail, and editor states. Reload sits immediately before New. Creation remains visible but disabled while saving or without creation/write permission; it never disappears inside the request-list card. An open editor keeps its own Save and Discard actions and the unsaved-change guard applies before switching requests. Administrators grant existing Scheduling permissions; this layout adds no permission or automatic invitation or Calendar action.",
|
||||
layer="static",
|
||||
documentation_types=("user", "admin"),
|
||||
audience=("user", "module_admin", "operator"),
|
||||
order=5,
|
||||
translations={"de": {
|
||||
"title": "Terminfindung: Aufbau des Arbeitsbereichs",
|
||||
"summary": "Arbeitsbereichsaktionen finden und einheitlich angeordnete Inhalte lesen.",
|
||||
"body": "Der Arbeitsbereich zeigt Neu laden und Neue Terminanfrage immer oben rechts, auch in leerem Zustand, Detailansicht und Bearbeitung. Neu laden steht unmittelbar vor Neu. Das Anlegen bleibt beim Speichern oder ohne Schreibrecht sichtbar, aber deaktiviert; es verschwindet nicht innerhalb der Anfragekartenleiste. Ein geöffneter Editor behält Speichern und Verwerfen; beim Wechsel schützt die Rückfrage ungespeicherte Änderungen. Administratoren vergeben bestehende Scheduling-Rechte; dieses Layout fügt weder Rechte noch automatische Einladungen oder Kalenderaktionen hinzu.",
|
||||
}},
|
||||
),
|
||||
DocumentationTopic(
|
||||
id="scheduling.module-boundary",
|
||||
title="Scheduling module boundary",
|
||||
summary="Meeting scheduling and Terminfindung built on reusable Poll availability primitives.",
|
||||
body=(
|
||||
"Scheduling owns meeting scheduling workflows, candidate slots, participant availability "
|
||||
"collection, conflict explanation, reminders, and decision handoff. It depends on Poll "
|
||||
"for reusable availability matrices and poll-backed workflow context, and can optionally "
|
||||
"trigger Evaluation for post-event feedback. "
|
||||
"Access is optional: when installed, Scheduling can use principal resolution, permission "
|
||||
"evaluation, groups, and role templates; without it, reduced signed-link or local organizer "
|
||||
"flows remain possible."
|
||||
),
|
||||
layer="available",
|
||||
documentation_types=("admin", "user"),
|
||||
audience=("user", "operator", "module_admin", "product_owner"),
|
||||
related_modules=(
|
||||
"poll",
|
||||
"evaluation",
|
||||
"calendar",
|
||||
"appointments",
|
||||
"mail",
|
||||
"notifications",
|
||||
"portal",
|
||||
),
|
||||
translations={
|
||||
"de": {
|
||||
"title": "Modulgrenze von Scheduling",
|
||||
"summary": "Terminplanung und Terminfindung auf Grundlage wiederverwendbarer Verfügbarkeitsbausteine von Poll.",
|
||||
"body": (
|
||||
"Scheduling besitzt Abläufe zur Terminfindung, Terminkandidaten, Erfassung der Teilnehmendenverfügbarkeit, "
|
||||
"Konflikterklärung, Erinnerungen und Entscheidungsübergabe. Für wiederverwendbare Verfügbarkeitsmatrizen und den "
|
||||
"pollgestützten Workflow-Kontext verwendet es Poll und kann optional Evaluation für Rückmeldungen nach einem Termin "
|
||||
"auslösen. Access ist optional: Ist es installiert, kann Scheduling Hauptpersonenauflösung, Berechtigungsprüfung, Gruppen "
|
||||
"und Rollenvorlagen verwenden; ohne Access bleiben eingeschränkte Abläufe über signierte Links oder lokale Organisation möglich."
|
||||
),
|
||||
}
|
||||
},
|
||||
metadata={"seed": True},
|
||||
),
|
||||
DocumentationTopic(
|
||||
id="scheduling.privacy.data-subject-requests",
|
||||
title="Review Scheduling data in a data-subject request",
|
||||
summary="Collect tenant-scoped participation and coordination metadata while leaving Poll responses and Calendar effects with their owners.",
|
||||
body=(
|
||||
"Scheduling's DSAR provider searches the effective tenant by normalized participant email, membership, identity or bound-account references, and namespaced Scheduling request or participant references. "
|
||||
"It isolates the matching participant, request and candidate-slot context, and matching notification envelopes. It does not export Poll or invitation identifiers, participation-gateway state, reusable enrollment links or proof hashes, anonymous-password hashes, Calendar event or hold identifiers, free/busy conflict detail, notification payloads or errors, token material, opaque metadata, or unrelated participants. Poll remains authoritative for actual availability choices and response-retirement evidence; Calendar remains authoritative for event, hold, and synchronization state. "
|
||||
"Decided, handed-off, cancelled, archived, responded, notified, or removed state is retained with a reason. Active shared scheduling content requires coordinated manual review. The provider can anonymize and retire only a participant who has no invitation, response, enrollment, notification, or terminal decision evidence, and revalidates all of those conditions under tenant-bound row locks before acting."
|
||||
),
|
||||
layer="configured",
|
||||
documentation_types=("admin",),
|
||||
audience=(
|
||||
"privacy_officer",
|
||||
"scheduling_manager",
|
||||
"records_manager",
|
||||
"operator",
|
||||
),
|
||||
order=5,
|
||||
conditions=(
|
||||
DocumentationCondition(
|
||||
required_modules=("scheduling", "access"),
|
||||
any_scopes=(
|
||||
"access:privacy:read",
|
||||
"access:privacy:manage",
|
||||
"access:privacy:erase",
|
||||
),
|
||||
),
|
||||
),
|
||||
links=(
|
||||
DocumentationLink(
|
||||
label="Data-subject requests",
|
||||
href="/admin?section=tenant-data-subject-requests",
|
||||
kind="runtime",
|
||||
),
|
||||
DocumentationLink(
|
||||
label="Scheduling module guide",
|
||||
href="govoplan-scheduling/README.md",
|
||||
kind="repository",
|
||||
),
|
||||
),
|
||||
related_modules=("access", "audit", "poll", "calendar", "notifications"),
|
||||
translations={
|
||||
"de": {
|
||||
"title": "Scheduling-Daten in einer Betroffenenanfrage prüfen",
|
||||
"summary": (
|
||||
"Mandantenbezogene Teilnahme- und Koordinationsmetadaten erfassen, während Poll-Antworten und Calendar-Wirkungen "
|
||||
"bei ihren zuständigen Modulen verbleiben."
|
||||
),
|
||||
"body": (
|
||||
"Der DSAR-Provider von Scheduling durchsucht den wirksamen Mandanten anhand normalisierter E-Mail-Adressen der "
|
||||
"Teilnehmenden, Mitgliedschafts-, Identitäts- oder gebundener Kontoverweise sowie namensraumgebundener Scheduling-Anfrage- "
|
||||
"oder Teilnehmendenverweise. Er isoliert die passende Person, ihren Anfrage- und Terminkandidatenkontext sowie passende "
|
||||
"Benachrichtigungshüllen. Nicht exportiert werden Poll- oder Einladungskennungen, Zustände des Teilnahme-Gateways, "
|
||||
"wiederverwendbare Einschreibelinks oder Nachweishashes, Hashes anonymer Passwörter, Calendar-Ereignis- oder Haltekennungen, "
|
||||
"Details zu Frei-/Belegt-Konflikten, Benachrichtigungsnutzdaten oder -fehler, Tokenmaterial, undurchsichtige Metadaten oder "
|
||||
"andere Teilnehmende. Poll bleibt maßgeblich für tatsächliche Verfügbarkeitsangaben und Nachweise zur Beendigung von Antworten; "
|
||||
"Calendar bleibt maßgeblich für Ereignisse, Vormerkungen und Synchronisationszustände. Entschiedene, übergebene, abgesagte, "
|
||||
"archivierte, beantwortete, benachrichtigte oder entfernte Zustände werden mit Begründung aufbewahrt. Aktive gemeinsame "
|
||||
"Terminplanungsinhalte erfordern eine koordinierte manuelle Prüfung. Der Provider darf nur Personen anonymisieren und "
|
||||
"ausmustern, zu denen keine Einladung, Antwort, Einschreibung, Benachrichtigung oder abschließende Entscheidung vorliegt, "
|
||||
"und prüft alle Bedingungen unter mandantengebundenen Zeilensperren erneut."
|
||||
),
|
||||
}
|
||||
},
|
||||
metadata={
|
||||
"kind": "workflow",
|
||||
"route": "/admin?section=tenant-data-subject-requests",
|
||||
"screen": "Data-subject requests",
|
||||
"help_contexts": ["admin.privacy.data-subject-requests"],
|
||||
"prerequisites": [
|
||||
"The privacy request and Scheduling selectors have been independently authorized and corroborated.",
|
||||
"The reviewer can coordinate with Poll and Calendar owners when a response or event is involved.",
|
||||
],
|
||||
"steps": [
|
||||
"Run the Scheduling provider search and review participant, request, slot, and notification dispositions.",
|
||||
"Run the Poll provider for actual availability choices and the Calendar provider for event or hold state.",
|
||||
"Retain terminal decision and delivery evidence with its reason.",
|
||||
"Execute anonymization only for an approved participant classified as unengaged after revalidation.",
|
||||
],
|
||||
"limitations": [
|
||||
"Poll choices and invitation evidence are not copied into Scheduling's export.",
|
||||
"Participant erasure remains manual whenever shared responses, delivery, self-enrollment, Calendar effects, or terminal decisions exist.",
|
||||
],
|
||||
},
|
||||
),
|
||||
DocumentationTopic(
|
||||
id="scheduling.find-and-decide-meeting-time",
|
||||
title="Find and decide a meeting time",
|
||||
summary="Create candidate slots, invite internal or external participants, compare availability, and turn the selected slot into a calendar event when Calendar is available.",
|
||||
body=(
|
||||
"Scheduling records participant requirements, quorum and weighting constraints, response deadlines, reminders, and yes/no/maybe availability through Poll. "
|
||||
"Calendar-aware organizers can inspect conflicts and create tentative holds before deciding. After a decision, Scheduling releases unused holds, creates or links the final event, and records notification handoff state. "
|
||||
"Signed external links expose only the bounded request information allowed by the request's participation and privacy policy. Their governed Poll invitation resolves the tenant before Scheduling runs, so tenant module policy can withdraw public participation without weakening token validation."
|
||||
),
|
||||
layer="configured",
|
||||
documentation_types=("user",),
|
||||
audience=("user", "organizer", "participant"),
|
||||
conditions=(
|
||||
DocumentationCondition(
|
||||
any_scopes=(READ_SCOPE, WRITE_SCOPE, ADMIN_SCOPE, RESPOND_SCOPE),
|
||||
),
|
||||
),
|
||||
related_modules=("poll", "calendar", "notifications", "mail"),
|
||||
translations={
|
||||
"de": {
|
||||
"title": "Termin finden und entscheiden",
|
||||
"summary": (
|
||||
"Terminkandidaten anlegen, interne oder externe Personen einladen, Verfügbarkeiten vergleichen und den gewählten Termin "
|
||||
"bei verfügbarem Calendar in ein Kalenderereignis überführen."
|
||||
),
|
||||
"body": (
|
||||
"Scheduling erfasst Anforderungen an Teilnehmende, Quorum- und Gewichtungsregeln, Antwortfristen, Erinnerungen und "
|
||||
"Ja-/Nein-/Vielleicht-Verfügbarkeiten über Poll. Organisierende mit Calendar-Anbindung können vor der Entscheidung Konflikte "
|
||||
"prüfen und vorläufige Vormerkungen anlegen. Nach der Entscheidung gibt Scheduling nicht verwendete Vormerkungen frei, "
|
||||
"legt das endgültige Ereignis an oder verknüpft es und zeichnet die Übergabe an Notifications auf. Signierte externe Links "
|
||||
"zeigen nur die begrenzten Anfrageinformationen, welche die Teilnahme- und Datenschutzrichtlinie der Anfrage erlaubt. Die "
|
||||
"gesteuerte Poll-Einladung löst den Mandanten auf, bevor Scheduling ausgeführt wird. Dadurch kann die Mandanten-Modulrichtlinie "
|
||||
"die öffentliche Teilnahme zurückziehen, ohne die Tokenprüfung abzuschwächen."
|
||||
),
|
||||
}
|
||||
},
|
||||
metadata={
|
||||
"kind": "workflow",
|
||||
"route": "/scheduling",
|
||||
"screen": "Scheduling",
|
||||
"help_contexts": [
|
||||
"scheduling.list",
|
||||
"scheduling.request",
|
||||
"scheduling.editor",
|
||||
"scheduling.public-participation",
|
||||
],
|
||||
"steps": [
|
||||
"Prepare candidate times and participation controls.",
|
||||
"Collect and review availability.",
|
||||
"Close the poll and confirm the selected time.",
|
||||
"Hand the decision to Calendar when configured.",
|
||||
],
|
||||
"outcome": "A recorded scheduling decision with bounded participation and optional Calendar handoff.",
|
||||
"verification": "The request detail shows the decided slot, lifecycle state, participant aggregate, and any Calendar event reference.",
|
||||
},
|
||||
),
|
||||
DocumentationTopic(
|
||||
id="scheduling.calendar-coordination",
|
||||
title="Configure scheduling calendar coordination",
|
||||
summary="Understand the Calendar capability and permissions required for conflict checks, tentative holds, and final event handoff.",
|
||||
body=(
|
||||
"Calendar coordination remains optional. It is available only when Calendar contributes its picker capability and the actor can read calendars and availability and write events. "
|
||||
"A disabled Calendar control therefore names the missing integration or authority instead of silently accepting a configuration that cannot run. "
|
||||
"At decision time, a selected tentative hold is promoted in place while every unused hold is submitted to Calendar for durable release. Cancellation likewise waits until Calendar accepts every release. "
|
||||
"Partial or unavailable Calendar effects keep the Scheduling lifecycle incomplete and expose retry-required cleanup state; an exact retry reuses the recorded event and operation identities instead of duplicating effects. "
|
||||
"Administrators recover synchronized failures through Calendar's outbound-change reconciliation and then repeat the Scheduling action. Scheduling stores only operation identifiers, last-known state, and pending slot references; Calendar remains authoritative for event and outbox evidence. "
|
||||
"Administrators should enable the Calendar module and grant the bounded calendar, availability, and event permissions needed by the organizer; Scheduling never imports Calendar internals."
|
||||
),
|
||||
layer="configured",
|
||||
documentation_types=("admin", "user"),
|
||||
audience=("organizer", "module_admin", "tenant_admin"),
|
||||
related_modules=("calendar", "access", "policy"),
|
||||
translations={
|
||||
"de": {
|
||||
"title": "Calendar-Koordination für Scheduling konfigurieren",
|
||||
"summary": (
|
||||
"Die Calendar-Fähigkeit und Berechtigungen für Konfliktprüfungen, vorläufige Vormerkungen und die endgültige "
|
||||
"Ereignisübergabe verstehen."
|
||||
),
|
||||
"body": (
|
||||
"Die Calendar-Koordination bleibt optional. Sie ist nur verfügbar, wenn Calendar seine Auswahlfähigkeit bereitstellt und "
|
||||
"die handelnde Person Kalender und Verfügbarkeiten lesen sowie Ereignisse schreiben darf. Eine deaktivierte Calendar-Steuerung "
|
||||
"nennt daher die fehlende Integration oder Berechtigung, statt eine nicht ausführbare Konfiguration stillschweigend zu "
|
||||
"akzeptieren. Bei der Entscheidung wird eine ausgewählte vorläufige Vormerkung direkt bestätigt und jede ungenutzte "
|
||||
"Vormerkung zur dauerhaften Freigabe an Calendar übergeben. Auch eine Absage wartet, bis Calendar jede Freigabe angenommen hat. "
|
||||
"Teilweise oder nicht verfügbare Calendar-Wirkungen halten den Scheduling-Lebenszyklus unvollständig und zeigen einen "
|
||||
"bereinigungsbedürftigen Wiederholungszustand; eine identische Wiederholung verwendet die aufgezeichneten Ereignis- und "
|
||||
"Vorgangskennungen wieder, statt Wirkungen zu duplizieren. Administrierende beheben synchronisierte Fehler über Calendars "
|
||||
"Abgleich ausgehender Änderungen und wiederholen anschließend die Scheduling-Aktion. Scheduling speichert nur "
|
||||
"Vorgangskennungen, zuletzt bekannten Zustand und Verweise auf ausstehende Termine; Calendar bleibt maßgeblich für Ereignis- "
|
||||
"und Outbox-Nachweise. Administrierende sollten Calendar aktivieren und der organisierenden Person die begrenzten Kalender-, "
|
||||
"Verfügbarkeits- und Ereignisberechtigungen gewähren; Scheduling importiert keine Calendar-Interna."
|
||||
),
|
||||
}
|
||||
},
|
||||
metadata={
|
||||
"kind": "reference",
|
||||
"help_contexts": [
|
||||
"scheduling.calendar-integration",
|
||||
"scheduling.calendar-coordination",
|
||||
],
|
||||
},
|
||||
),
|
||||
DocumentationTopic(
|
||||
id="scheduling.participation-governance",
|
||||
title="Govern public scheduling participation",
|
||||
summary="Resolve disabled guest invitations without weakening signed-link privacy or participation policy.",
|
||||
body=(
|
||||
"Public invitation links are issued only when the configured response, privacy, password, email, and update controls can be enforced by the public participation gateway. "
|
||||
"When enforcement is unavailable, signed-in participants may continue to respond through their assigned request, but the system does not issue a weaker guest link. "
|
||||
"A system or tenant administrator must restore the governed Poll/public-participation capability or keep the request limited to signed-in participation."
|
||||
),
|
||||
layer="configured",
|
||||
documentation_types=("admin",),
|
||||
audience=("operator", "module_admin", "tenant_admin"),
|
||||
related_modules=("poll", "policy", "access"),
|
||||
translations={
|
||||
"de": {
|
||||
"title": "Öffentliche Teilnahme an Terminplanungen steuern",
|
||||
"summary": (
|
||||
"Deaktivierte Gasteinladungen behandeln, ohne Datenschutz signierter Links oder Teilnahmerichtlinien abzuschwächen."
|
||||
),
|
||||
"body": (
|
||||
"Öffentliche Einladungslinks werden nur ausgestellt, wenn das Gateway für öffentliche Teilnahme die konfigurierten "
|
||||
"Antwort-, Datenschutz-, Passwort-, E-Mail- und Änderungsregeln durchsetzen kann. Ist diese Durchsetzung nicht verfügbar, "
|
||||
"dürfen angemeldete Teilnehmende weiterhin über ihre zugewiesene Anfrage antworten; das System stellt jedoch keinen "
|
||||
"schwächeren Gastlink aus. Eine System- oder Mandantenadministration muss die gesteuerte Poll-/Teilnahmefähigkeit "
|
||||
"wiederherstellen oder die Anfrage auf angemeldete Teilnahme beschränken."
|
||||
),
|
||||
}
|
||||
},
|
||||
metadata={
|
||||
"kind": "pattern",
|
||||
"help_contexts": [
|
||||
"scheduling.public-participation-blocker",
|
||||
"scheduling.public-participation",
|
||||
],
|
||||
},
|
||||
),
|
||||
DocumentationTopic(
|
||||
id="scheduling.public-self-enrollment",
|
||||
title="Use governed public self-enrollment links",
|
||||
summary="Issue reusable scheduling links with explicit capacity, expiry, identity, account-binding, and abuse controls.",
|
||||
body=(
|
||||
"A public self-enrollment link is distinct from a participant-specific invitation. "
|
||||
"Organizers must choose a capacity and future expiry, and can independently allow anonymous and signed-in enrollment. "
|
||||
"Every participant supplies a display name; email is required only when the request policy says so. Anonymous participants create and retain a separate recovery proof, which is submitted in the request body and is never embedded in the link, logs, analytics, or durable clear text. "
|
||||
"Signed-in participants must explicitly confirm account binding. A later signed-in submission may bind an anonymous enrollment only when its recovery proof is supplied; the binding is audited. "
|
||||
"Deployment policy can disable self-enrollment or cap its maximum capacity. Redis provides shared fixed-window throttling when configured, while development uses the bounded single-node fallback. Existing personalized invitation links are unchanged. "
|
||||
"Revoking or expiring the reusable link prevents new access immediately. Capacity is serialized with participant creation, retries are idempotent through the caller's idempotency key, and existing proof holders can update only while request policy permits updates. Other participants receive only the request's existing aggregate or governed roster projection."
|
||||
),
|
||||
layer="configured",
|
||||
documentation_types=("admin", "user"),
|
||||
audience=("organizer", "participant", "module_admin", "tenant_admin"),
|
||||
conditions=(
|
||||
DocumentationCondition(
|
||||
any_scopes=(WRITE_SCOPE, ADMIN_SCOPE, RESPOND_SCOPE),
|
||||
),
|
||||
),
|
||||
related_modules=("poll", "access", "policy"),
|
||||
translations={
|
||||
"de": {
|
||||
"title": "Gesteuerte öffentliche Selbsteinschreibelinks verwenden",
|
||||
"summary": (
|
||||
"Wiederverwendbare Terminplanungslinks mit ausdrücklicher Kapazität, Laufzeit, Identitäts-, Kontobindungs- und "
|
||||
"Missbrauchsschutzsteuerung ausstellen."
|
||||
),
|
||||
"body": (
|
||||
"Ein öffentlicher Selbsteinschreibelink unterscheidet sich von einer personenspezifischen Einladung. Organisierende müssen "
|
||||
"Kapazität und zukünftigen Ablauf festlegen und können anonyme sowie angemeldete Einschreibung unabhängig zulassen. Alle "
|
||||
"Teilnehmenden geben einen Anzeigenamen an; eine E-Mail-Adresse ist nur erforderlich, wenn die Anfragerichtlinie dies verlangt. "
|
||||
"Anonyme Teilnehmende erzeugen und verwahren einen getrennten Wiederherstellungsnachweis. Dieser wird im Anfragekörper "
|
||||
"übermittelt und niemals in Link, Protokollen, Analysen oder dauerhaftem Klartext abgelegt. Angemeldete Teilnehmende müssen "
|
||||
"die Kontobindung ausdrücklich bestätigen. Eine spätere angemeldete Einreichung darf eine anonyme Einschreibung nur mit "
|
||||
"deren Wiederherstellungsnachweis binden; die Bindung wird auditiert. Die Deployment-Richtlinie kann Selbsteinschreibung "
|
||||
"deaktivieren oder die maximale Kapazität begrenzen. Redis stellt bei Konfiguration eine gemeinsame Drosselung mit festem "
|
||||
"Zeitfenster bereit; in der Entwicklung gilt der begrenzte Einzelknoten-Rückfall. Vorhandene persönliche Einladungslinks "
|
||||
"bleiben unverändert. Widerruf oder Ablauf des wiederverwendbaren Links verhindert neuen Zugriff sofort. Die Kapazität wird "
|
||||
"gemeinsam mit dem Anlegen der Person serialisiert, Wiederholungen sind über den Idempotenzschlüssel idempotent und bestehende "
|
||||
"Nachweisinhaber dürfen nur ändern, solange die Anfragerichtlinie Änderungen erlaubt. Andere Teilnehmende erhalten nur die "
|
||||
"bereits vorhandene Aggregat- oder gesteuerte Teilnehmerlistenansicht der Anfrage."
|
||||
),
|
||||
}
|
||||
},
|
||||
metadata={
|
||||
"kind": "workflow",
|
||||
"route": "/scheduling",
|
||||
"help_contexts": [
|
||||
"scheduling.public-self-enrollment",
|
||||
"scheduling.public-self-enrollment-governance",
|
||||
],
|
||||
"steps": [
|
||||
"Choose a bounded capacity, expiry, and permitted identity modes.",
|
||||
"Copy the newly issued link; the raw credential is shown only once.",
|
||||
"Monitor enrollment count and revoke the link when it is no longer needed.",
|
||||
"Require recovery proof before updating or binding an anonymous response.",
|
||||
],
|
||||
"verification": "The link list shows status, expiry, capacity use, access modes, and revocation without redisplaying its credential.",
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _tenant_summary(session, tenant_id: str) -> dict[str, int]:
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingNotification,
|
||||
SchedulingParticipant,
|
||||
SchedulingPublicEnrollmentLink,
|
||||
SchedulingRequest,
|
||||
)
|
||||
|
||||
return {
|
||||
"scheduling_requests": (
|
||||
session.query(SchedulingRequest)
|
||||
.filter(
|
||||
SchedulingRequest.tenant_id == tenant_id,
|
||||
SchedulingRequest.deleted_at.is_(None),
|
||||
)
|
||||
.count()
|
||||
),
|
||||
"scheduling_candidate_slots": (
|
||||
session.query(SchedulingCandidateSlot)
|
||||
.filter(
|
||||
SchedulingCandidateSlot.tenant_id == tenant_id,
|
||||
SchedulingCandidateSlot.deleted_at.is_(None),
|
||||
)
|
||||
.count()
|
||||
),
|
||||
"scheduling_participants": (
|
||||
session.query(SchedulingParticipant)
|
||||
.filter(
|
||||
SchedulingParticipant.tenant_id == tenant_id,
|
||||
SchedulingParticipant.deleted_at.is_(None),
|
||||
)
|
||||
.count()
|
||||
),
|
||||
"scheduling_notifications": (
|
||||
session.query(SchedulingNotification)
|
||||
.filter(
|
||||
SchedulingNotification.tenant_id == tenant_id,
|
||||
SchedulingNotification.status == "pending",
|
||||
)
|
||||
.count()
|
||||
),
|
||||
"scheduling_public_enrollment_links": (
|
||||
session.query(SchedulingPublicEnrollmentLink)
|
||||
.filter(
|
||||
SchedulingPublicEnrollmentLink.tenant_id == tenant_id,
|
||||
SchedulingPublicEnrollmentLink.revoked_at.is_(None),
|
||||
)
|
||||
.count()
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def _scheduling_router(context: ModuleContext):
|
||||
from govoplan_scheduling.backend.runtime import configure_runtime
|
||||
from govoplan_scheduling.backend.router import router
|
||||
|
||||
configure_runtime(registry=context.registry, settings=context.settings)
|
||||
return router
|
||||
|
||||
|
||||
def _scheduling_dsar_provider(context: ModuleContext) -> object:
|
||||
del context
|
||||
from govoplan_scheduling.backend.dsar_provider import SchedulingDsarProvider
|
||||
|
||||
return SchedulingDsarProvider()
|
||||
|
||||
|
||||
def _public_tenant_resolver(request: object, session: object) -> str | None:
|
||||
path_params = getattr(request, "path_params", {})
|
||||
request_id = str(path_params.get("request_id") or "").strip()
|
||||
token = str(path_params.get("token") or "").strip()
|
||||
path = str(getattr(getattr(request, "url", None), "path", ""))
|
||||
if not request_id or not token:
|
||||
return None
|
||||
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingPublicEnrollmentLink,
|
||||
SchedulingRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.security import public_credential_hash
|
||||
from govoplan_core.db.base import utcnow
|
||||
|
||||
if "/scheduling/public-enrollment/" in path:
|
||||
link = (
|
||||
session.query(SchedulingPublicEnrollmentLink)
|
||||
.filter(
|
||||
SchedulingPublicEnrollmentLink.request_id == request_id,
|
||||
SchedulingPublicEnrollmentLink.token_hash
|
||||
== public_credential_hash(token),
|
||||
SchedulingPublicEnrollmentLink.revoked_at.is_(None),
|
||||
SchedulingPublicEnrollmentLink.expires_at > utcnow(),
|
||||
)
|
||||
.one_or_none()
|
||||
)
|
||||
return link.tenant_id if link is not None else None
|
||||
if "/scheduling/public/" not in path:
|
||||
return None
|
||||
|
||||
app = getattr(request, "app", None)
|
||||
registry = getattr(getattr(app, "state", None), "govoplan_registry", None)
|
||||
provider = poll_participation_gateway_provider(registry)
|
||||
if provider is None:
|
||||
return None
|
||||
gateway = PollResponseGatewayRef(
|
||||
module_id=MODULE_ID,
|
||||
resource_type="scheduling_request",
|
||||
resource_id=request_id,
|
||||
)
|
||||
try:
|
||||
invitation = provider.resolve_public_invitation(
|
||||
session,
|
||||
token=token,
|
||||
gateway=gateway,
|
||||
)
|
||||
except PollCapabilityError:
|
||||
return None
|
||||
scheduling_request = (
|
||||
session.query(SchedulingRequest)
|
||||
.filter(
|
||||
SchedulingRequest.id == request_id,
|
||||
SchedulingRequest.tenant_id == invitation.tenant_id,
|
||||
SchedulingRequest.poll_id == invitation.poll_id,
|
||||
SchedulingRequest.deleted_at.is_(None),
|
||||
)
|
||||
.one_or_none()
|
||||
)
|
||||
return scheduling_request.tenant_id if scheduling_request is not None else None
|
||||
|
||||
|
||||
manifest = ModuleManifest(
|
||||
id=MODULE_ID,
|
||||
name=MODULE_NAME,
|
||||
version=MODULE_VERSION,
|
||||
dependencies=("poll",),
|
||||
optional_dependencies=(
|
||||
"access",
|
||||
"calendar",
|
||||
"appointments",
|
||||
"evaluation",
|
||||
"mail",
|
||||
"notifications",
|
||||
"policy",
|
||||
"portal",
|
||||
"workflow_engine",
|
||||
"tasks",
|
||||
"idm",
|
||||
"organizations",
|
||||
"addresses",
|
||||
),
|
||||
optional_capabilities=(
|
||||
CAPABILITY_AUTH_PRINCIPAL_RESOLVER,
|
||||
CAPABILITY_AUTH_PERMISSION_EVALUATOR,
|
||||
CAPABILITY_CALENDAR_SCHEDULING,
|
||||
CAPABILITY_POLICY_SCHEDULING_PARTICIPANT_PRIVACY,
|
||||
CAPABILITY_ACCESS_PEOPLE_SEARCH,
|
||||
CAPABILITY_ADDRESSES_PEOPLE_SEARCH,
|
||||
),
|
||||
required_capabilities=(
|
||||
CAPABILITY_POLL_SCHEDULING,
|
||||
CAPABILITY_POLL_PARTICIPATION_GATEWAY,
|
||||
),
|
||||
provides_interfaces=(
|
||||
ModuleInterfaceProvider(
|
||||
name="scheduling.candidate_slots", version=MODULE_VERSION
|
||||
),
|
||||
ModuleInterfaceProvider(
|
||||
name="scheduling.decision_handoff", version=MODULE_VERSION
|
||||
),
|
||||
ModuleInterfaceProvider(name=SCHEDULING_DSAR_CAPABILITY, version="0.1.0"),
|
||||
),
|
||||
requires_interfaces=(
|
||||
ModuleInterfaceRequirement(
|
||||
name="poll.option_ordering",
|
||||
version_min="0.1.11",
|
||||
version_max_exclusive="0.2.0",
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name="poll.availability_matrix",
|
||||
version_min="0.1.11",
|
||||
version_max_exclusive="0.2.0",
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name="poll.response_collection",
|
||||
version_min="0.1.11",
|
||||
version_max_exclusive="0.2.0",
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name="poll.workflow_context",
|
||||
version_min="0.1.11",
|
||||
version_max_exclusive="0.2.0",
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name="poll.governed_participation",
|
||||
version_min="0.1.11",
|
||||
version_max_exclusive="0.2.0",
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name="evaluation.feedback",
|
||||
version_min="0.1.8",
|
||||
version_max_exclusive="0.2.0",
|
||||
optional=True,
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name="notifications.dispatch",
|
||||
version_min="0.1.8",
|
||||
version_max_exclusive="0.2.0",
|
||||
optional=True,
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name=CAPABILITY_ACCESS_PEOPLE_SEARCH,
|
||||
version_min="0.1.0",
|
||||
version_max_exclusive="0.2.0",
|
||||
optional=True,
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name=CAPABILITY_ADDRESSES_PEOPLE_SEARCH,
|
||||
version_min="0.1.0",
|
||||
version_max_exclusive="0.2.0",
|
||||
optional=True,
|
||||
),
|
||||
ModuleInterfaceRequirement(
|
||||
name="calendar.scheduling",
|
||||
version_min="0.1.9",
|
||||
version_max_exclusive="0.2.0",
|
||||
optional=True,
|
||||
),
|
||||
),
|
||||
permissions=PERMISSIONS,
|
||||
role_templates=ROLE_TEMPLATES,
|
||||
nav_items=(
|
||||
NavItem(
|
||||
path="/scheduling",
|
||||
label="Scheduling",
|
||||
icon="calendar-clock",
|
||||
required_any=(READ_SCOPE,),
|
||||
order=56,
|
||||
),
|
||||
),
|
||||
frontend=FrontendModule(
|
||||
module_id=MODULE_ID,
|
||||
package_name="@govoplan/scheduling-webui",
|
||||
routes=(
|
||||
FrontendRoute(
|
||||
path="/scheduling",
|
||||
component="SchedulingPage",
|
||||
required_any=(READ_SCOPE,),
|
||||
order=56,
|
||||
),
|
||||
),
|
||||
public_routes=(
|
||||
PublicFrontendRoute(
|
||||
path="/scheduling/public/:requestId/:token",
|
||||
component="SchedulingPublicPage",
|
||||
order=10,
|
||||
),
|
||||
PublicFrontendRoute(
|
||||
path="/scheduling/enrol/:requestId/:token",
|
||||
component="SchedulingEnrollmentPage",
|
||||
order=11,
|
||||
),
|
||||
),
|
||||
nav_items=(
|
||||
NavItem(
|
||||
path="/scheduling",
|
||||
label="Scheduling",
|
||||
icon="calendar-clock",
|
||||
required_any=(READ_SCOPE,),
|
||||
order=56,
|
||||
),
|
||||
),
|
||||
product_areas=(
|
||||
ProductAreaContribution(
|
||||
id="meetings-decisions",
|
||||
module_id=MODULE_ID,
|
||||
label="i18n:govoplan-core.product_area.meetings_decisions",
|
||||
icon="calendar",
|
||||
description="i18n:govoplan-core.product_area.meetings_decisions_description",
|
||||
surface_ids=(
|
||||
"scheduling.nav.scheduling",
|
||||
"scheduling.route.scheduling",
|
||||
),
|
||||
order=50,
|
||||
),
|
||||
),
|
||||
view_surfaces=(
|
||||
ViewSurface(
|
||||
id="scheduling.widget.open-requests",
|
||||
module_id=MODULE_ID,
|
||||
kind="section",
|
||||
label="Scheduling requests widget",
|
||||
order=45,
|
||||
),
|
||||
),
|
||||
),
|
||||
route_factory=_scheduling_router,
|
||||
public_tenant_resolver=_public_tenant_resolver,
|
||||
tenant_summary_providers=(_tenant_summary,),
|
||||
migration_spec=MigrationSpec(
|
||||
module_id=MODULE_ID,
|
||||
metadata=Base.metadata,
|
||||
script_location=str(Path(__file__).with_name("migrations") / "versions"),
|
||||
retirement_supported=True,
|
||||
retirement_provider=drop_table_retirement_provider(
|
||||
scheduling_models.SchedulingRequest,
|
||||
scheduling_models.SchedulingCandidateSlot,
|
||||
scheduling_models.SchedulingParticipant,
|
||||
scheduling_models.SchedulingPublicEnrollmentLink,
|
||||
scheduling_models.SchedulingNotification,
|
||||
label="Scheduling",
|
||||
),
|
||||
retirement_notes="Destructive retirement drops scheduling-owned database tables after the installer captures a database snapshot.",
|
||||
),
|
||||
uninstall_guard_providers=(
|
||||
persistent_table_uninstall_guard(
|
||||
scheduling_models.SchedulingRequest,
|
||||
scheduling_models.SchedulingCandidateSlot,
|
||||
scheduling_models.SchedulingParticipant,
|
||||
scheduling_models.SchedulingPublicEnrollmentLink,
|
||||
scheduling_models.SchedulingNotification,
|
||||
label="Scheduling",
|
||||
),
|
||||
),
|
||||
documentation=DOCUMENTATION,
|
||||
capability_factories={
|
||||
SCHEDULING_DSAR_CAPABILITY: _scheduling_dsar_provider,
|
||||
},
|
||||
capability_documentation={
|
||||
SCHEDULING_DSAR_CAPABILITY: CapabilityDocumentation(
|
||||
label="Scheduling data-subject request provider",
|
||||
summary="Finds isolated Scheduling participation and coordination metadata and classifies governed erasure actions.",
|
||||
contract_version="0.1.0",
|
||||
documentation_types=("admin",),
|
||||
audience=("privacy_officer", "scheduling_manager", "records_manager"),
|
||||
),
|
||||
},
|
||||
architecture=declared_module_architecture(
|
||||
layer="communication_participation",
|
||||
kind="domain",
|
||||
maturity="vertical_slice",
|
||||
documentation_ref="README.md",
|
||||
test_ref="tests/test_service.py",
|
||||
known_limits=(
|
||||
"Reference deployment notification delivery and every calendar-provider constraint remain incomplete.",
|
||||
),
|
||||
owned_concepts=(
|
||||
"scheduling request",
|
||||
"candidate slot",
|
||||
"scheduling participant",
|
||||
"public self-enrollment link",
|
||||
"scheduling decision",
|
||||
),
|
||||
non_owned_concepts=(
|
||||
"poll response primitive",
|
||||
"calendar event",
|
||||
"mail delivery",
|
||||
),
|
||||
recovery_docs=("README.md",),
|
||||
security_docs=("README.md",),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
manifest = with_documentation_structured_translations(
|
||||
manifest, locale="de", translations=GERMAN_STRUCTURED_TRANSLATIONS
|
||||
)
|
||||
|
||||
|
||||
def get_manifest() -> ModuleManifest:
|
||||
return manifest
|
||||
@@ -0,0 +1 @@
|
||||
from __future__ import annotations
|
||||
+320
@@ -0,0 +1,320 @@
|
||||
"""v0.1.8 scheduling baseline
|
||||
|
||||
Revision ID: 3c4d5e6f7a8b
|
||||
Revises: None
|
||||
Create Date: 2026-07-12 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "3c4d5e6f7a8b"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = "2a3b4c5d6e7f"
|
||||
|
||||
|
||||
_BASELINE_COLUMNS = {
|
||||
"scheduling_requests": {
|
||||
"id",
|
||||
"tenant_id",
|
||||
"title",
|
||||
"description",
|
||||
"location",
|
||||
"timezone",
|
||||
"status",
|
||||
"poll_id",
|
||||
"selected_slot_id",
|
||||
"organizer_user_id",
|
||||
"deadline_at",
|
||||
"allow_external_participants",
|
||||
"allow_participant_updates",
|
||||
"result_visibility",
|
||||
"calendar_integration_enabled",
|
||||
"calendar_id",
|
||||
"calendar_freebusy_enabled",
|
||||
"calendar_hold_enabled",
|
||||
"create_calendar_event_on_decision",
|
||||
"calendar_event_id",
|
||||
"handed_off_at",
|
||||
"cancelled_at",
|
||||
"deleted_at",
|
||||
"metadata",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
},
|
||||
"scheduling_candidate_slots": {
|
||||
"id",
|
||||
"tenant_id",
|
||||
"request_id",
|
||||
"poll_option_id",
|
||||
"label",
|
||||
"description",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"timezone",
|
||||
"location",
|
||||
"position",
|
||||
"deleted_at",
|
||||
"metadata",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
},
|
||||
"scheduling_participants": {
|
||||
"id",
|
||||
"tenant_id",
|
||||
"request_id",
|
||||
"respondent_id",
|
||||
"display_name",
|
||||
"email",
|
||||
"participant_type",
|
||||
"required",
|
||||
"status",
|
||||
"poll_invitation_id",
|
||||
"last_invited_at",
|
||||
"responded_at",
|
||||
"deleted_at",
|
||||
"metadata",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
},
|
||||
}
|
||||
|
||||
_BASELINE_INDEXES = {
|
||||
"scheduling_requests": {
|
||||
"ix_scheduling_requests_calendar_event_id",
|
||||
"ix_scheduling_requests_calendar_id",
|
||||
"ix_scheduling_requests_deadline",
|
||||
"ix_scheduling_requests_deadline_at",
|
||||
"ix_scheduling_requests_deleted_at",
|
||||
"ix_scheduling_requests_organizer_user_id",
|
||||
"ix_scheduling_requests_poll_id",
|
||||
"ix_scheduling_requests_selected_slot_id",
|
||||
"ix_scheduling_requests_status",
|
||||
"ix_scheduling_requests_tenant_id",
|
||||
"ix_scheduling_requests_tenant_poll",
|
||||
"ix_scheduling_requests_tenant_status",
|
||||
},
|
||||
"scheduling_candidate_slots": {
|
||||
"ix_scheduling_candidate_slots_deleted_at",
|
||||
"ix_scheduling_candidate_slots_end_at",
|
||||
"ix_scheduling_candidate_slots_poll_option_id",
|
||||
"ix_scheduling_candidate_slots_range",
|
||||
"ix_scheduling_candidate_slots_request_id",
|
||||
"ix_scheduling_candidate_slots_request_position",
|
||||
"ix_scheduling_candidate_slots_start_at",
|
||||
"ix_scheduling_candidate_slots_tenant_id",
|
||||
},
|
||||
"scheduling_participants": {
|
||||
"ix_scheduling_participants_deleted_at",
|
||||
"ix_scheduling_participants_email",
|
||||
"ix_scheduling_participants_last_invited_at",
|
||||
"ix_scheduling_participants_participant_type",
|
||||
"ix_scheduling_participants_poll_invitation_id",
|
||||
"ix_scheduling_participants_request",
|
||||
"ix_scheduling_participants_request_email",
|
||||
"ix_scheduling_participants_request_id",
|
||||
"ix_scheduling_participants_request_respondent",
|
||||
"ix_scheduling_participants_responded_at",
|
||||
"ix_scheduling_participants_respondent_id",
|
||||
"ix_scheduling_participants_status",
|
||||
"ix_scheduling_participants_tenant_id",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _request_foreign_key_exists(inspector: sa.Inspector, table_name: str) -> bool:
|
||||
return any(
|
||||
tuple(item.get("constrained_columns") or ()) == ("request_id",)
|
||||
and item.get("referred_table") == "scheduling_requests"
|
||||
and tuple(item.get("referred_columns") or ()) == ("id",)
|
||||
and str((item.get("options") or {}).get("ondelete", "")).upper() == "CASCADE"
|
||||
for item in inspector.get_foreign_keys(table_name)
|
||||
)
|
||||
|
||||
|
||||
def _adopt_existing_baseline() -> bool:
|
||||
"""Adopt the complete unversioned Scheduling baseline, never a partial one."""
|
||||
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
expected_tables = set(_BASELINE_COLUMNS)
|
||||
present_tables = expected_tables.intersection(inspector.get_table_names())
|
||||
if not present_tables:
|
||||
return False
|
||||
|
||||
problems: list[str] = []
|
||||
missing_tables = expected_tables - present_tables
|
||||
if missing_tables:
|
||||
problems.append(f"missing tables: {', '.join(sorted(missing_tables))}")
|
||||
|
||||
for table_name in sorted(present_tables):
|
||||
columns = {item["name"] for item in inspector.get_columns(table_name)}
|
||||
missing_columns = _BASELINE_COLUMNS[table_name] - columns
|
||||
if missing_columns:
|
||||
problems.append(f"{table_name} missing columns: {', '.join(sorted(missing_columns))}")
|
||||
|
||||
indexes = {item["name"] for item in inspector.get_indexes(table_name)}
|
||||
missing_indexes = _BASELINE_INDEXES[table_name] - indexes
|
||||
if missing_indexes:
|
||||
problems.append(f"{table_name} missing indexes: {', '.join(sorted(missing_indexes))}")
|
||||
|
||||
primary_key = tuple(inspector.get_pk_constraint(table_name).get("constrained_columns") or ())
|
||||
if primary_key != ("id",):
|
||||
problems.append(f"{table_name} has unexpected primary key: {primary_key!r}")
|
||||
|
||||
for table_name in ("scheduling_candidate_slots", "scheduling_participants"):
|
||||
if table_name in present_tables and not _request_foreign_key_exists(inspector, table_name):
|
||||
problems.append(f"{table_name} is missing its cascading request_id foreign key")
|
||||
|
||||
if problems:
|
||||
detail = "; ".join(problems)
|
||||
raise RuntimeError(
|
||||
"Cannot adopt the existing Scheduling v0.1.8 baseline because it is incomplete or ambiguous: "
|
||||
f"{detail}"
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
if _adopt_existing_baseline():
|
||||
return
|
||||
|
||||
op.create_table(
|
||||
"scheduling_requests",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("tenant_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("title", sa.String(length=500), nullable=False),
|
||||
sa.Column("description", sa.Text(), nullable=True),
|
||||
sa.Column("location", sa.String(length=500), nullable=True),
|
||||
sa.Column("timezone", sa.String(length=100), nullable=False),
|
||||
sa.Column("status", sa.String(length=40), nullable=False),
|
||||
sa.Column("poll_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("selected_slot_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("organizer_user_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("deadline_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("allow_external_participants", sa.Boolean(), nullable=False),
|
||||
sa.Column("allow_participant_updates", sa.Boolean(), nullable=False),
|
||||
sa.Column("result_visibility", sa.String(length=30), nullable=False),
|
||||
sa.Column("calendar_integration_enabled", sa.Boolean(), nullable=False),
|
||||
sa.Column("calendar_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("calendar_freebusy_enabled", sa.Boolean(), nullable=False),
|
||||
sa.Column("calendar_hold_enabled", sa.Boolean(), nullable=False),
|
||||
sa.Column("create_calendar_event_on_decision", sa.Boolean(), nullable=False),
|
||||
sa.Column("calendar_event_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("handed_off_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("cancelled_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("metadata", sa.JSON(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_scheduling_requests")),
|
||||
)
|
||||
op.create_index(op.f("ix_scheduling_requests_calendar_event_id"), "scheduling_requests", ["calendar_event_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_calendar_id"), "scheduling_requests", ["calendar_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_deadline_at"), "scheduling_requests", ["deadline_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_deleted_at"), "scheduling_requests", ["deleted_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_organizer_user_id"), "scheduling_requests", ["organizer_user_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_poll_id"), "scheduling_requests", ["poll_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_selected_slot_id"), "scheduling_requests", ["selected_slot_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_status"), "scheduling_requests", ["status"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_requests_tenant_id"), "scheduling_requests", ["tenant_id"], unique=False)
|
||||
op.create_index("ix_scheduling_requests_deadline", "scheduling_requests", ["tenant_id", "deadline_at"], unique=False)
|
||||
op.create_index("ix_scheduling_requests_tenant_poll", "scheduling_requests", ["tenant_id", "poll_id"], unique=False)
|
||||
op.create_index("ix_scheduling_requests_tenant_status", "scheduling_requests", ["tenant_id", "status"], unique=False)
|
||||
|
||||
op.create_table(
|
||||
"scheduling_candidate_slots",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("tenant_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("request_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("poll_option_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("label", sa.String(length=500), nullable=False),
|
||||
sa.Column("description", sa.Text(), nullable=True),
|
||||
sa.Column("start_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("end_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("timezone", sa.String(length=100), nullable=False),
|
||||
sa.Column("location", sa.String(length=500), nullable=True),
|
||||
sa.Column("position", sa.Integer(), nullable=False),
|
||||
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("metadata", sa.JSON(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["request_id"],
|
||||
["scheduling_requests.id"],
|
||||
name=op.f("fk_scheduling_candidate_slots_request_id_scheduling_requests"),
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_scheduling_candidate_slots")),
|
||||
)
|
||||
op.create_index(op.f("ix_scheduling_candidate_slots_deleted_at"), "scheduling_candidate_slots", ["deleted_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_candidate_slots_end_at"), "scheduling_candidate_slots", ["end_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_candidate_slots_poll_option_id"), "scheduling_candidate_slots", ["poll_option_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_candidate_slots_request_id"), "scheduling_candidate_slots", ["request_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_candidate_slots_start_at"), "scheduling_candidate_slots", ["start_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_candidate_slots_tenant_id"), "scheduling_candidate_slots", ["tenant_id"], unique=False)
|
||||
op.create_index(
|
||||
"ix_scheduling_candidate_slots_range",
|
||||
"scheduling_candidate_slots",
|
||||
["tenant_id", "start_at", "end_at"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_scheduling_candidate_slots_request_position",
|
||||
"scheduling_candidate_slots",
|
||||
["request_id", "position"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
"scheduling_participants",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("tenant_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("request_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("respondent_id", sa.String(length=255), nullable=True),
|
||||
sa.Column("display_name", sa.String(length=500), nullable=True),
|
||||
sa.Column("email", sa.String(length=320), nullable=True),
|
||||
sa.Column("participant_type", sa.String(length=30), nullable=False),
|
||||
sa.Column("required", sa.Boolean(), nullable=False),
|
||||
sa.Column("status", sa.String(length=40), nullable=False),
|
||||
sa.Column("poll_invitation_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("last_invited_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("responded_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("metadata", sa.JSON(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["request_id"],
|
||||
["scheduling_requests.id"],
|
||||
name=op.f("fk_scheduling_participants_request_id_scheduling_requests"),
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_scheduling_participants")),
|
||||
)
|
||||
op.create_index(op.f("ix_scheduling_participants_deleted_at"), "scheduling_participants", ["deleted_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_email"), "scheduling_participants", ["email"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_last_invited_at"), "scheduling_participants", ["last_invited_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_participant_type"), "scheduling_participants", ["participant_type"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_poll_invitation_id"), "scheduling_participants", ["poll_invitation_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_request_id"), "scheduling_participants", ["request_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_responded_at"), "scheduling_participants", ["responded_at"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_respondent_id"), "scheduling_participants", ["respondent_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_status"), "scheduling_participants", ["status"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_participants_tenant_id"), "scheduling_participants", ["tenant_id"], unique=False)
|
||||
op.create_index("ix_scheduling_participants_request", "scheduling_participants", ["tenant_id", "request_id"], unique=False)
|
||||
op.create_index("ix_scheduling_participants_request_email", "scheduling_participants", ["request_id", "email"], unique=False)
|
||||
op.create_index(
|
||||
"ix_scheduling_participants_request_respondent",
|
||||
"scheduling_participants",
|
||||
["request_id", "respondent_id"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("scheduling_participants")
|
||||
op.drop_table("scheduling_candidate_slots")
|
||||
op.drop_table("scheduling_requests")
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
"""v0.1.8 scheduling calendar integration and notification outbox
|
||||
|
||||
Revision ID: 4d5e6f7a8b9c
|
||||
Revises: 3c4d5e6f7a8b
|
||||
Create Date: 2026-07-12 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "4d5e6f7a8b9c"
|
||||
down_revision = "3c4d5e6f7a8b"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
_CALENDAR_SLOT_COLUMNS = {
|
||||
"freebusy_checked_at",
|
||||
"freebusy_status",
|
||||
"freebusy_conflicts",
|
||||
"tentative_hold_event_id",
|
||||
}
|
||||
_CALENDAR_SLOT_INDEXES = {
|
||||
"ix_scheduling_candidate_slots_freebusy_status",
|
||||
"ix_scheduling_candidate_slots_tentative_hold_event_id",
|
||||
}
|
||||
_NOTIFICATION_COLUMNS = {
|
||||
"id",
|
||||
"tenant_id",
|
||||
"request_id",
|
||||
"participant_id",
|
||||
"event_kind",
|
||||
"channel",
|
||||
"recipient",
|
||||
"status",
|
||||
"payload",
|
||||
"error",
|
||||
"sent_at",
|
||||
"metadata",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
}
|
||||
_NOTIFICATION_INDEXES = {
|
||||
"ix_scheduling_notifications_channel",
|
||||
"ix_scheduling_notifications_event_kind",
|
||||
"ix_scheduling_notifications_participant_id",
|
||||
"ix_scheduling_notifications_recipient",
|
||||
"ix_scheduling_notifications_request_id",
|
||||
"ix_scheduling_notifications_request_status",
|
||||
"ix_scheduling_notifications_status",
|
||||
"ix_scheduling_notifications_tenant_id",
|
||||
"ix_scheduling_notifications_tenant_status",
|
||||
}
|
||||
|
||||
|
||||
def _slot_extension_problems(inspector: Any, slot_columns: set[str]) -> list[str]:
|
||||
problems: list[str] = []
|
||||
missing_columns = _CALENDAR_SLOT_COLUMNS - slot_columns
|
||||
if missing_columns:
|
||||
problems.append(
|
||||
"scheduling_candidate_slots missing columns: "
|
||||
f"{', '.join(sorted(missing_columns))}"
|
||||
)
|
||||
indexes = {item["name"] for item in inspector.get_indexes("scheduling_candidate_slots")}
|
||||
missing_indexes = _CALENDAR_SLOT_INDEXES - indexes
|
||||
if missing_indexes:
|
||||
problems.append(
|
||||
"scheduling_candidate_slots missing indexes: "
|
||||
f"{', '.join(sorted(missing_indexes))}"
|
||||
)
|
||||
return problems
|
||||
|
||||
|
||||
def _has_cascading_notification_request_foreign_key(inspector: Any) -> bool:
|
||||
return any(
|
||||
tuple(item.get("constrained_columns") or ()) == ("request_id",)
|
||||
and item.get("referred_table") == "scheduling_requests"
|
||||
and tuple(item.get("referred_columns") or ()) == ("id",)
|
||||
and str((item.get("options") or {}).get("ondelete", "")).upper() == "CASCADE"
|
||||
for item in inspector.get_foreign_keys("scheduling_notifications")
|
||||
)
|
||||
|
||||
|
||||
def _notification_extension_problems(inspector: Any) -> list[str]:
|
||||
problems: list[str] = []
|
||||
columns = {item["name"] for item in inspector.get_columns("scheduling_notifications")}
|
||||
missing_columns = _NOTIFICATION_COLUMNS - columns
|
||||
if missing_columns:
|
||||
problems.append(
|
||||
"scheduling_notifications missing columns: "
|
||||
f"{', '.join(sorted(missing_columns))}"
|
||||
)
|
||||
|
||||
indexes = {item["name"] for item in inspector.get_indexes("scheduling_notifications")}
|
||||
missing_indexes = _NOTIFICATION_INDEXES - indexes
|
||||
if missing_indexes:
|
||||
problems.append(
|
||||
"scheduling_notifications missing indexes: "
|
||||
f"{', '.join(sorted(missing_indexes))}"
|
||||
)
|
||||
|
||||
primary_key = tuple(
|
||||
inspector.get_pk_constraint("scheduling_notifications").get("constrained_columns") or ()
|
||||
)
|
||||
if primary_key != ("id",):
|
||||
problems.append(f"scheduling_notifications has unexpected primary key: {primary_key!r}")
|
||||
if not _has_cascading_notification_request_foreign_key(inspector):
|
||||
problems.append("scheduling_notifications is missing its cascading request_id foreign key")
|
||||
return problems
|
||||
|
||||
|
||||
def _adopt_existing_calendar_notifications() -> bool:
|
||||
"""Adopt only the complete calendar/notification extension."""
|
||||
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
tables = set(inspector.get_table_names())
|
||||
if "scheduling_candidate_slots" not in tables:
|
||||
raise RuntimeError(
|
||||
"Cannot apply the Scheduling calendar migration because scheduling_candidate_slots is missing"
|
||||
)
|
||||
|
||||
slot_columns = {item["name"] for item in inspector.get_columns("scheduling_candidate_slots")}
|
||||
present_slot_columns = _CALENDAR_SLOT_COLUMNS.intersection(slot_columns)
|
||||
notification_exists = "scheduling_notifications" in tables
|
||||
if not present_slot_columns and not notification_exists:
|
||||
return False
|
||||
|
||||
problems = _slot_extension_problems(inspector, slot_columns)
|
||||
if not notification_exists:
|
||||
problems.append("missing table: scheduling_notifications")
|
||||
else:
|
||||
problems.extend(_notification_extension_problems(inspector))
|
||||
|
||||
if problems:
|
||||
detail = "; ".join(problems)
|
||||
raise RuntimeError(
|
||||
"Cannot adopt the existing Scheduling v0.1.8 calendar/notification schema because it is "
|
||||
f"incomplete or ambiguous: {detail}"
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
if _adopt_existing_calendar_notifications():
|
||||
return
|
||||
|
||||
op.add_column("scheduling_candidate_slots", sa.Column("freebusy_checked_at", sa.DateTime(timezone=True), nullable=True))
|
||||
op.add_column("scheduling_candidate_slots", sa.Column("freebusy_status", sa.String(length=40), nullable=True))
|
||||
op.add_column("scheduling_candidate_slots", sa.Column("freebusy_conflicts", sa.JSON(), nullable=False, server_default="[]"))
|
||||
op.add_column("scheduling_candidate_slots", sa.Column("tentative_hold_event_id", sa.String(length=36), nullable=True))
|
||||
op.create_index(op.f("ix_scheduling_candidate_slots_freebusy_status"), "scheduling_candidate_slots", ["freebusy_status"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_scheduling_candidate_slots_tentative_hold_event_id"),
|
||||
"scheduling_candidate_slots",
|
||||
["tentative_hold_event_id"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
"scheduling_notifications",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("tenant_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("request_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("participant_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("event_kind", sa.String(length=40), nullable=False),
|
||||
sa.Column("channel", sa.String(length=40), nullable=False),
|
||||
sa.Column("recipient", sa.String(length=500), nullable=True),
|
||||
sa.Column("status", sa.String(length=40), nullable=False),
|
||||
sa.Column("payload", sa.JSON(), nullable=False),
|
||||
sa.Column("error", sa.Text(), nullable=True),
|
||||
sa.Column("sent_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("metadata", sa.JSON(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["request_id"],
|
||||
["scheduling_requests.id"],
|
||||
name=op.f("fk_scheduling_notifications_request_id_scheduling_requests"),
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_scheduling_notifications")),
|
||||
)
|
||||
op.create_index(op.f("ix_scheduling_notifications_channel"), "scheduling_notifications", ["channel"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_notifications_event_kind"), "scheduling_notifications", ["event_kind"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_notifications_participant_id"), "scheduling_notifications", ["participant_id"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_notifications_recipient"), "scheduling_notifications", ["recipient"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_notifications_request_id"), "scheduling_notifications", ["request_id"], unique=False)
|
||||
op.create_index("ix_scheduling_notifications_request_status", "scheduling_notifications", ["request_id", "status"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_notifications_status"), "scheduling_notifications", ["status"], unique=False)
|
||||
op.create_index(op.f("ix_scheduling_notifications_tenant_id"), "scheduling_notifications", ["tenant_id"], unique=False)
|
||||
op.create_index("ix_scheduling_notifications_tenant_status", "scheduling_notifications", ["tenant_id", "status"], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("scheduling_notifications")
|
||||
op.drop_index(op.f("ix_scheduling_candidate_slots_tentative_hold_event_id"), table_name="scheduling_candidate_slots")
|
||||
op.drop_index(op.f("ix_scheduling_candidate_slots_freebusy_status"), table_name="scheduling_candidate_slots")
|
||||
op.drop_column("scheduling_candidate_slots", "tentative_hold_event_id")
|
||||
op.drop_column("scheduling_candidate_slots", "freebusy_conflicts")
|
||||
op.drop_column("scheduling_candidate_slots", "freebusy_status")
|
||||
op.drop_column("scheduling_candidate_slots", "freebusy_checked_at")
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
"""v0.1.9 scheduling participant visibility
|
||||
|
||||
Revision ID: 9c2f4a7d1e6b
|
||||
Revises: 4d5e6f7a8b9c
|
||||
Create Date: 2026-07-20 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "9c2f4a7d1e6b"
|
||||
down_revision = "4d5e6f7a8b9c"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
columns = {item["name"]: item for item in inspector.get_columns("scheduling_requests")}
|
||||
existing = columns.get("participant_visibility")
|
||||
if existing is not None:
|
||||
column_type = existing["type"]
|
||||
if existing.get("nullable") or not isinstance(column_type, sa.String) or column_type.length != 32:
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_requests.participant_visibility because its schema is unexpected"
|
||||
)
|
||||
return
|
||||
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column(
|
||||
"participant_visibility",
|
||||
sa.String(length=32),
|
||||
nullable=False,
|
||||
server_default="aggregates_only",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("scheduling_requests", "participant_visibility")
|
||||
@@ -0,0 +1 @@
|
||||
from __future__ import annotations
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
"""v0.1.10 scheduling response settings
|
||||
|
||||
Revision ID: ad7e3c9b2f10
|
||||
Revises: 9c2f4a7d1e6b
|
||||
Create Date: 2026-07-21 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "ad7e3c9b2f10"
|
||||
down_revision = "9c2f4a7d1e6b"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
_REQUEST_COLUMNS = (
|
||||
"notify_on_answers",
|
||||
"single_choice",
|
||||
"max_participants_per_option",
|
||||
"allow_maybe",
|
||||
"allow_comments",
|
||||
"participant_email_required",
|
||||
"anonymous_password_protection_enabled",
|
||||
"anonymous_password_hash",
|
||||
)
|
||||
|
||||
|
||||
def _adopted_columns(inspector: sa.Inspector, table_name: str, names: tuple[str, ...]) -> bool:
|
||||
columns = {item["name"]: item for item in inspector.get_columns(table_name)}
|
||||
present = [name for name in names if name in columns]
|
||||
if not present:
|
||||
return False
|
||||
if len(present) != len(names):
|
||||
missing = sorted(set(names) - set(present))
|
||||
raise RuntimeError(
|
||||
f"Cannot adopt partial {table_name} scheduling response settings; missing columns: "
|
||||
+ ", ".join(missing)
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
def _require_compatible_adopted_schema(inspector: sa.Inspector) -> None:
|
||||
request_columns = {
|
||||
item["name"]: item
|
||||
for item in inspector.get_columns("scheduling_requests")
|
||||
}
|
||||
for name in (
|
||||
"notify_on_answers",
|
||||
"single_choice",
|
||||
"allow_maybe",
|
||||
"allow_comments",
|
||||
"participant_email_required",
|
||||
"anonymous_password_protection_enabled",
|
||||
):
|
||||
column = request_columns[name]
|
||||
if column.get("nullable") or not isinstance(column["type"], sa.Boolean):
|
||||
raise RuntimeError(
|
||||
f"Cannot adopt scheduling_requests.{name} because its schema is unexpected"
|
||||
)
|
||||
capacity = request_columns["max_participants_per_option"]
|
||||
if not capacity.get("nullable") or not isinstance(capacity["type"], sa.Integer):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_requests.max_participants_per_option because its schema is unexpected"
|
||||
)
|
||||
password_hash = request_columns["anonymous_password_hash"]
|
||||
if (
|
||||
not password_hash.get("nullable")
|
||||
or not isinstance(password_hash["type"], sa.String)
|
||||
or password_hash["type"].length != 500
|
||||
):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_requests.anonymous_password_hash because its schema is unexpected"
|
||||
)
|
||||
participant_columns = {
|
||||
item["name"]: item
|
||||
for item in inspector.get_columns("scheduling_participants")
|
||||
}
|
||||
comment = participant_columns["response_comment"]
|
||||
if not comment.get("nullable") or not isinstance(comment["type"], sa.Text):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_participants.response_comment because its schema is unexpected"
|
||||
)
|
||||
gateway = participant_columns["participation_gateway"]
|
||||
if (
|
||||
not gateway.get("nullable")
|
||||
or not isinstance(gateway["type"], sa.String)
|
||||
or gateway["type"].length != 40
|
||||
):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_participants.participation_gateway because its schema is unexpected"
|
||||
)
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
request_columns_present = _adopted_columns(
|
||||
inspector,
|
||||
"scheduling_requests",
|
||||
_REQUEST_COLUMNS,
|
||||
)
|
||||
participant_columns_present = _adopted_columns(
|
||||
inspector,
|
||||
"scheduling_participants",
|
||||
("response_comment", "participation_gateway"),
|
||||
)
|
||||
if request_columns_present != participant_columns_present:
|
||||
raise RuntimeError(
|
||||
"Cannot adopt partial scheduling response settings across request and participant tables"
|
||||
)
|
||||
if request_columns_present:
|
||||
_require_compatible_adopted_schema(inspector)
|
||||
return
|
||||
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("notify_on_answers", sa.Boolean(), nullable=False, server_default=sa.true()),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("single_choice", sa.Boolean(), nullable=False, server_default=sa.false()),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("max_participants_per_option", sa.Integer(), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("allow_maybe", sa.Boolean(), nullable=False, server_default=sa.true()),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("allow_comments", sa.Boolean(), nullable=False, server_default=sa.false()),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("participant_email_required", sa.Boolean(), nullable=False, server_default=sa.false()),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column(
|
||||
"anonymous_password_protection_enabled",
|
||||
sa.Boolean(),
|
||||
nullable=False,
|
||||
server_default=sa.false(),
|
||||
),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("anonymous_password_hash", sa.String(length=500), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_participants",
|
||||
sa.Column("response_comment", sa.Text(), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduling_participants",
|
||||
sa.Column("participation_gateway", sa.String(length=40), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("scheduling_participants", "participation_gateway")
|
||||
op.drop_column("scheduling_participants", "response_comment")
|
||||
for name in reversed(_REQUEST_COLUMNS):
|
||||
op.drop_column("scheduling_requests", name)
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
"""v0.1.10 scheduling participation gateway schema repair
|
||||
|
||||
Revision ID: be8f4d2c1a70
|
||||
Revises: ad7e3c9b2f10
|
||||
Create Date: 2026-07-22 00:00:00.000000
|
||||
|
||||
Some development databases were stamped at ``ad7e3c9b2f10`` before the
|
||||
``scheduling_participants.participation_gateway`` column was present. A
|
||||
forward repair is required because Alembic correctly does not replay an
|
||||
already-recorded revision. The column is nullable, so adding it preserves all
|
||||
existing participant rows without inventing gateway ownership for legacy
|
||||
invitations.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "be8f4d2c1a70"
|
||||
down_revision = "ad7e3c9b2f10"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def _require_compatible_column(column: dict[str, object]) -> None:
|
||||
column_type = column["type"]
|
||||
if (
|
||||
not column.get("nullable")
|
||||
or not isinstance(column_type, sa.String)
|
||||
or column_type.length != 40
|
||||
):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_participants.participation_gateway "
|
||||
"because its schema is unexpected"
|
||||
)
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
if "scheduling_participants" not in inspector.get_table_names():
|
||||
raise RuntimeError(
|
||||
"Cannot repair Scheduling participation gateways because "
|
||||
"scheduling_participants is missing"
|
||||
)
|
||||
|
||||
columns = {
|
||||
item["name"]: item
|
||||
for item in inspector.get_columns("scheduling_participants")
|
||||
}
|
||||
existing = columns.get("participation_gateway")
|
||||
if existing is not None:
|
||||
_require_compatible_column(existing)
|
||||
return
|
||||
|
||||
op.add_column(
|
||||
"scheduling_participants",
|
||||
sa.Column("participation_gateway", sa.String(length=40), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ad7e3c9b2f10 already owns this column in the canonical schema. The repair
|
||||
# revision must therefore not remove it when returning to that revision.
|
||||
pass
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
"""v0.1.11 bounded scheduling cancellation notice
|
||||
|
||||
Revision ID: c9d4e7f1a2b3
|
||||
Revises: be8f4d2c1a70
|
||||
Create Date: 2026-07-22 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "c9d4e7f1a2b3"
|
||||
down_revision = "be8f4d2c1a70"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
columns = {
|
||||
item["name"]: item
|
||||
for item in inspector.get_columns("scheduling_requests")
|
||||
}
|
||||
existing = columns.get("cancellation_notice_until")
|
||||
if existing is not None:
|
||||
if (
|
||||
not existing.get("nullable")
|
||||
or not isinstance(existing["type"], sa.DateTime)
|
||||
):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_requests.cancellation_notice_until "
|
||||
"because its schema is unexpected"
|
||||
)
|
||||
return
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("cancellation_notice_until", sa.DateTime(timezone=True), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("scheduling_requests", "cancellation_notice_until")
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
"""Governed public self-enrollment links.
|
||||
|
||||
Revision ID: d7a4c1e8f205
|
||||
Revises: c9d4e7f1a2b3
|
||||
Create Date: 2026-08-20 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "d7a4c1e8f205"
|
||||
down_revision = "c9d4e7f1a2b3"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
table_names = set(inspector.get_table_names())
|
||||
if "scheduling_public_enrollment_links" not in table_names:
|
||||
op.create_table(
|
||||
"scheduling_public_enrollment_links",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("tenant_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("request_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("token_hash", sa.String(length=64), nullable=False),
|
||||
sa.Column("max_enrollments", sa.Integer(), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("allow_anonymous", sa.Boolean(), nullable=False),
|
||||
sa.Column("allow_authenticated", sa.Boolean(), nullable=False),
|
||||
sa.Column("created_by", sa.String(length=255), nullable=True),
|
||||
sa.Column("revoked_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("metadata", sa.JSON(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["request_id"],
|
||||
["scheduling_requests.id"],
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint(
|
||||
"token_hash",
|
||||
name="uq_scheduling_enrollment_link_token_hash",
|
||||
),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_scheduling_enrollment_links_request",
|
||||
"scheduling_public_enrollment_links",
|
||||
["tenant_id", "request_id"],
|
||||
)
|
||||
op.create_index(
|
||||
"ix_scheduling_enrollment_links_expiry",
|
||||
"scheduling_public_enrollment_links",
|
||||
["tenant_id", "expires_at"],
|
||||
)
|
||||
for column in ("tenant_id", "request_id", "expires_at", "created_by", "revoked_at"):
|
||||
op.create_index(
|
||||
f"ix_scheduling_public_enrollment_links_{column}",
|
||||
"scheduling_public_enrollment_links",
|
||||
[column],
|
||||
)
|
||||
else:
|
||||
columns = {item["name"] for item in inspector.get_columns("scheduling_public_enrollment_links")}
|
||||
expected = {
|
||||
"id", "tenant_id", "request_id", "token_hash", "max_enrollments",
|
||||
"expires_at", "allow_anonymous", "allow_authenticated", "created_by",
|
||||
"revoked_at", "metadata", "created_at", "updated_at",
|
||||
}
|
||||
if columns != expected:
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_public_enrollment_links because its schema is unexpected"
|
||||
)
|
||||
|
||||
participant_columns = {
|
||||
item["name"] for item in sa.inspect(op.get_bind()).get_columns("scheduling_participants")
|
||||
}
|
||||
additions = (
|
||||
("self_enrollment_link_id", sa.String(length=36)),
|
||||
("self_enrollment_proof_hash", sa.String(length=64)),
|
||||
("bound_account_id", sa.String(length=255)),
|
||||
("account_bound_at", sa.DateTime(timezone=True)),
|
||||
)
|
||||
present = {name for name, _type in additions if name in participant_columns}
|
||||
if present and len(present) != len(additions):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt partial scheduling participant self-enrollment columns"
|
||||
)
|
||||
if not present:
|
||||
with op.batch_alter_table("scheduling_participants") as batch:
|
||||
batch.add_column(
|
||||
sa.Column("self_enrollment_link_id", sa.String(length=36), nullable=True)
|
||||
)
|
||||
batch.add_column(
|
||||
sa.Column("self_enrollment_proof_hash", sa.String(length=64), nullable=True)
|
||||
)
|
||||
batch.add_column(
|
||||
sa.Column("account_bound_at", sa.DateTime(timezone=True), nullable=True)
|
||||
)
|
||||
batch.add_column(
|
||||
sa.Column("bound_account_id", sa.String(length=255), nullable=True)
|
||||
)
|
||||
batch.create_foreign_key(
|
||||
"fk_scheduling_participants_enrollment_link",
|
||||
"scheduling_public_enrollment_links",
|
||||
["self_enrollment_link_id"],
|
||||
["id"],
|
||||
ondelete="SET NULL",
|
||||
)
|
||||
batch.create_index(
|
||||
"ix_scheduling_participants_self_enrollment_link_id",
|
||||
["self_enrollment_link_id"],
|
||||
)
|
||||
batch.create_index(
|
||||
"ix_scheduling_participants_bound_account_id",
|
||||
["bound_account_id"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("scheduling_participants") as batch:
|
||||
batch.drop_index("ix_scheduling_participants_bound_account_id")
|
||||
batch.drop_index("ix_scheduling_participants_self_enrollment_link_id")
|
||||
batch.drop_constraint(
|
||||
"fk_scheduling_participants_enrollment_link",
|
||||
type_="foreignkey",
|
||||
)
|
||||
batch.drop_column("account_bound_at")
|
||||
batch.drop_column("self_enrollment_proof_hash")
|
||||
batch.drop_column("self_enrollment_link_id")
|
||||
batch.drop_column("bound_account_id")
|
||||
op.drop_table("scheduling_public_enrollment_links")
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
_runtime_registry: object | None = None
|
||||
_runtime_settings: object | None = None
|
||||
|
||||
|
||||
def configure_runtime(*, registry: object | None = None, settings: object | None = None) -> None:
|
||||
global _runtime_registry, _runtime_settings
|
||||
if registry is not None:
|
||||
_runtime_registry = registry
|
||||
if settings is not None:
|
||||
_runtime_settings = settings
|
||||
|
||||
|
||||
def get_registry() -> object | None:
|
||||
return _runtime_registry
|
||||
|
||||
|
||||
def get_settings() -> object | None:
|
||||
return _runtime_settings
|
||||
@@ -0,0 +1,686 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Literal
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, SecretStr, field_validator, model_validator
|
||||
|
||||
|
||||
SchedulingStatus = Literal["draft", "collecting", "closed", "decided", "handed_off", "cancelled", "archived"]
|
||||
SchedulingParticipantType = Literal["internal", "external", "resource"]
|
||||
SchedulingParticipantStatus = Literal["draft", "invited", "responded", "declined", "removed"]
|
||||
SchedulingResultVisibility = Literal["organizer", "after_response", "after_close", "public"]
|
||||
SchedulingAvailabilityValue = Literal["available", "maybe", "unavailable"]
|
||||
SchedulingParticipantVisibility = Literal["aggregates_only", "names_and_statuses"]
|
||||
|
||||
|
||||
def _known_timezone(value: str | None) -> str | None:
|
||||
if value is None:
|
||||
return None
|
||||
try:
|
||||
ZoneInfo(value)
|
||||
except ZoneInfoNotFoundError as exc:
|
||||
raise ValueError("timezone must be a valid IANA timezone") from exc
|
||||
return value
|
||||
|
||||
|
||||
def _participant_email(value: str | None) -> str | None:
|
||||
if value is None:
|
||||
return None
|
||||
normalized = value.strip().casefold()
|
||||
if not normalized:
|
||||
return None
|
||||
local, separator, domain = normalized.partition("@")
|
||||
if (
|
||||
separator != "@"
|
||||
or not local
|
||||
or not domain
|
||||
or "@" in domain
|
||||
or any(character.isspace() for character in normalized)
|
||||
):
|
||||
raise ValueError("participant_email must be a valid email address")
|
||||
return normalized
|
||||
|
||||
|
||||
class SchedulingCalendarPreferences(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
enabled: bool = False
|
||||
calendar_id: str | None = Field(default=None, max_length=36)
|
||||
freebusy_enabled: bool = False
|
||||
tentative_holds_enabled: bool = False
|
||||
create_event_on_decision: bool = False
|
||||
|
||||
|
||||
class SchedulingCandidateSlotInput(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
label: str | None = Field(default=None, max_length=500)
|
||||
description: str | None = None
|
||||
start_at: AwareDatetime
|
||||
end_at: AwareDatetime
|
||||
timezone: str | None = Field(default=None, max_length=100)
|
||||
location: str | None = Field(default=None, max_length=500)
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
_validate_timezone = field_validator("timezone")(_known_timezone)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_range(self) -> "SchedulingCandidateSlotInput":
|
||||
if self.end_at <= self.start_at:
|
||||
raise ValueError("end_at must be after start_at")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingCandidateSlotUpdateRequest(BaseModel):
|
||||
"""Partial update of one candidate slot.
|
||||
|
||||
A semantic option change invalidates existing answers for this slot in the
|
||||
backing Poll. Exact repeats are safe no-ops.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
label: str | None = Field(default=None, min_length=1, max_length=500)
|
||||
description: str | None = None
|
||||
start_at: AwareDatetime | None = None
|
||||
end_at: AwareDatetime | None = None
|
||||
timezone: str | None = Field(default=None, min_length=1, max_length=100)
|
||||
location: str | None = Field(default=None, max_length=500)
|
||||
metadata: dict[str, Any] | None = None
|
||||
|
||||
_validate_timezone = field_validator("timezone")(_known_timezone)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_range(self) -> "SchedulingCandidateSlotUpdateRequest":
|
||||
if self.start_at is not None and self.end_at is not None and self.end_at <= self.start_at:
|
||||
raise ValueError("end_at must be after start_at")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingParticipantInput(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
respondent_id: str | None = Field(default=None, max_length=255)
|
||||
display_name: str | None = Field(default=None, max_length=500)
|
||||
email: str | None = Field(default=None, max_length=320)
|
||||
participant_type: SchedulingParticipantType = "external"
|
||||
required: bool = True
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
_validate_email = field_validator("email")(_participant_email)
|
||||
|
||||
|
||||
class SchedulingCandidateSlotReconcileInput(SchedulingCandidateSlotInput):
|
||||
id: str | None = Field(default=None, max_length=36)
|
||||
revision: str | None = Field(
|
||||
default=None,
|
||||
min_length=64,
|
||||
max_length=64,
|
||||
pattern=r"^[0-9a-f]{64}$",
|
||||
)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_existing_revision(self) -> "SchedulingCandidateSlotReconcileInput":
|
||||
if self.id is not None and self.revision is None:
|
||||
raise ValueError("revision is required for an existing scheduling slot")
|
||||
if self.id is None and self.revision is not None:
|
||||
raise ValueError("revision can only be supplied for an existing scheduling slot")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingParticipantReconcileInput(SchedulingParticipantInput):
|
||||
id: str | None = Field(default=None, max_length=36)
|
||||
revision: str | None = Field(
|
||||
default=None,
|
||||
min_length=64,
|
||||
max_length=64,
|
||||
pattern=r"^[0-9a-f]{64}$",
|
||||
)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_existing_revision(self) -> "SchedulingParticipantReconcileInput":
|
||||
if self.id is not None and self.revision is None:
|
||||
raise ValueError("revision is required for an existing scheduling participant")
|
||||
if self.id is None and self.revision is not None:
|
||||
raise ValueError("revision can only be supplied for an existing scheduling participant")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingRequestCreateRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
title: str = Field(min_length=1, max_length=500)
|
||||
description: str | None = None
|
||||
location: str | None = Field(default=None, max_length=500)
|
||||
timezone: str = Field(default="UTC", max_length=100)
|
||||
status: Literal["draft", "collecting"] = "draft"
|
||||
deadline_at: datetime | None = None
|
||||
allow_external_participants: bool = True
|
||||
allow_participant_updates: bool = True
|
||||
result_visibility: SchedulingResultVisibility = "after_close"
|
||||
participant_visibility: SchedulingParticipantVisibility = "aggregates_only"
|
||||
notify_on_answers: bool = True
|
||||
single_choice: bool = False
|
||||
max_participants_per_option: int | None = Field(default=None, ge=1)
|
||||
allow_maybe: bool = True
|
||||
allow_comments: bool = False
|
||||
participant_email_required: bool = False
|
||||
anonymous_password_protection_enabled: bool = False
|
||||
anonymous_password: SecretStr | None = Field(default=None, min_length=8, max_length=1024)
|
||||
calendar: SchedulingCalendarPreferences = Field(default_factory=SchedulingCalendarPreferences)
|
||||
slots: list[SchedulingCandidateSlotInput] = Field(default_factory=list, min_length=1)
|
||||
participants: list[SchedulingParticipantInput] = Field(default_factory=list)
|
||||
create_participant_invitations: bool = Field(
|
||||
default=False,
|
||||
deprecated=True,
|
||||
description=(
|
||||
"Compatibility field; participant links are issued only through "
|
||||
"the explicit participant invitation action."
|
||||
),
|
||||
)
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
_validate_timezone = field_validator("timezone")(_known_timezone)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_anonymous_password(self) -> "SchedulingRequestCreateRequest":
|
||||
if self.anonymous_password_protection_enabled and self.anonymous_password is None:
|
||||
raise ValueError("anonymous_password is required when password protection is enabled")
|
||||
if not self.anonymous_password_protection_enabled and self.anonymous_password is not None:
|
||||
raise ValueError("anonymous_password requires password protection to be enabled")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingRequestUpdateRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
title: str | None = Field(default=None, min_length=1, max_length=500)
|
||||
description: str | None = None
|
||||
location: str | None = Field(default=None, max_length=500)
|
||||
deadline_at: datetime | None = None
|
||||
allow_external_participants: bool | None = None
|
||||
allow_participant_updates: bool | None = None
|
||||
result_visibility: SchedulingResultVisibility | None = None
|
||||
participant_visibility: SchedulingParticipantVisibility | None = None
|
||||
notify_on_answers: bool | None = None
|
||||
single_choice: bool | None = None
|
||||
max_participants_per_option: int | None = Field(default=None, ge=1)
|
||||
allow_maybe: bool | None = None
|
||||
allow_comments: bool | None = None
|
||||
participant_email_required: bool | None = None
|
||||
anonymous_password_protection_enabled: bool | None = None
|
||||
anonymous_password: SecretStr | None = Field(default=None, min_length=8, max_length=1024)
|
||||
calendar: SchedulingCalendarPreferences | None = None
|
||||
slots: list[SchedulingCandidateSlotReconcileInput] | None = Field(
|
||||
default=None,
|
||||
min_length=1,
|
||||
)
|
||||
participants: list[SchedulingParticipantReconcileInput] | None = None
|
||||
create_participant_invitations: bool = Field(
|
||||
default=False,
|
||||
deprecated=True,
|
||||
description=(
|
||||
"Compatibility field; participant links are issued only through "
|
||||
"the explicit participant invitation action."
|
||||
),
|
||||
)
|
||||
metadata: dict[str, Any] | None = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_anonymous_password(self) -> "SchedulingRequestUpdateRequest":
|
||||
if self.anonymous_password_protection_enabled is False and self.anonymous_password is not None:
|
||||
raise ValueError("anonymous_password cannot be set while password protection is disabled")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_reconciliation_ids(self) -> "SchedulingRequestUpdateRequest":
|
||||
for field_name in ("slots", "participants"):
|
||||
values = getattr(self, field_name)
|
||||
if values is None:
|
||||
continue
|
||||
ids = [value.id for value in values if value.id is not None]
|
||||
if len(ids) != len(set(ids)):
|
||||
raise ValueError(f"Duplicate ids are not allowed in {field_name}")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingCandidateSlotResponse(BaseModel):
|
||||
id: str
|
||||
poll_option_id: str | None = None
|
||||
label: str
|
||||
description: str | None = None
|
||||
start_at: datetime
|
||||
end_at: datetime
|
||||
timezone: str
|
||||
location: str | None = None
|
||||
position: int
|
||||
revision: str
|
||||
freebusy_checked_at: datetime | None = None
|
||||
freebusy_status: str | None = None
|
||||
freebusy_conflicts: list[dict[str, Any]] = Field(default_factory=list)
|
||||
tentative_hold_event_id: str | None = None
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class SchedulingParticipantResponse(BaseModel):
|
||||
id: str
|
||||
revision: str | None = None
|
||||
is_current_participant: bool = False
|
||||
respondent_id: str | None = None
|
||||
display_name: str | None = None
|
||||
email: str | None = None
|
||||
participant_type: str | None = None
|
||||
required: bool | None = None
|
||||
status: str
|
||||
poll_invitation_id: str | None = None
|
||||
invitation_token: str | None = None
|
||||
last_invited_at: datetime | None = None
|
||||
responded_at: datetime | None = None
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class SchedulingParticipantAggregateResponse(BaseModel):
|
||||
total: int = 0
|
||||
status_counts: dict[str, int] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class SchedulingParticipantVisibilityDecisionResponse(BaseModel):
|
||||
requested_visibility: SchedulingParticipantVisibility
|
||||
effective_visibility: SchedulingParticipantVisibility
|
||||
policy_applied: bool = False
|
||||
reason: str | None = None
|
||||
source_path: list[dict[str, Any]] = Field(default_factory=list)
|
||||
details: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class SchedulingRequestResponse(BaseModel):
|
||||
id: str
|
||||
tenant_id: str | None = None
|
||||
title: str
|
||||
description: str | None = None
|
||||
location: str | None = None
|
||||
timezone: str
|
||||
status: str
|
||||
poll_id: str | None = None
|
||||
selected_slot_id: str | None = None
|
||||
organizer_user_id: str | None = None
|
||||
deadline_at: datetime | None = None
|
||||
allow_external_participants: bool
|
||||
allow_participant_updates: bool
|
||||
result_visibility: str
|
||||
participant_visibility: SchedulingParticipantVisibility
|
||||
notify_on_answers: bool
|
||||
single_choice: bool
|
||||
max_participants_per_option: int | None = None
|
||||
allow_maybe: bool
|
||||
allow_comments: bool
|
||||
participant_email_required: bool
|
||||
anonymous_password_protection_enabled: bool
|
||||
public_participation_policy_enforcement_available: bool | None = None
|
||||
public_participation_policy_enforcement_reason: str | None = None
|
||||
participant_invitation_delivery_available: bool | None = None
|
||||
effective_participant_visibility: SchedulingParticipantVisibility
|
||||
participant_aggregate: SchedulingParticipantAggregateResponse
|
||||
participant_visibility_decision: SchedulingParticipantVisibilityDecisionResponse
|
||||
calendar_integration_enabled: bool | None = None
|
||||
calendar_id: str | None = None
|
||||
calendar_freebusy_enabled: bool | None = None
|
||||
calendar_hold_enabled: bool | None = None
|
||||
create_calendar_event_on_decision: bool | None = None
|
||||
calendar_event_id: str | None = None
|
||||
handed_off_at: datetime | None = None
|
||||
cancelled_at: datetime | None = None
|
||||
cancellation_notice_until: datetime | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
slots: list[SchedulingCandidateSlotResponse] = Field(default_factory=list)
|
||||
participants: list[SchedulingParticipantResponse] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingRequestListResponse(BaseModel):
|
||||
requests: list[SchedulingRequestResponse] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingStatusResponse(BaseModel):
|
||||
request: SchedulingRequestResponse
|
||||
|
||||
|
||||
class SchedulingDecisionRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
slot_id: str | None = None
|
||||
poll_option_id: str | None = None
|
||||
handoff_to_calendar: bool | None = None
|
||||
|
||||
|
||||
class SchedulingAvailabilityAnswerInput(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
slot_id: str
|
||||
value: SchedulingAvailabilityValue
|
||||
option_revision: str = Field(min_length=64, max_length=64, pattern=r"^[0-9a-f]{64}$")
|
||||
|
||||
|
||||
class SchedulingAvailabilityResponseRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
answers: list[SchedulingAvailabilityAnswerInput] = Field(min_length=1)
|
||||
comment: str | None = Field(default=None, max_length=4000)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_unique_slots(self) -> "SchedulingAvailabilityResponseRequest":
|
||||
slot_ids = [answer.slot_id for answer in self.answers]
|
||||
if len(slot_ids) != len(set(slot_ids)):
|
||||
raise ValueError("Each scheduling slot can be answered only once")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingAvailabilityAnswerResponse(BaseModel):
|
||||
slot_id: str
|
||||
value: SchedulingAvailabilityValue
|
||||
|
||||
|
||||
class SchedulingAvailabilityResponse(BaseModel):
|
||||
request_id: str
|
||||
participant_id: str
|
||||
has_response: bool = False
|
||||
submitted_at: datetime | None = None
|
||||
answers: list[SchedulingAvailabilityAnswerResponse] = Field(default_factory=list)
|
||||
comment: str | None = None
|
||||
|
||||
|
||||
class SchedulingPublicParticipationAccessRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
participant_email: str | None = Field(default=None, max_length=320)
|
||||
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||
|
||||
_validate_participant_email = field_validator("participant_email")(_participant_email)
|
||||
|
||||
|
||||
class SchedulingPublicParticipationSubmitRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
answers: list[SchedulingAvailabilityAnswerInput] = Field(min_length=1)
|
||||
participant_email: str | None = Field(default=None, max_length=320)
|
||||
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||
comment: str | None = Field(default=None, max_length=4000)
|
||||
idempotency_key: str | None = Field(default=None, min_length=1, max_length=255)
|
||||
|
||||
_validate_participant_email = field_validator("participant_email")(_participant_email)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_unique_slots(self) -> "SchedulingPublicParticipationSubmitRequest":
|
||||
slot_ids = [answer.slot_id for answer in self.answers]
|
||||
if len(slot_ids) != len(set(slot_ids)):
|
||||
raise ValueError("Each scheduling slot can be answered only once")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingPublicCandidateSlotResponse(BaseModel):
|
||||
id: str
|
||||
label: str
|
||||
description: str | None = None
|
||||
start_at: datetime
|
||||
end_at: datetime
|
||||
timezone: str
|
||||
location: str | None = None
|
||||
position: int
|
||||
revision: str
|
||||
|
||||
|
||||
class SchedulingPublicParticipationResponse(BaseModel):
|
||||
request_id: str
|
||||
title: str
|
||||
description: str | None = None
|
||||
location: str | None = None
|
||||
timezone: str
|
||||
status: str
|
||||
deadline_at: datetime | None = None
|
||||
cancelled_at: datetime | None = None
|
||||
cancellation_notice_until: datetime | None = None
|
||||
cancellation_notice_only: bool = False
|
||||
participant_email_required: bool
|
||||
anonymous_password_required: bool
|
||||
single_choice: bool
|
||||
max_participants_per_option: int | None = None
|
||||
allow_maybe: bool
|
||||
allow_comments: bool
|
||||
allow_participant_updates: bool
|
||||
has_response: bool = False
|
||||
submitted_at: datetime | None = None
|
||||
answers: list[SchedulingAvailabilityAnswerResponse] = Field(default_factory=list)
|
||||
comment: str | None = None
|
||||
replayed: bool = False
|
||||
slots: list[SchedulingPublicCandidateSlotResponse] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingEnrollmentLinkCreateRequest(BaseModel):
|
||||
"""Organizer policy for one reusable, bounded self-enrollment link."""
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
expires_at: AwareDatetime
|
||||
max_enrollments: int = Field(ge=1, le=10_000)
|
||||
allow_anonymous: bool = True
|
||||
allow_authenticated: bool = True
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_access_modes(self) -> "SchedulingEnrollmentLinkCreateRequest":
|
||||
if not self.allow_anonymous and not self.allow_authenticated:
|
||||
raise ValueError("At least one enrollment access mode must be enabled")
|
||||
return self
|
||||
|
||||
|
||||
class SchedulingEnrollmentLinkResponse(BaseModel):
|
||||
id: str
|
||||
request_id: str
|
||||
status: Literal["active", "expired", "revoked", "exhausted"]
|
||||
expires_at: datetime
|
||||
max_enrollments: int
|
||||
enrollment_count: int
|
||||
allow_anonymous: bool
|
||||
allow_authenticated: bool
|
||||
created_at: datetime
|
||||
revoked_at: datetime | None = None
|
||||
|
||||
|
||||
class SchedulingEnrollmentLinkListResponse(BaseModel):
|
||||
links: list[SchedulingEnrollmentLinkResponse] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingEnrollmentLinkActionResponse(BaseModel):
|
||||
link: SchedulingEnrollmentLinkResponse
|
||||
action_url: str | None = None
|
||||
replayed: bool = False
|
||||
|
||||
|
||||
class SchedulingPublicEnrollmentAccessRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||
|
||||
|
||||
class SchedulingPublicEnrollmentSubmitRequest(SchedulingAvailabilityResponseRequest):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
display_name: str = Field(min_length=1, max_length=500)
|
||||
email: str | None = Field(default=None, max_length=320)
|
||||
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||
participant_proof: SecretStr = Field(min_length=32, max_length=1024)
|
||||
idempotency_key: str = Field(min_length=1, max_length=255)
|
||||
|
||||
_validate_email = field_validator("email")(_participant_email)
|
||||
|
||||
|
||||
class SchedulingAuthenticatedEnrollmentSubmitRequest(SchedulingAvailabilityResponseRequest):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
display_name: str = Field(min_length=1, max_length=500)
|
||||
email: str | None = Field(default=None, max_length=320)
|
||||
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||
bind_account_confirmed: bool
|
||||
participant_proof: SecretStr | None = Field(default=None, min_length=32, max_length=1024)
|
||||
idempotency_key: str = Field(min_length=1, max_length=255)
|
||||
|
||||
_validate_email = field_validator("email")(_participant_email)
|
||||
|
||||
|
||||
class SchedulingPublicEnrollmentResponse(BaseModel):
|
||||
request_id: str
|
||||
link_id: str
|
||||
title: str
|
||||
description: str | None = None
|
||||
location: str | None = None
|
||||
timezone: str
|
||||
status: str
|
||||
deadline_at: datetime | None = None
|
||||
enrollment_expires_at: datetime
|
||||
enrollment_remaining: int
|
||||
display_name_required: bool = True
|
||||
participant_email_required: bool
|
||||
anonymous_allowed: bool
|
||||
authenticated_allowed: bool
|
||||
anonymous_password_required: bool
|
||||
single_choice: bool
|
||||
max_participants_per_option: int | None = None
|
||||
allow_maybe: bool
|
||||
allow_comments: bool
|
||||
allow_participant_updates: bool
|
||||
enrolled: bool = False
|
||||
account_bound: bool = False
|
||||
has_response: bool = False
|
||||
submitted_at: datetime | None = None
|
||||
answers: list[SchedulingAvailabilityAnswerResponse] = Field(default_factory=list)
|
||||
comment: str | None = None
|
||||
replayed: bool = False
|
||||
slots: list[SchedulingPublicCandidateSlotResponse] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingPollOptionResultResponse(BaseModel):
|
||||
option_id: str
|
||||
option_key: str
|
||||
label: str
|
||||
count: int = 0
|
||||
score: int = 0
|
||||
values: dict[str, int] = Field(default_factory=dict)
|
||||
ranks: dict[int, int] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class SchedulingPollSummaryResponse(BaseModel):
|
||||
poll_id: str
|
||||
kind: str
|
||||
status: str
|
||||
response_count: int
|
||||
option_results: list[SchedulingPollOptionResultResponse] = Field(default_factory=list)
|
||||
leading_option_ids: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingSummaryResponse(BaseModel):
|
||||
request: SchedulingRequestResponse
|
||||
poll_summary: SchedulingPollSummaryResponse
|
||||
|
||||
|
||||
class SchedulingCalendarActionResponse(BaseModel):
|
||||
request: SchedulingRequestResponse
|
||||
created_event_ids: list[str] = Field(default_factory=list)
|
||||
updated_slot_ids: list[str] = Field(default_factory=list)
|
||||
warnings: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingNotificationResponse(BaseModel):
|
||||
id: str
|
||||
request_id: str
|
||||
participant_id: str | None = None
|
||||
event_kind: str
|
||||
channel: str
|
||||
recipient: str | None = None
|
||||
status: str
|
||||
payload: dict[str, Any] = Field(default_factory=dict)
|
||||
error: str | None = None
|
||||
sent_at: datetime | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class SchedulingNotificationListResponse(BaseModel):
|
||||
notifications: list[SchedulingNotificationResponse] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingNotificationCreateRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
event_kind: Literal["invitation", "reminder", "decision", "cancellation"]
|
||||
channel: str = Field(default="mail", max_length=40)
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class SchedulingInvitationActionRequest(BaseModel):
|
||||
"""Explicitly issue one fresh participant-specific participation link."""
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
action: Literal["copy", "send"]
|
||||
participant_revision: str = Field(
|
||||
min_length=64,
|
||||
max_length=64,
|
||||
pattern=r"^[0-9a-f]{64}$",
|
||||
description=(
|
||||
"Semantic revision from the participant management projection; "
|
||||
"stale actions are rejected before rotating or delivering a link."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class SchedulingInvitationRevokeRequest(BaseModel):
|
||||
"""Revoke the link represented by one current participant projection."""
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
participant_revision: str = Field(
|
||||
min_length=64,
|
||||
max_length=64,
|
||||
pattern=r"^[0-9a-f]{64}$",
|
||||
description=(
|
||||
"Semantic revision from the participant management projection; "
|
||||
"stale revocations are rejected before changing access."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class SchedulingInvitationActionResponse(BaseModel):
|
||||
participant_id: str
|
||||
action: Literal["copy", "send", "revoke"]
|
||||
status: str
|
||||
action_url: str | None = None
|
||||
issued_at: datetime | None = None
|
||||
replayed: bool = False
|
||||
notification: SchedulingNotificationResponse | None = None
|
||||
|
||||
|
||||
class SchedulingPeopleSearchCandidate(BaseModel):
|
||||
"""Opaque, task-safe projection of a visible directory candidate."""
|
||||
|
||||
selection_key: str
|
||||
kind: str
|
||||
reference_id: str
|
||||
display_name: str
|
||||
email: str | None = None
|
||||
source_module: str | None = None
|
||||
source_label: str | None = None
|
||||
source_revision: str | None = None
|
||||
description: str | None = None
|
||||
|
||||
|
||||
class SchedulingPeopleSearchGroup(BaseModel):
|
||||
key: str
|
||||
label: str
|
||||
candidates: list[SchedulingPeopleSearchCandidate] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SchedulingPeopleSearchResponse(BaseModel):
|
||||
groups: list[SchedulingPeopleSearchGroup] = Field(default_factory=list)
|
||||
@@ -0,0 +1,84 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import os
|
||||
import secrets
|
||||
|
||||
|
||||
_ALGORITHM = "pbkdf2_sha256"
|
||||
_DEFAULT_ITERATIONS = 260_000
|
||||
_SALT_BYTES = 16
|
||||
|
||||
|
||||
def new_public_credential() -> str:
|
||||
"""Create a URL-safe credential with at least 256 bits of entropy."""
|
||||
|
||||
return secrets.token_urlsafe(32)
|
||||
|
||||
|
||||
def public_credential_hash(value: str) -> str:
|
||||
return hashlib.sha256(value.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def verify_public_credential(value: str, expected_hash: str | None) -> bool:
|
||||
if not expected_hash:
|
||||
return False
|
||||
return hmac.compare_digest(public_credential_hash(value), expected_hash)
|
||||
|
||||
|
||||
def hash_participant_password(
|
||||
password: str,
|
||||
*,
|
||||
iterations: int = _DEFAULT_ITERATIONS,
|
||||
) -> str:
|
||||
"""Hash a public-participant access password for durable storage."""
|
||||
|
||||
salt = os.urandom(_SALT_BYTES)
|
||||
digest = hashlib.pbkdf2_hmac(
|
||||
"sha256",
|
||||
password.encode("utf-8"),
|
||||
salt,
|
||||
iterations,
|
||||
)
|
||||
return "$".join(
|
||||
(
|
||||
_ALGORITHM,
|
||||
str(iterations),
|
||||
base64.b64encode(salt).decode("ascii"),
|
||||
base64.b64encode(digest).decode("ascii"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def verify_participant_password(password: str, encoded: str | None) -> bool:
|
||||
"""Verify a participant password without exposing the stored hash."""
|
||||
|
||||
if not encoded:
|
||||
return False
|
||||
try:
|
||||
algorithm, iterations_text, salt_b64, digest_b64 = encoded.split("$", 3)
|
||||
if algorithm != _ALGORITHM:
|
||||
return False
|
||||
iterations = int(iterations_text)
|
||||
salt = base64.b64decode(salt_b64.encode("ascii"), validate=True)
|
||||
expected = base64.b64decode(digest_b64.encode("ascii"), validate=True)
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
actual = hashlib.pbkdf2_hmac(
|
||||
"sha256",
|
||||
password.encode("utf-8"),
|
||||
salt,
|
||||
iterations,
|
||||
)
|
||||
return hmac.compare_digest(actual, expected)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"hash_participant_password",
|
||||
"new_public_credential",
|
||||
"public_credential_hash",
|
||||
"verify_participant_password",
|
||||
"verify_public_credential",
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,580 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from govoplan_access.backend.db.models import Account, Group, User
|
||||
from govoplan_core.core.change_sequence import ChangeSequenceEntry
|
||||
from govoplan_core.core.dsar import DsarProvider, DsarSubjectRef
|
||||
from govoplan_core.db.base import Base
|
||||
from govoplan_core.privacy.dsar_workflow import (
|
||||
DataSubjectRequest,
|
||||
create_data_subject_request,
|
||||
execute_data_subject_erasure,
|
||||
plan_data_subject_erasure,
|
||||
search_data_subject_request,
|
||||
)
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingNotification,
|
||||
SchedulingParticipant,
|
||||
SchedulingPublicEnrollmentLink,
|
||||
SchedulingRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.dsar_provider import (
|
||||
SCHEDULING_DSAR_CAPABILITY,
|
||||
SchedulingDsarProvider,
|
||||
)
|
||||
from govoplan_scheduling.backend.manifest import manifest
|
||||
|
||||
|
||||
class _Registry:
|
||||
def __init__(
|
||||
self,
|
||||
provider: SchedulingDsarProvider,
|
||||
*,
|
||||
scheduling_active: bool = True,
|
||||
) -> None:
|
||||
self.provider = provider
|
||||
self.scheduling_active = scheduling_active
|
||||
|
||||
def capability_names(self):
|
||||
return (SCHEDULING_DSAR_CAPABILITY,)
|
||||
|
||||
def capability_owner(self, name):
|
||||
self._assert_capability(name)
|
||||
return "scheduling"
|
||||
|
||||
def tenant_entitlement_resolver(self):
|
||||
scheduling_active = self.scheduling_active
|
||||
|
||||
class _Resolver:
|
||||
@staticmethod
|
||||
def resolve(session, tenant_id):
|
||||
del session, tenant_id
|
||||
return type(
|
||||
"State",
|
||||
(),
|
||||
{
|
||||
"effective_modules": (
|
||||
("scheduling",) if scheduling_active else ()
|
||||
)
|
||||
},
|
||||
)()
|
||||
|
||||
return _Resolver()
|
||||
|
||||
def require_tenant_capability(self, name, session, **kwargs):
|
||||
del session, kwargs
|
||||
self._assert_capability(name)
|
||||
return self.provider
|
||||
|
||||
def manifests(self):
|
||||
return (type("Manifest", (), {"id": "scheduling"})(),)
|
||||
|
||||
@staticmethod
|
||||
def _assert_capability(name: str) -> None:
|
||||
if name != SCHEDULING_DSAR_CAPABILITY:
|
||||
raise KeyError(name)
|
||||
|
||||
|
||||
class SchedulingDsarProviderTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.engine = create_engine("sqlite:///:memory:", future=True)
|
||||
Base.metadata.create_all(
|
||||
bind=self.engine,
|
||||
tables=[
|
||||
Account.__table__,
|
||||
User.__table__,
|
||||
Group.__table__,
|
||||
ChangeSequenceEntry.__table__,
|
||||
DataSubjectRequest.__table__,
|
||||
SchedulingRequest.__table__,
|
||||
SchedulingPublicEnrollmentLink.__table__,
|
||||
SchedulingCandidateSlot.__table__,
|
||||
SchedulingParticipant.__table__,
|
||||
SchedulingNotification.__table__,
|
||||
],
|
||||
)
|
||||
self.session = sessionmaker(bind=self.engine, future=True)()
|
||||
now = datetime.now(timezone.utc)
|
||||
account = Account(
|
||||
id="account-1",
|
||||
email="subject@example.test",
|
||||
normalized_email="subject@example.test",
|
||||
display_name="Subject",
|
||||
)
|
||||
other_account = Account(
|
||||
id="account-2",
|
||||
email="other@example.test",
|
||||
normalized_email="other@example.test",
|
||||
display_name="Other",
|
||||
)
|
||||
self.user = User(
|
||||
id="membership-1",
|
||||
tenant_id="tenant-1",
|
||||
account_id=account.id,
|
||||
email="subject@example.test",
|
||||
display_name="Subject",
|
||||
)
|
||||
other_user = User(
|
||||
id="membership-2",
|
||||
tenant_id="tenant-1",
|
||||
account_id=other_account.id,
|
||||
email="other@example.test",
|
||||
display_name="Other",
|
||||
)
|
||||
self.request = SchedulingRequest(
|
||||
id="request-active",
|
||||
tenant_id="tenant-1",
|
||||
title="Choose an appointment",
|
||||
description="Scheduling context visible to the participant",
|
||||
location="Town hall",
|
||||
status="collecting",
|
||||
poll_id="poll-id-do-not-export",
|
||||
organizer_user_id=other_user.id,
|
||||
deadline_at=now + timedelta(days=3),
|
||||
anonymous_password_protection_enabled=True,
|
||||
anonymous_password_hash="password-hash-do-not-export",
|
||||
calendar_integration_enabled=True,
|
||||
calendar_id="calendar-id-do-not-export",
|
||||
calendar_hold_enabled=True,
|
||||
calendar_event_id="calendar-event-id-do-not-export",
|
||||
metadata_={"secret": "request-metadata-do-not-export"},
|
||||
)
|
||||
slot = SchedulingCandidateSlot(
|
||||
id="slot-subject",
|
||||
tenant_id="tenant-1",
|
||||
request_id=self.request.id,
|
||||
poll_option_id="poll-option-id-do-not-export",
|
||||
label="Tuesday morning",
|
||||
description="First option",
|
||||
start_at=now + timedelta(days=1),
|
||||
end_at=now + timedelta(days=1, hours=1),
|
||||
timezone="Europe/Berlin",
|
||||
location="Town hall",
|
||||
position=0,
|
||||
freebusy_checked_at=now,
|
||||
freebusy_status="busy",
|
||||
freebusy_conflicts=[{"person": "Unrelated conflict person do not export"}],
|
||||
tentative_hold_event_id="hold-event-id-do-not-export",
|
||||
metadata_={"secret": "slot-metadata-do-not-export"},
|
||||
)
|
||||
self.engaged = SchedulingParticipant(
|
||||
id="participant-engaged",
|
||||
tenant_id="tenant-1",
|
||||
request_id=self.request.id,
|
||||
respondent_id=self.user.id,
|
||||
display_name="Subject Person",
|
||||
email="Subject@Example.Test",
|
||||
participant_type="internal",
|
||||
required=True,
|
||||
status="responded",
|
||||
poll_invitation_id="poll-invitation-id-do-not-export",
|
||||
participation_gateway="public-gateway-do-not-export",
|
||||
self_enrollment_proof_hash="proof-hash-do-not-export",
|
||||
bound_account_id=account.id,
|
||||
account_bound_at=now,
|
||||
last_invited_at=now,
|
||||
responded_at=now,
|
||||
response_comment="Subject response comment",
|
||||
metadata_={"secret": "participant-metadata-do-not-export"},
|
||||
)
|
||||
self.unengaged = SchedulingParticipant(
|
||||
id="participant-unengaged",
|
||||
tenant_id="tenant-1",
|
||||
request_id=self.request.id,
|
||||
respondent_id=self.user.id,
|
||||
display_name="Subject duplicate draft",
|
||||
email=None,
|
||||
participant_type="external",
|
||||
required=False,
|
||||
status="draft",
|
||||
metadata_={"directory": "internal-directory-data-do-not-export"},
|
||||
)
|
||||
unrelated = SchedulingParticipant(
|
||||
id="participant-other",
|
||||
tenant_id="tenant-1",
|
||||
request_id=self.request.id,
|
||||
respondent_id=other_user.id,
|
||||
display_name="Unrelated Person",
|
||||
email="other@example.test",
|
||||
status="responded",
|
||||
poll_invitation_id="other-invitation-do-not-export",
|
||||
responded_at=now,
|
||||
response_comment="Unrelated response do not export",
|
||||
)
|
||||
notification = SchedulingNotification(
|
||||
id="notification-subject",
|
||||
tenant_id="tenant-1",
|
||||
request_id=self.request.id,
|
||||
participant_id=self.engaged.id,
|
||||
event_kind="invitation",
|
||||
channel="mail",
|
||||
recipient="subject@example.test",
|
||||
status="sent",
|
||||
payload={
|
||||
"private": "notification-payload-do-not-export",
|
||||
"token": "notification-token-do-not-export",
|
||||
},
|
||||
error="notification-error-do-not-export",
|
||||
sent_at=now,
|
||||
metadata_={"secret": "notification-metadata-do-not-export"},
|
||||
)
|
||||
unrelated_notification = SchedulingNotification(
|
||||
id="notification-other",
|
||||
tenant_id="tenant-1",
|
||||
request_id=self.request.id,
|
||||
participant_id=unrelated.id,
|
||||
event_kind="decision",
|
||||
channel="mail",
|
||||
recipient="other@example.test",
|
||||
status="sent",
|
||||
payload={"private": "other-notification-do-not-export"},
|
||||
sent_at=now,
|
||||
)
|
||||
organizer_request = SchedulingRequest(
|
||||
id="request-organized",
|
||||
tenant_id="tenant-1",
|
||||
title="Subject organized meeting",
|
||||
status="draft",
|
||||
poll_id="organizer-poll-do-not-export",
|
||||
organizer_user_id=self.user.id,
|
||||
)
|
||||
organizer_slot = SchedulingCandidateSlot(
|
||||
id="slot-organized",
|
||||
tenant_id="tenant-1",
|
||||
request_id=organizer_request.id,
|
||||
label="Organizer option",
|
||||
start_at=now + timedelta(days=2),
|
||||
end_at=now + timedelta(days=2, hours=1),
|
||||
)
|
||||
organizer_other_participant = SchedulingParticipant(
|
||||
id="participant-organizer-other",
|
||||
tenant_id="tenant-1",
|
||||
request_id=organizer_request.id,
|
||||
display_name="Organizer unrelated invitee do not export",
|
||||
email="organizer-other@example.test",
|
||||
status="draft",
|
||||
)
|
||||
unrelated_request = SchedulingRequest(
|
||||
id="request-other",
|
||||
tenant_id="tenant-1",
|
||||
title="Unrelated request do not export",
|
||||
status="collecting",
|
||||
poll_id="unrelated-poll-do-not-export",
|
||||
organizer_user_id=other_user.id,
|
||||
)
|
||||
tenant_two_request = SchedulingRequest(
|
||||
id="request-tenant-2",
|
||||
tenant_id="tenant-2",
|
||||
title="Tenant two request do not export",
|
||||
status="collecting",
|
||||
poll_id="tenant-two-poll-do-not-export",
|
||||
)
|
||||
tenant_two_participant = SchedulingParticipant(
|
||||
id="participant-tenant-2",
|
||||
tenant_id="tenant-2",
|
||||
request_id=tenant_two_request.id,
|
||||
display_name="Tenant two subject",
|
||||
email="subject@example.test",
|
||||
status="draft",
|
||||
)
|
||||
self.session.add_all(
|
||||
[
|
||||
account,
|
||||
other_account,
|
||||
self.user,
|
||||
other_user,
|
||||
self.request,
|
||||
slot,
|
||||
self.engaged,
|
||||
self.unengaged,
|
||||
unrelated,
|
||||
notification,
|
||||
unrelated_notification,
|
||||
organizer_request,
|
||||
organizer_slot,
|
||||
organizer_other_participant,
|
||||
unrelated_request,
|
||||
tenant_two_request,
|
||||
tenant_two_participant,
|
||||
]
|
||||
)
|
||||
self.session.commit()
|
||||
self.provider = SchedulingDsarProvider()
|
||||
self.subject = DsarSubjectRef(
|
||||
account_id=account.id,
|
||||
membership_id=self.user.id,
|
||||
email="subject@example.test",
|
||||
)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.session.close()
|
||||
self.engine.dispose()
|
||||
|
||||
def test_manifest_publishes_protocol_conforming_provider(self) -> None:
|
||||
provided_names = {item.name for item in manifest.provides_interfaces}
|
||||
self.assertIn(SCHEDULING_DSAR_CAPABILITY, provided_names)
|
||||
provider = manifest.capability_factories[SCHEDULING_DSAR_CAPABILITY](None)
|
||||
self.assertIsInstance(provider, DsarProvider)
|
||||
self.assertIn(
|
||||
"scheduling.privacy.data-subject-requests",
|
||||
{topic.id for topic in manifest.documentation},
|
||||
)
|
||||
|
||||
def test_search_is_tenant_scoped_minimized_and_participant_specific(self) -> None:
|
||||
records = self._records()
|
||||
resource_types = {record.resource_type for record in records}
|
||||
self.assertTrue(
|
||||
{
|
||||
"scheduling_request",
|
||||
"scheduling_candidate_slot",
|
||||
"scheduling_participant",
|
||||
"scheduling_notification",
|
||||
}.issubset(resource_types)
|
||||
)
|
||||
self.assertEqual(
|
||||
{"participant-engaged", "participant-unengaged"},
|
||||
{
|
||||
record.resource_id
|
||||
for record in records
|
||||
if record.resource_type == "scheduling_participant"
|
||||
},
|
||||
)
|
||||
engaged = next(
|
||||
record for record in records if record.resource_id == "participant-engaged"
|
||||
)
|
||||
self.assertEqual("Subject response comment", engaged.data["response_comment"])
|
||||
|
||||
serialized = repr([record.to_dict() for record in records])
|
||||
for hidden in (
|
||||
"participant-other",
|
||||
"Unrelated Person",
|
||||
"other@example.test",
|
||||
"Unrelated response do not export",
|
||||
"notification-other",
|
||||
"other-notification-do-not-export",
|
||||
"participant-organizer-other",
|
||||
"Organizer unrelated invitee do not export",
|
||||
"request-other",
|
||||
"Unrelated request do not export",
|
||||
"request-tenant-2",
|
||||
"Tenant two request do not export",
|
||||
"participant-tenant-2",
|
||||
"poll-id-do-not-export",
|
||||
"password-hash-do-not-export",
|
||||
"calendar-id-do-not-export",
|
||||
"calendar-event-id-do-not-export",
|
||||
"request-metadata-do-not-export",
|
||||
"poll-option-id-do-not-export",
|
||||
"Unrelated conflict person do not export",
|
||||
"hold-event-id-do-not-export",
|
||||
"slot-metadata-do-not-export",
|
||||
"poll-invitation-id-do-not-export",
|
||||
"public-gateway-do-not-export",
|
||||
"proof-hash-do-not-export",
|
||||
"participant-metadata-do-not-export",
|
||||
"internal-directory-data-do-not-export",
|
||||
"notification-payload-do-not-export",
|
||||
"notification-token-do-not-export",
|
||||
"notification-error-do-not-export",
|
||||
"notification-metadata-do-not-export",
|
||||
"organizer-poll-do-not-export",
|
||||
):
|
||||
self.assertNotIn(hidden, serialized)
|
||||
|
||||
def test_conflicting_email_references_fail_closed_for_participant_data(
|
||||
self,
|
||||
) -> None:
|
||||
records = self.provider.search_subject(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
subject=DsarSubjectRef(
|
||||
email="subject@example.test",
|
||||
external_references={"scheduling.email": "other@example.test"},
|
||||
),
|
||||
)
|
||||
|
||||
self.assertEqual((), records)
|
||||
|
||||
def test_plan_retains_evidence_and_only_anonymizes_unengaged_participant(
|
||||
self,
|
||||
) -> None:
|
||||
actions = self.provider.plan_erasure(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
subject=self.subject,
|
||||
records=self._records(),
|
||||
)
|
||||
|
||||
self.assertTrue({"retain", "manual_review"}.issubset({a.kind for a in actions}))
|
||||
self.assertTrue(
|
||||
any(
|
||||
action.action_id
|
||||
== "scheduling:retain:scheduling_participant:participant-engaged"
|
||||
for action in actions
|
||||
)
|
||||
)
|
||||
self.assertEqual(
|
||||
{"scheduling:anonymize:scheduling_participant:participant-unengaged"},
|
||||
{action.action_id for action in actions if action.executable},
|
||||
)
|
||||
|
||||
def test_execution_is_revalidated_tenant_bound_and_idempotent(self) -> None:
|
||||
action = self._anonymize_action()
|
||||
wrong_tenant = self.provider.execute_erasure(
|
||||
self.session,
|
||||
tenant_id="tenant-2",
|
||||
subject=self.subject,
|
||||
actions=(action,),
|
||||
request_id="dsar-wrong-tenant",
|
||||
)
|
||||
self.assertEqual("blocked", wrong_tenant[0].status)
|
||||
|
||||
first = self.provider.execute_erasure(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
subject=self.subject,
|
||||
actions=(action,),
|
||||
request_id="dsar-scheduling-1",
|
||||
)
|
||||
self.assertEqual("executed", first[0].status)
|
||||
self.session.flush()
|
||||
self.assertEqual("removed", self.unengaged.status)
|
||||
self.assertIsNotNone(self.unengaged.deleted_at)
|
||||
self.assertIsNone(self.unengaged.display_name)
|
||||
self.assertIsNone(self.unengaged.email)
|
||||
self.assertIsNone(self.unengaged.respondent_id)
|
||||
self.assertIsNone(self.unengaged.metadata_)
|
||||
|
||||
repeated = self.provider.execute_erasure(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
subject=self.subject,
|
||||
actions=(action,),
|
||||
request_id="dsar-scheduling-1",
|
||||
)
|
||||
self.assertEqual("unchanged", repeated[0].status)
|
||||
|
||||
def test_execution_blocks_when_evidence_appears_after_planning(self) -> None:
|
||||
action = self._anonymize_action()
|
||||
self.session.add(
|
||||
SchedulingNotification(
|
||||
id="notification-late",
|
||||
tenant_id="tenant-1",
|
||||
request_id=self.request.id,
|
||||
participant_id=self.unengaged.id,
|
||||
event_kind="invitation",
|
||||
recipient=self.unengaged.email,
|
||||
status="pending",
|
||||
payload={},
|
||||
)
|
||||
)
|
||||
self.session.flush()
|
||||
|
||||
result = self.provider.execute_erasure(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
subject=self.subject,
|
||||
actions=(action,),
|
||||
request_id="dsar-stale",
|
||||
)
|
||||
|
||||
self.assertEqual("blocked", result[0].status)
|
||||
self.assertIsNone(self.unengaged.deleted_at)
|
||||
|
||||
def test_core_workflow_discovers_active_provider_and_skips_it_when_disabled(
|
||||
self,
|
||||
) -> None:
|
||||
request = create_data_subject_request(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
reference="DSAR-SCHEDULING-1",
|
||||
request_kind="access_and_erasure",
|
||||
subject=self.subject,
|
||||
purpose="Respond to an authorized privacy request.",
|
||||
legal_basis="Article 15 and 17 GDPR",
|
||||
due_at=None,
|
||||
requested_by_account_id="privacy-officer",
|
||||
)
|
||||
self.session.commit()
|
||||
registry = _Registry(self.provider)
|
||||
|
||||
search_data_subject_request(
|
||||
self.session,
|
||||
registry=registry,
|
||||
row=request,
|
||||
expected_revision=1,
|
||||
)
|
||||
self.assertEqual("searched", request.status)
|
||||
self.assertEqual(["scheduling"], request.coverage["covered_modules"])
|
||||
plan_data_subject_erasure(
|
||||
self.session,
|
||||
registry=registry,
|
||||
row=request,
|
||||
expected_revision=2,
|
||||
)
|
||||
executable_ids = [
|
||||
action["action_id"]
|
||||
for action in request.erasure_plan["actions"]
|
||||
if action["executable"]
|
||||
]
|
||||
execute_data_subject_erasure(
|
||||
self.session,
|
||||
registry=registry,
|
||||
row=request,
|
||||
expected_revision=3,
|
||||
action_ids=executable_ids,
|
||||
)
|
||||
self.assertEqual("completed", request.status)
|
||||
|
||||
disabled = create_data_subject_request(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
reference="DSAR-SCHEDULING-DISABLED",
|
||||
request_kind="access",
|
||||
subject=self.subject,
|
||||
purpose="Verify disabled-module coverage.",
|
||||
legal_basis="Article 15 GDPR",
|
||||
due_at=None,
|
||||
requested_by_account_id="privacy-officer",
|
||||
)
|
||||
search_data_subject_request(
|
||||
self.session,
|
||||
registry=_Registry(self.provider, scheduling_active=False),
|
||||
row=disabled,
|
||||
expected_revision=1,
|
||||
)
|
||||
|
||||
self.assertEqual(0, disabled.search_result["record_count"])
|
||||
self.assertEqual(
|
||||
[SCHEDULING_DSAR_CAPABILITY],
|
||||
disabled.coverage["inactive_provider_capabilities"],
|
||||
)
|
||||
|
||||
def _records(self):
|
||||
return self.provider.search_subject(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
subject=self.subject,
|
||||
)
|
||||
|
||||
def _anonymize_action(self):
|
||||
return next(
|
||||
action
|
||||
for action in self.provider.plan_erasure(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
subject=self.subject,
|
||||
records=self._records(),
|
||||
)
|
||||
if action.executable
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,121 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from govoplan_core.core.modules import ModuleManifest
|
||||
from govoplan_scheduling.backend.manifest import get_manifest
|
||||
|
||||
|
||||
class SchedulingManifestTests(unittest.TestCase):
|
||||
def test_all_static_topics_have_complete_german_content(self) -> None:
|
||||
manifest = get_manifest()
|
||||
for topic in manifest.documentation:
|
||||
german = (topic.translations or {}).get("de", {})
|
||||
self.assertEqual(
|
||||
{"title", "summary", "body"},
|
||||
set(german),
|
||||
topic.id,
|
||||
)
|
||||
self.assertTrue(
|
||||
all(str(value).strip() for value in german.values()), topic.id
|
||||
)
|
||||
|
||||
def test_manifest_contract(self) -> None:
|
||||
manifest = get_manifest()
|
||||
|
||||
self.assertIsInstance(manifest, ModuleManifest)
|
||||
self.assertEqual(manifest.id, "scheduling")
|
||||
self.assertIn("poll", manifest.dependencies)
|
||||
self.assertNotIn("access", manifest.dependencies)
|
||||
self.assertIn("access", manifest.optional_dependencies)
|
||||
self.assertIn("addresses", manifest.optional_dependencies)
|
||||
self.assertIn("policy", manifest.optional_dependencies)
|
||||
self.assertEqual(
|
||||
("poll.scheduling", "poll.participation_gateway"),
|
||||
manifest.required_capabilities,
|
||||
)
|
||||
self.assertIn("auth.principalResolver", manifest.optional_capabilities)
|
||||
self.assertIn("poll.scheduling", manifest.required_capabilities)
|
||||
self.assertIn("calendar.scheduling", manifest.optional_capabilities)
|
||||
self.assertIn(
|
||||
"policy.schedulingParticipantPrivacy", manifest.optional_capabilities
|
||||
)
|
||||
self.assertIn("access.people_search", manifest.optional_capabilities)
|
||||
self.assertIn("addresses.people_search", manifest.optional_capabilities)
|
||||
self.assertIn("evaluation", manifest.optional_dependencies)
|
||||
self.assertIsNotNone(manifest.route_factory)
|
||||
self.assertIsNotNone(manifest.public_tenant_resolver)
|
||||
self.assertIsNotNone(manifest.migration_spec)
|
||||
self.assertIsNotNone(manifest.frontend)
|
||||
self.assertEqual(
|
||||
[
|
||||
"/scheduling/public/:requestId/:token",
|
||||
"/scheduling/enrol/:requestId/:token",
|
||||
],
|
||||
[route.path for route in manifest.frontend.public_routes],
|
||||
)
|
||||
self.assertIn(
|
||||
"poll.availability_matrix",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
self.assertIn(
|
||||
"poll.response_collection",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
self.assertIn(
|
||||
"poll.workflow_context",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
self.assertIn(
|
||||
"poll.governed_participation",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
self.assertIn(
|
||||
"notifications.dispatch",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
self.assertIn(
|
||||
"access.people_search",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
self.assertIn(
|
||||
"addresses.people_search",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
self.assertIn(
|
||||
"calendar.scheduling",
|
||||
{interface.name for interface in manifest.requires_interfaces},
|
||||
)
|
||||
required_interfaces = {
|
||||
interface.name: interface for interface in manifest.requires_interfaces
|
||||
}
|
||||
for interface_name in (
|
||||
"poll.availability_matrix",
|
||||
"poll.response_collection",
|
||||
"poll.workflow_context",
|
||||
"poll.governed_participation",
|
||||
):
|
||||
self.assertEqual("0.1.11", required_interfaces[interface_name].version_min)
|
||||
|
||||
documentation = {topic.id: topic for topic in manifest.documentation}
|
||||
workflow = documentation["scheduling.find-and-decide-meeting-time"]
|
||||
self.assertEqual("workflow", workflow.metadata["kind"])
|
||||
self.assertEqual("/scheduling", workflow.metadata["route"])
|
||||
self.assertIn("scheduling.request", workflow.metadata["help_contexts"])
|
||||
self.assertIn(
|
||||
"scheduling.public-participation", workflow.metadata["help_contexts"]
|
||||
)
|
||||
self.assertIn(
|
||||
"scheduling.calendar-coordination",
|
||||
documentation["scheduling.calendar-coordination"].metadata["help_contexts"],
|
||||
)
|
||||
self.assertIn(
|
||||
"scheduling.public-self-enrollment",
|
||||
documentation["scheduling.public-self-enrollment"].metadata[
|
||||
"help_contexts"
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,378 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from alembic.runtime.migration import MigrationContext
|
||||
from sqlalchemy import create_engine, func, inspect, select, text
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from govoplan_core.db.migrations import migrate_database
|
||||
from govoplan_poll.backend.manifest import get_manifest as get_poll_manifest
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingNotification,
|
||||
SchedulingParticipant,
|
||||
SchedulingRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.manifest import get_manifest as get_scheduling_manifest
|
||||
|
||||
|
||||
_SCHEDULING_HEAD = "d7a4c1e8f205"
|
||||
_SCHEDULING_RESPONSE_SETTINGS_REVISION = "ad7e3c9b2f10"
|
||||
_ENABLED_MODULES = ("poll", "scheduling")
|
||||
_MANIFEST_FACTORIES = (get_poll_manifest, get_scheduling_manifest)
|
||||
|
||||
|
||||
class SchedulingMigrationTests(unittest.TestCase):
|
||||
def _migrate(self, url: str) -> None:
|
||||
migrate_database(
|
||||
database_url=url,
|
||||
enabled_modules=_ENABLED_MODULES,
|
||||
manifest_factories=_MANIFEST_FACTORIES,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _remove_scheduling_revision(
|
||||
connection, *, remove_privacy_column: bool = True
|
||||
) -> None:
|
||||
connection.execute(
|
||||
text("DELETE FROM alembic_version WHERE version_num = :revision"),
|
||||
{"revision": _SCHEDULING_HEAD},
|
||||
)
|
||||
if remove_privacy_column:
|
||||
connection.execute(
|
||||
text(
|
||||
"ALTER TABLE scheduling_requests DROP COLUMN participant_visibility"
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _seed_scheduling_rows(engine) -> None:
|
||||
with Session(engine) as session:
|
||||
request = SchedulingRequest(
|
||||
id="request-1",
|
||||
tenant_id="tenant-1",
|
||||
title="Migration adoption probe",
|
||||
)
|
||||
request.slots.append(
|
||||
SchedulingCandidateSlot(
|
||||
id="slot-1",
|
||||
tenant_id="tenant-1",
|
||||
label="First slot",
|
||||
start_at=datetime(2026, 7, 21, 8, 0),
|
||||
end_at=datetime(2026, 7, 21, 9, 0),
|
||||
)
|
||||
)
|
||||
request.participants.append(
|
||||
SchedulingParticipant(
|
||||
id="participant-1",
|
||||
tenant_id="tenant-1",
|
||||
display_name="Ada",
|
||||
email="ada@example.test",
|
||||
)
|
||||
)
|
||||
session.add(request)
|
||||
session.flush()
|
||||
session.add(
|
||||
SchedulingNotification(
|
||||
id="notification-1",
|
||||
tenant_id="tenant-1",
|
||||
request_id=request.id,
|
||||
event_kind="invitation",
|
||||
recipient="ada@example.test",
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
|
||||
def test_adopts_complete_unversioned_v018_schema_and_preserves_rows(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-scheduling-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'scheduling.db'}"
|
||||
self._migrate(url)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
self._seed_scheduling_rows(engine)
|
||||
with engine.begin() as connection:
|
||||
self._remove_scheduling_revision(connection)
|
||||
|
||||
self._migrate(url)
|
||||
|
||||
with engine.connect() as connection:
|
||||
heads = set(
|
||||
MigrationContext.configure(connection).get_current_heads()
|
||||
)
|
||||
columns = {
|
||||
item["name"]
|
||||
for item in inspect(connection).get_columns(
|
||||
"scheduling_requests"
|
||||
)
|
||||
}
|
||||
participant_columns = {
|
||||
item["name"]
|
||||
for item in inspect(connection).get_columns(
|
||||
"scheduling_participants"
|
||||
)
|
||||
}
|
||||
visibility = connection.execute(
|
||||
text(
|
||||
"SELECT participant_visibility FROM scheduling_requests "
|
||||
"WHERE id = 'request-1'"
|
||||
)
|
||||
).scalar_one()
|
||||
response_defaults = connection.execute(
|
||||
text(
|
||||
"SELECT notify_on_answers, single_choice, "
|
||||
"max_participants_per_option, allow_maybe, allow_comments, "
|
||||
"participant_email_required, anonymous_password_protection_enabled, "
|
||||
"anonymous_password_hash FROM scheduling_requests "
|
||||
"WHERE id = 'request-1'"
|
||||
)
|
||||
).one()
|
||||
counts = {
|
||||
model.__tablename__: connection.execute(
|
||||
select(func.count()).select_from(model)
|
||||
).scalar_one()
|
||||
for model in (
|
||||
SchedulingRequest,
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingParticipant,
|
||||
SchedulingNotification,
|
||||
)
|
||||
}
|
||||
|
||||
self.assertIn(_SCHEDULING_HEAD, heads)
|
||||
self.assertIn("participant_visibility", columns)
|
||||
self.assertIn("cancellation_notice_until", columns)
|
||||
self.assertIn("max_participants_per_option", columns)
|
||||
self.assertIn("response_comment", participant_columns)
|
||||
self.assertIn("participation_gateway", participant_columns)
|
||||
self.assertIn("self_enrollment_link_id", participant_columns)
|
||||
self.assertIn("self_enrollment_proof_hash", participant_columns)
|
||||
self.assertIn("bound_account_id", participant_columns)
|
||||
self.assertIn("account_bound_at", participant_columns)
|
||||
self.assertIn(
|
||||
"scheduling_public_enrollment_links",
|
||||
inspect(engine).get_table_names(),
|
||||
)
|
||||
self.assertEqual(visibility, "aggregates_only")
|
||||
self.assertEqual(tuple(response_defaults), (1, 0, None, 1, 0, 0, 0, None))
|
||||
self.assertEqual(set(counts.values()), {1})
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
def test_adopts_already_present_compatible_privacy_column(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-scheduling-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'scheduling.db'}"
|
||||
self._migrate(url)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
self._remove_scheduling_revision(
|
||||
connection, remove_privacy_column=False
|
||||
)
|
||||
|
||||
self._migrate(url)
|
||||
|
||||
with engine.connect() as connection:
|
||||
heads = set(
|
||||
MigrationContext.configure(connection).get_current_heads()
|
||||
)
|
||||
matching_columns = [
|
||||
item
|
||||
for item in inspect(connection).get_columns(
|
||||
"scheduling_requests"
|
||||
)
|
||||
if item["name"] == "participant_visibility"
|
||||
]
|
||||
|
||||
self.assertIn(_SCHEDULING_HEAD, heads)
|
||||
self.assertEqual(len(matching_columns), 1)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
def test_rejects_incomplete_existing_baseline(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-scheduling-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'scheduling.db'}"
|
||||
self._migrate(url)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
self._remove_scheduling_revision(connection)
|
||||
connection.execute(text("DROP INDEX ix_scheduling_requests_status"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
"scheduling_requests missing indexes: ix_scheduling_requests_status",
|
||||
):
|
||||
self._migrate(url)
|
||||
|
||||
with engine.connect() as connection:
|
||||
heads = set(
|
||||
MigrationContext.configure(connection).get_current_heads()
|
||||
)
|
||||
self.assertNotIn(_SCHEDULING_HEAD, heads)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
def test_rejects_partial_existing_calendar_extension(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-scheduling-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'scheduling.db'}"
|
||||
self._migrate(url)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
self._remove_scheduling_revision(connection)
|
||||
connection.execute(text("DROP TABLE scheduling_notifications"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
"missing table: scheduling_notifications",
|
||||
):
|
||||
self._migrate(url)
|
||||
|
||||
with engine.connect() as connection:
|
||||
heads = set(
|
||||
MigrationContext.configure(connection).get_current_heads()
|
||||
)
|
||||
self.assertNotIn(_SCHEDULING_HEAD, heads)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
def test_rejects_partial_existing_response_settings(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-scheduling-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'scheduling.db'}"
|
||||
self._migrate(url)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
self._remove_scheduling_revision(
|
||||
connection,
|
||||
remove_privacy_column=False,
|
||||
)
|
||||
connection.execute(
|
||||
text(
|
||||
"ALTER TABLE scheduling_requests "
|
||||
"DROP COLUMN allow_comments"
|
||||
)
|
||||
)
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
"partial scheduling_requests scheduling response settings",
|
||||
):
|
||||
self._migrate(url)
|
||||
|
||||
with engine.connect() as connection:
|
||||
heads = set(
|
||||
MigrationContext.configure(connection).get_current_heads()
|
||||
)
|
||||
self.assertNotIn(_SCHEDULING_HEAD, heads)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
def test_rejects_partial_existing_participant_response_settings(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-scheduling-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'scheduling.db'}"
|
||||
self._migrate(url)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
self._remove_scheduling_revision(
|
||||
connection,
|
||||
remove_privacy_column=False,
|
||||
)
|
||||
connection.execute(
|
||||
text(
|
||||
"ALTER TABLE scheduling_participants "
|
||||
"DROP COLUMN participation_gateway"
|
||||
)
|
||||
)
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
"partial scheduling_participants scheduling response settings",
|
||||
):
|
||||
self._migrate(url)
|
||||
|
||||
with engine.connect() as connection:
|
||||
heads = set(
|
||||
MigrationContext.configure(connection).get_current_heads()
|
||||
)
|
||||
self.assertNotIn(_SCHEDULING_HEAD, heads)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
def test_repairs_missing_participation_gateway_after_previous_head_was_stamped(self) -> None:
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="govoplan-scheduling-migration-"
|
||||
) as directory:
|
||||
url = f"sqlite:///{Path(directory) / 'scheduling.db'}"
|
||||
self._migrate(url)
|
||||
engine = create_engine(url)
|
||||
try:
|
||||
self._seed_scheduling_rows(engine)
|
||||
with engine.begin() as connection:
|
||||
connection.execute(
|
||||
text(
|
||||
"DELETE FROM alembic_version WHERE version_num = :revision"
|
||||
),
|
||||
{"revision": _SCHEDULING_HEAD},
|
||||
)
|
||||
connection.execute(
|
||||
text(
|
||||
"INSERT INTO alembic_version (version_num) VALUES (:revision)"
|
||||
),
|
||||
{"revision": _SCHEDULING_RESPONSE_SETTINGS_REVISION},
|
||||
)
|
||||
connection.execute(
|
||||
text(
|
||||
"ALTER TABLE scheduling_participants "
|
||||
"DROP COLUMN participation_gateway"
|
||||
)
|
||||
)
|
||||
|
||||
self._migrate(url)
|
||||
|
||||
with engine.connect() as connection:
|
||||
heads = set(
|
||||
MigrationContext.configure(connection).get_current_heads()
|
||||
)
|
||||
participant_columns = {
|
||||
item["name"]
|
||||
for item in inspect(connection).get_columns(
|
||||
"scheduling_participants"
|
||||
)
|
||||
}
|
||||
participant = connection.execute(
|
||||
text(
|
||||
"SELECT display_name, email, participation_gateway "
|
||||
"FROM scheduling_participants WHERE id = 'participant-1'"
|
||||
)
|
||||
).one()
|
||||
|
||||
self.assertIn(_SCHEDULING_HEAD, heads)
|
||||
self.assertIn("participation_gateway", participant_columns)
|
||||
self.assertEqual(
|
||||
tuple(participant),
|
||||
("Ada", "ada@example.test", None),
|
||||
)
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,35 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
import pathlib
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class SchedulingModuleBoundaryTests(unittest.TestCase):
|
||||
def test_runtime_source_does_not_import_poll_implementation_internals(self) -> None:
|
||||
offenders: list[str] = []
|
||||
source_root = ROOT / "src" / "govoplan_scheduling"
|
||||
for path in source_root.rglob("*.py"):
|
||||
tree = ast.parse(path.read_text(encoding="utf-8"))
|
||||
imported_modules = [
|
||||
node.module
|
||||
for node in ast.walk(tree)
|
||||
if isinstance(node, ast.ImportFrom) and node.module is not None
|
||||
]
|
||||
imported_modules.extend(
|
||||
alias.name
|
||||
for node in ast.walk(tree)
|
||||
if isinstance(node, ast.Import)
|
||||
for alias in node.names
|
||||
)
|
||||
if any(module.startswith("govoplan_poll") for module in imported_modules):
|
||||
offenders.append(str(path.relative_to(ROOT)))
|
||||
|
||||
self.assertEqual([], offenders)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,354 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from datetime import datetime, timezone
|
||||
from unittest.mock import patch
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
|
||||
from govoplan_core.core.modules import ModuleContext, ModuleManifest
|
||||
from govoplan_core.core.policy import (
|
||||
CAPABILITY_POLICY_SCHEDULING_PARTICIPANT_PRIVACY,
|
||||
PolicySourceStep,
|
||||
SchedulingParticipantPrivacyDecision,
|
||||
SchedulingParticipantPrivacyRequest,
|
||||
)
|
||||
from govoplan_core.core.registry import PlatformRegistry
|
||||
from govoplan_core.db.base import Base
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingParticipant,
|
||||
SchedulingRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.runtime import configure_runtime
|
||||
from govoplan_scheduling.backend.schemas import (
|
||||
SchedulingCandidateSlotInput,
|
||||
SchedulingRequestCreateRequest,
|
||||
SchedulingRequestResponse,
|
||||
SchedulingRequestUpdateRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.service import scheduling_request_response
|
||||
|
||||
|
||||
class _PrivacyPolicy:
|
||||
def __init__(self, effective_visibility: str) -> None:
|
||||
self.effective_visibility = effective_visibility
|
||||
self.requests: list[SchedulingParticipantPrivacyRequest] = []
|
||||
|
||||
def resolve_scheduling_participant_visibility(
|
||||
self,
|
||||
session: object,
|
||||
*,
|
||||
request: SchedulingParticipantPrivacyRequest,
|
||||
) -> SchedulingParticipantPrivacyDecision:
|
||||
self.requests.append(request)
|
||||
return SchedulingParticipantPrivacyDecision(
|
||||
effective_visibility=self.effective_visibility, # type: ignore[arg-type]
|
||||
reason="Tenant participant privacy policy",
|
||||
source_path=(
|
||||
PolicySourceStep(
|
||||
scope_type="tenant",
|
||||
scope_id=request.tenant_id,
|
||||
label="Tenant",
|
||||
applied_fields=("scheduling_participant_visibility",),
|
||||
),
|
||||
),
|
||||
details={"provider_session_available": session is not None},
|
||||
)
|
||||
|
||||
|
||||
class SchedulingParticipantPrivacyTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
configure_runtime(registry=PlatformRegistry())
|
||||
self.engine = create_engine("sqlite:///:memory:")
|
||||
Base.metadata.create_all(
|
||||
self.engine,
|
||||
tables=[
|
||||
SchedulingRequest.__table__,
|
||||
SchedulingCandidateSlot.__table__,
|
||||
SchedulingParticipant.__table__,
|
||||
],
|
||||
)
|
||||
self.Session = sessionmaker(bind=self.engine)
|
||||
self.session: Session = self.Session()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.session.close()
|
||||
Base.metadata.drop_all(
|
||||
self.engine,
|
||||
tables=[
|
||||
SchedulingParticipant.__table__,
|
||||
SchedulingCandidateSlot.__table__,
|
||||
SchedulingRequest.__table__,
|
||||
],
|
||||
)
|
||||
self.engine.dispose()
|
||||
configure_runtime(registry=PlatformRegistry())
|
||||
|
||||
def _request(self, *, participant_visibility: str | None = None) -> SchedulingRequest:
|
||||
values = {
|
||||
"tenant_id": "tenant-1",
|
||||
"title": "Privacy review",
|
||||
"status": "collecting",
|
||||
"poll_id": "poll-internal",
|
||||
"organizer_user_id": "organizer-1",
|
||||
"calendar_integration_enabled": True,
|
||||
"calendar_id": "calendar-internal",
|
||||
"calendar_freebusy_enabled": True,
|
||||
"calendar_hold_enabled": True,
|
||||
"create_calendar_event_on_decision": True,
|
||||
"calendar_event_id": "event-internal",
|
||||
"metadata_": {"connector_secret_ref": "secret-internal"},
|
||||
}
|
||||
if participant_visibility is not None:
|
||||
values["participant_visibility"] = participant_visibility
|
||||
request = SchedulingRequest(**values)
|
||||
request.slots = [
|
||||
SchedulingCandidateSlot(
|
||||
tenant_id="tenant-1",
|
||||
poll_option_id="poll-option-internal",
|
||||
label="Monday morning",
|
||||
start_at=datetime(2026, 7, 27, 9, tzinfo=timezone.utc),
|
||||
end_at=datetime(2026, 7, 27, 10, tzinfo=timezone.utc),
|
||||
timezone="Europe/Berlin",
|
||||
position=0,
|
||||
freebusy_checked_at=datetime(2026, 7, 21, 12, tzinfo=timezone.utc),
|
||||
freebusy_status="busy",
|
||||
freebusy_conflicts=[
|
||||
{
|
||||
"calendar_id": "calendar-internal",
|
||||
"event_id": "event-internal",
|
||||
"uid": "connector-uid-internal",
|
||||
"recurrence_id": "recurrence-internal",
|
||||
"start_at": "2026-07-27T09:30:00+00:00",
|
||||
"end_at": "2026-07-27T09:45:00+00:00",
|
||||
"status": "CONFIRMED",
|
||||
},
|
||||
{"error": "connector-internal failure"},
|
||||
],
|
||||
tentative_hold_event_id="hold-internal",
|
||||
metadata_={"provider_ref": "provider-internal"},
|
||||
)
|
||||
]
|
||||
request.participants = [
|
||||
SchedulingParticipant(
|
||||
tenant_id="tenant-1",
|
||||
respondent_id="alice-id",
|
||||
display_name="Alice",
|
||||
email="alice@example.test",
|
||||
participant_type="internal",
|
||||
status="responded",
|
||||
poll_invitation_id="invitation-alice-internal",
|
||||
last_invited_at=datetime(2026, 7, 20, 12, tzinfo=timezone.utc),
|
||||
responded_at=datetime(2026, 7, 21, 12, tzinfo=timezone.utc),
|
||||
metadata_={"private": "alice"},
|
||||
),
|
||||
SchedulingParticipant(
|
||||
tenant_id="tenant-1",
|
||||
respondent_id="bob-id",
|
||||
display_name="Bob",
|
||||
email="bob@example.test",
|
||||
participant_type="external",
|
||||
status="invited",
|
||||
metadata_={"private": "bob"},
|
||||
),
|
||||
]
|
||||
self.session.add(request)
|
||||
self.session.flush()
|
||||
return request
|
||||
|
||||
@staticmethod
|
||||
def _participant_projection(request: SchedulingRequest) -> dict[str, object]:
|
||||
return scheduling_request_response(
|
||||
request,
|
||||
actor_ids=("alice-id", "alice@example.test"),
|
||||
actor_user_id="alice-account",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _configure_policy(provider: _PrivacyPolicy) -> None:
|
||||
registry = PlatformRegistry()
|
||||
registry.register(
|
||||
ModuleManifest(
|
||||
id="policy_test",
|
||||
name="Policy test",
|
||||
version="test",
|
||||
capability_factories={
|
||||
CAPABILITY_POLICY_SCHEDULING_PARTICIPANT_PRIVACY: lambda context: provider,
|
||||
},
|
||||
)
|
||||
)
|
||||
registry.configure_capability_context(ModuleContext(registry=registry, settings=object()))
|
||||
configure_runtime(registry=registry)
|
||||
|
||||
def test_secure_default_returns_own_row_and_aggregate_counts(self) -> None:
|
||||
request = self._request()
|
||||
|
||||
with patch(
|
||||
"govoplan_scheduling.backend.service.notification_dispatch_provider",
|
||||
return_value=object(),
|
||||
):
|
||||
payload = self._participant_projection(request)
|
||||
response = SchedulingRequestResponse.model_validate(payload)
|
||||
|
||||
self.assertEqual(request.participant_visibility, "aggregates_only")
|
||||
self.assertEqual(response.participant_visibility, "aggregates_only")
|
||||
self.assertEqual(response.effective_participant_visibility, "aggregates_only")
|
||||
self.assertEqual([participant.display_name for participant in response.participants], ["Alice"])
|
||||
own = response.participants[0]
|
||||
self.assertTrue(own.is_current_participant)
|
||||
self.assertEqual(own.email, "alice@example.test")
|
||||
self.assertIsNone(own.respondent_id)
|
||||
self.assertIsNone(own.participant_type)
|
||||
self.assertIsNone(own.required)
|
||||
self.assertIsNone(own.poll_invitation_id)
|
||||
self.assertEqual(own.metadata, {})
|
||||
self.assertEqual(response.participant_aggregate.total, 2)
|
||||
self.assertEqual(response.participant_aggregate.status_counts["responded"], 1)
|
||||
self.assertEqual(response.participant_aggregate.status_counts["invited"], 1)
|
||||
self.assertIsNone(response.tenant_id)
|
||||
self.assertIsNone(response.poll_id)
|
||||
self.assertIsNone(response.organizer_user_id)
|
||||
self.assertIsNone(response.calendar_integration_enabled)
|
||||
self.assertIsNone(response.calendar_id)
|
||||
self.assertIsNone(response.calendar_freebusy_enabled)
|
||||
self.assertIsNone(response.calendar_hold_enabled)
|
||||
self.assertIsNone(response.create_calendar_event_on_decision)
|
||||
self.assertIsNone(response.calendar_event_id)
|
||||
self.assertIsNone(response.public_participation_policy_enforcement_available)
|
||||
self.assertIsNone(response.participant_invitation_delivery_available)
|
||||
self.assertEqual(response.metadata, {})
|
||||
slot = response.slots[0]
|
||||
self.assertIsNone(slot.poll_option_id)
|
||||
self.assertEqual(slot.freebusy_status, "busy")
|
||||
self.assertEqual(
|
||||
slot.freebusy_conflicts,
|
||||
[
|
||||
{
|
||||
"start_at": "2026-07-27T09:30:00+00:00",
|
||||
"end_at": "2026-07-27T09:45:00+00:00",
|
||||
"status": "CONFIRMED",
|
||||
}
|
||||
],
|
||||
)
|
||||
self.assertIsNone(slot.tentative_hold_event_id)
|
||||
self.assertEqual(slot.metadata, {})
|
||||
|
||||
def test_configured_roster_returns_other_names_and_statuses_with_sensitive_fields_redacted(self) -> None:
|
||||
request = self._request(participant_visibility="names_and_statuses")
|
||||
|
||||
response = SchedulingRequestResponse.model_validate(self._participant_projection(request))
|
||||
|
||||
self.assertEqual(response.effective_participant_visibility, "names_and_statuses")
|
||||
own = next(participant for participant in response.participants if participant.display_name == "Alice")
|
||||
other = next(participant for participant in response.participants if participant.display_name == "Bob")
|
||||
self.assertTrue(own.is_current_participant)
|
||||
self.assertIsNone(own.respondent_id)
|
||||
self.assertEqual(own.email, "alice@example.test")
|
||||
self.assertEqual(other.status, "invited")
|
||||
self.assertFalse(other.is_current_participant)
|
||||
self.assertIsNone(other.respondent_id)
|
||||
self.assertIsNone(other.email)
|
||||
self.assertIsNone(other.participant_type)
|
||||
self.assertIsNone(other.required)
|
||||
self.assertIsNone(other.poll_invitation_id)
|
||||
self.assertEqual(other.metadata, {})
|
||||
|
||||
def test_manager_and_organizer_bypass_participant_roster_restriction(self) -> None:
|
||||
request = self._request()
|
||||
|
||||
manager = SchedulingRequestResponse.model_validate(
|
||||
scheduling_request_response(
|
||||
request,
|
||||
actor_ids=("manager-1",),
|
||||
actor_user_id="manager-1",
|
||||
can_manage=True,
|
||||
)
|
||||
)
|
||||
organizer = SchedulingRequestResponse.model_validate(
|
||||
scheduling_request_response(
|
||||
request,
|
||||
actor_ids=("organizer-1",),
|
||||
actor_user_id="organizer-1",
|
||||
)
|
||||
)
|
||||
|
||||
for response in (manager, organizer):
|
||||
self.assertEqual(response.effective_participant_visibility, "names_and_statuses")
|
||||
self.assertEqual({participant.email for participant in response.participants}, {
|
||||
"alice@example.test",
|
||||
"bob@example.test",
|
||||
})
|
||||
self.assertTrue(response.participant_visibility_decision.details["management_access"])
|
||||
self.assertEqual(response.tenant_id, "tenant-1")
|
||||
self.assertEqual(response.poll_id, "poll-internal")
|
||||
self.assertEqual(response.organizer_user_id, "organizer-1")
|
||||
self.assertEqual(response.calendar_id, "calendar-internal")
|
||||
self.assertEqual(response.calendar_event_id, "event-internal")
|
||||
self.assertEqual(response.metadata["connector_secret_ref"], "secret-internal")
|
||||
self.assertEqual(response.slots[0].poll_option_id, "poll-option-internal")
|
||||
self.assertEqual(
|
||||
response.slots[0].freebusy_conflicts[0]["uid"],
|
||||
"connector-uid-internal",
|
||||
)
|
||||
self.assertEqual(response.slots[0].tentative_hold_event_id, "hold-internal")
|
||||
self.assertFalse(response.participant_invitation_delivery_available)
|
||||
|
||||
with patch(
|
||||
"govoplan_scheduling.backend.service.notification_dispatch_provider",
|
||||
return_value=object(),
|
||||
):
|
||||
delivery_enabled = SchedulingRequestResponse.model_validate(
|
||||
scheduling_request_response(
|
||||
request,
|
||||
actor_ids=("manager-1",),
|
||||
actor_user_id="manager-1",
|
||||
can_manage=True,
|
||||
)
|
||||
)
|
||||
|
||||
self.assertTrue(delivery_enabled.participant_invitation_delivery_available)
|
||||
|
||||
def test_optional_policy_can_reduce_but_cannot_broaden_visibility(self) -> None:
|
||||
restricting_policy = _PrivacyPolicy("aggregates_only")
|
||||
self._configure_policy(restricting_policy)
|
||||
visible_request = self._request(participant_visibility="names_and_statuses")
|
||||
|
||||
reduced = SchedulingRequestResponse.model_validate(self._participant_projection(visible_request))
|
||||
|
||||
self.assertEqual(reduced.effective_participant_visibility, "aggregates_only")
|
||||
self.assertEqual([participant.display_name for participant in reduced.participants], ["Alice"])
|
||||
self.assertTrue(reduced.participant_visibility_decision.policy_applied)
|
||||
self.assertEqual(reduced.participant_visibility_decision.reason, "Tenant participant privacy policy")
|
||||
self.assertEqual(reduced.participant_visibility_decision.source_path, [])
|
||||
self.assertEqual(reduced.participant_visibility_decision.details, {})
|
||||
self.assertEqual(restricting_policy.requests[0].actor_user_id, "alice-account")
|
||||
|
||||
widening_policy = _PrivacyPolicy("names_and_statuses")
|
||||
self._configure_policy(widening_policy)
|
||||
private_request = self._request()
|
||||
|
||||
clamped = SchedulingRequestResponse.model_validate(self._participant_projection(private_request))
|
||||
|
||||
self.assertEqual(clamped.effective_participant_visibility, "aggregates_only")
|
||||
self.assertEqual([participant.display_name for participant in clamped.participants], ["Alice"])
|
||||
self.assertEqual(widening_policy.requests[0].requested_visibility, "aggregates_only")
|
||||
|
||||
def test_create_and_update_schemas_expose_the_configuration(self) -> None:
|
||||
slot = SchedulingCandidateSlotInput.model_validate(
|
||||
{
|
||||
"start_at": "2026-07-20T09:00:00Z",
|
||||
"end_at": "2026-07-20T10:00:00Z",
|
||||
}
|
||||
)
|
||||
|
||||
created = SchedulingRequestCreateRequest(title="Privacy", slots=[slot])
|
||||
updated = SchedulingRequestUpdateRequest(participant_visibility="names_and_statuses")
|
||||
|
||||
self.assertEqual(created.participant_visibility, "aggregates_only")
|
||||
self.assertEqual(updated.participant_visibility, "names_and_statuses")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,138 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
import unittest
|
||||
|
||||
from fastapi import HTTPException
|
||||
|
||||
from govoplan_core.auth import ApiPrincipal
|
||||
from govoplan_core.core.access import PrincipalRef
|
||||
from govoplan_core.core.people import (
|
||||
CAPABILITY_ACCESS_PEOPLE_SEARCH,
|
||||
PeopleSearchGroup,
|
||||
PersonSearchCandidate,
|
||||
)
|
||||
from govoplan_scheduling.backend.manifest import WRITE_SCOPE
|
||||
from govoplan_scheduling.backend.router import api_search_scheduling_people
|
||||
from govoplan_scheduling.backend.runtime import configure_runtime
|
||||
|
||||
|
||||
class _Registry:
|
||||
def __init__(self, capabilities: dict[str, object] | None = None) -> None:
|
||||
self.capabilities = capabilities or {}
|
||||
|
||||
def has_capability(self, name: str) -> bool:
|
||||
return name in self.capabilities
|
||||
|
||||
def capability(self, name: str) -> object:
|
||||
return self.capabilities[name]
|
||||
|
||||
|
||||
class _PeopleProvider:
|
||||
def __init__(self) -> None:
|
||||
self.calls: list[tuple[object, object, str, int]] = []
|
||||
|
||||
def search_people(
|
||||
self,
|
||||
session: object,
|
||||
principal: object,
|
||||
*,
|
||||
query: str,
|
||||
limit: int = 25,
|
||||
) -> tuple[PeopleSearchGroup, ...]:
|
||||
self.calls.append((session, principal, query, limit))
|
||||
return (
|
||||
PeopleSearchGroup(
|
||||
key="accounts",
|
||||
label="Accounts",
|
||||
candidates=(
|
||||
PersonSearchCandidate(
|
||||
selection_key="account:account-2",
|
||||
kind="account",
|
||||
reference_id="account-2",
|
||||
display_name="Ada Lovelace",
|
||||
email="ada@example.test",
|
||||
source_module="access",
|
||||
source_label="Accounts",
|
||||
source_ref="access:account:account-2",
|
||||
source_revision="revision-1",
|
||||
description="Research",
|
||||
provenance={"tenant_id": "tenant-1", "internal": "secret"},
|
||||
metadata={"internal_group_ids": ["group-1"]},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _principal(*scopes: str) -> ApiPrincipal:
|
||||
return ApiPrincipal(
|
||||
principal=PrincipalRef(
|
||||
account_id="account-1",
|
||||
membership_id="membership-1",
|
||||
tenant_id="tenant-1",
|
||||
email="organizer@example.test",
|
||||
display_name="Organizer",
|
||||
scopes=frozenset(scopes),
|
||||
),
|
||||
account=SimpleNamespace(id="account-1"),
|
||||
user=SimpleNamespace(id="membership-1"),
|
||||
)
|
||||
|
||||
|
||||
class SchedulingPeopleSearchTests(unittest.TestCase):
|
||||
def tearDown(self) -> None:
|
||||
configure_runtime(registry=_Registry())
|
||||
|
||||
def test_search_uses_principal_aware_core_aggregator_and_redacts_provider_internals(self) -> None:
|
||||
provider = _PeopleProvider()
|
||||
registry = _Registry({CAPABILITY_ACCESS_PEOPLE_SEARCH: provider})
|
||||
configure_runtime(registry=registry)
|
||||
session = object()
|
||||
principal = _principal(WRITE_SCOPE)
|
||||
|
||||
response = api_search_scheduling_people(
|
||||
query="ada",
|
||||
limit=12,
|
||||
session=session, # type: ignore[arg-type] - provider contract is intentionally generic
|
||||
principal=principal,
|
||||
)
|
||||
|
||||
self.assertEqual([(session, principal, "ada", 12)], provider.calls)
|
||||
payload = response.model_dump()
|
||||
self.assertEqual("account:account-2", payload["groups"][0]["candidates"][0]["selection_key"])
|
||||
self.assertEqual("revision-1", payload["groups"][0]["candidates"][0]["source_revision"])
|
||||
self.assertNotIn("source_ref", payload["groups"][0]["candidates"][0])
|
||||
self.assertNotIn("provenance", payload["groups"][0]["candidates"][0])
|
||||
self.assertNotIn("metadata", payload["groups"][0]["candidates"][0])
|
||||
|
||||
def test_search_is_empty_when_no_optional_directory_provider_is_installed(self) -> None:
|
||||
configure_runtime(registry=_Registry())
|
||||
|
||||
response = api_search_scheduling_people(
|
||||
query="ada",
|
||||
limit=25,
|
||||
session=object(), # type: ignore[arg-type]
|
||||
principal=_principal(WRITE_SCOPE),
|
||||
)
|
||||
|
||||
self.assertEqual([], response.groups)
|
||||
|
||||
def test_search_requires_scheduling_write_or_admin_access(self) -> None:
|
||||
provider = _PeopleProvider()
|
||||
configure_runtime(registry=_Registry({CAPABILITY_ACCESS_PEOPLE_SEARCH: provider}))
|
||||
|
||||
with self.assertRaises(HTTPException) as raised:
|
||||
api_search_scheduling_people(
|
||||
query="ada",
|
||||
limit=25,
|
||||
session=object(), # type: ignore[arg-type]
|
||||
principal=_principal("scheduling:schedule:read"),
|
||||
)
|
||||
|
||||
self.assertEqual(403, raised.exception.status_code)
|
||||
self.assertEqual([], provider.calls)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,283 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
import pytest
|
||||
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingParticipant,
|
||||
SchedulingRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.schemas import (
|
||||
SchedulingCandidateSlotReconcileInput,
|
||||
SchedulingParticipantReconcileInput,
|
||||
SchedulingRequestUpdateRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.service import (
|
||||
SchedulingError,
|
||||
_plan_scheduling_participant_reconciliation,
|
||||
_plan_scheduling_request_update,
|
||||
_plan_scheduling_slot_reconciliation,
|
||||
scheduling_participant_revision,
|
||||
scheduling_slot_revision,
|
||||
)
|
||||
|
||||
|
||||
NOW = datetime(2026, 7, 29, 9, tzinfo=timezone.utc)
|
||||
|
||||
|
||||
def _request() -> SchedulingRequest:
|
||||
return SchedulingRequest(
|
||||
id="request-1",
|
||||
tenant_id="tenant-1",
|
||||
title="Steering group",
|
||||
timezone="Europe/Berlin",
|
||||
status="collecting",
|
||||
poll_id="poll-1",
|
||||
allow_external_participants=True,
|
||||
allow_participant_updates=True,
|
||||
result_visibility="after_close",
|
||||
participant_visibility="aggregates_only",
|
||||
notify_on_answers=True,
|
||||
single_choice=False,
|
||||
max_participants_per_option=None,
|
||||
allow_maybe=True,
|
||||
allow_comments=False,
|
||||
participant_email_required=False,
|
||||
anonymous_password_protection_enabled=False,
|
||||
)
|
||||
|
||||
|
||||
def _slot(
|
||||
request: SchedulingRequest,
|
||||
*,
|
||||
slot_id: str,
|
||||
position: int,
|
||||
start_offset: int,
|
||||
) -> SchedulingCandidateSlot:
|
||||
slot = SchedulingCandidateSlot(
|
||||
id=slot_id,
|
||||
tenant_id=request.tenant_id,
|
||||
request=request,
|
||||
poll_option_id=f"option-{slot_id}",
|
||||
label=f"Slot {position + 1}",
|
||||
start_at=NOW + timedelta(hours=start_offset),
|
||||
end_at=NOW + timedelta(hours=start_offset + 1),
|
||||
timezone=request.timezone,
|
||||
position=position,
|
||||
freebusy_conflicts=[],
|
||||
metadata_={},
|
||||
)
|
||||
return slot
|
||||
|
||||
|
||||
def _slot_input(
|
||||
slot: SchedulingCandidateSlot,
|
||||
*,
|
||||
label: str | None = None,
|
||||
) -> SchedulingCandidateSlotReconcileInput:
|
||||
return SchedulingCandidateSlotReconcileInput(
|
||||
id=slot.id,
|
||||
revision=scheduling_slot_revision(slot),
|
||||
label=label or slot.label,
|
||||
start_at=slot.start_at,
|
||||
end_at=slot.end_at,
|
||||
timezone=slot.timezone,
|
||||
location=slot.location,
|
||||
metadata=slot.metadata_ or {},
|
||||
)
|
||||
|
||||
|
||||
def _participant(
|
||||
request: SchedulingRequest,
|
||||
*,
|
||||
participant_id: str,
|
||||
respondent_id: str,
|
||||
email: str,
|
||||
required: bool,
|
||||
status: str = "invited",
|
||||
invitation_id: str | None = None,
|
||||
) -> SchedulingParticipant:
|
||||
return SchedulingParticipant(
|
||||
id=participant_id,
|
||||
tenant_id=request.tenant_id,
|
||||
request=request,
|
||||
respondent_id=respondent_id,
|
||||
display_name=participant_id.title(),
|
||||
email=email,
|
||||
participant_type="internal",
|
||||
required=required,
|
||||
status=status,
|
||||
poll_invitation_id=invitation_id,
|
||||
participation_gateway="scheduling" if invitation_id else None,
|
||||
metadata_={},
|
||||
)
|
||||
|
||||
|
||||
def _participant_input(
|
||||
participant: SchedulingParticipant,
|
||||
**changes: object,
|
||||
) -> SchedulingParticipantReconcileInput:
|
||||
values = {
|
||||
"id": participant.id,
|
||||
"revision": scheduling_participant_revision(participant),
|
||||
"respondent_id": participant.respondent_id,
|
||||
"display_name": participant.display_name,
|
||||
"email": participant.email,
|
||||
"participant_type": participant.participant_type,
|
||||
"required": participant.required,
|
||||
"metadata": participant.metadata_ or {},
|
||||
}
|
||||
values.update(changes)
|
||||
return SchedulingParticipantReconcileInput.model_validate(values)
|
||||
|
||||
|
||||
def test_slot_plan_is_inspectable_and_does_not_mutate_models() -> None:
|
||||
request = _request()
|
||||
first = _slot(request, slot_id="slot-1", position=0, start_offset=1)
|
||||
second = _slot(request, slot_id="slot-2", position=1, start_offset=3)
|
||||
supplied = [
|
||||
_slot_input(first, label="Updated first slot"),
|
||||
SchedulingCandidateSlotReconcileInput(
|
||||
label="New slot",
|
||||
start_at=NOW + timedelta(hours=5),
|
||||
end_at=NOW + timedelta(hours=6),
|
||||
timezone=request.timezone,
|
||||
),
|
||||
]
|
||||
|
||||
plan = _plan_scheduling_slot_reconciliation(
|
||||
request=request,
|
||||
supplied_slots=supplied,
|
||||
option_mutation_available=True,
|
||||
)
|
||||
|
||||
assert [update.slot_id for update in plan.updates] == ["slot-1"]
|
||||
assert plan.updates[0].changes.label == "Updated first slot"
|
||||
assert len(plan.additions) == 1
|
||||
assert plan.removals == ("slot-2",)
|
||||
assert plan.changed is True
|
||||
assert first.label == "Slot 1"
|
||||
assert second.deleted_at is None
|
||||
assert len(request.slots) == 2
|
||||
|
||||
|
||||
def test_exact_slot_replay_produces_a_noop_plan() -> None:
|
||||
request = _request()
|
||||
first = _slot(request, slot_id="slot-1", position=0, start_offset=1)
|
||||
|
||||
plan = _plan_scheduling_slot_reconciliation(
|
||||
request=request,
|
||||
supplied_slots=[_slot_input(first)],
|
||||
option_mutation_available=True,
|
||||
)
|
||||
|
||||
assert plan.changed is False
|
||||
assert plan.updates == ()
|
||||
assert plan.additions == ()
|
||||
assert plan.removals == ()
|
||||
|
||||
|
||||
def test_slot_plan_rejects_removal_of_a_tentative_calendar_hold() -> None:
|
||||
request = _request()
|
||||
held = _slot(request, slot_id="slot-held", position=0, start_offset=1)
|
||||
held.tentative_hold_event_id = "event-1"
|
||||
|
||||
with pytest.raises(SchedulingError, match="tentative calendar hold"):
|
||||
_plan_scheduling_slot_reconciliation(
|
||||
request=request,
|
||||
supplied_slots=[],
|
||||
option_mutation_available=True,
|
||||
)
|
||||
|
||||
|
||||
def test_participant_plan_distinguishes_updates_additions_and_retirements() -> None:
|
||||
request = _request()
|
||||
alice = _participant(
|
||||
request,
|
||||
participant_id="alice",
|
||||
respondent_id="user-alice",
|
||||
email="alice@example.test",
|
||||
required=True,
|
||||
invitation_id="invitation-alice",
|
||||
)
|
||||
bob = _participant(
|
||||
request,
|
||||
participant_id="bob",
|
||||
respondent_id="user-bob",
|
||||
email="bob@example.test",
|
||||
required=False,
|
||||
status="responded",
|
||||
)
|
||||
supplied = [
|
||||
_participant_input(alice, email="alice.new@example.test", required=False),
|
||||
SchedulingParticipantReconcileInput(
|
||||
respondent_id="user-charlie",
|
||||
display_name="Charlie",
|
||||
email="charlie@example.test",
|
||||
participant_type="internal",
|
||||
required=True,
|
||||
),
|
||||
]
|
||||
|
||||
plan = _plan_scheduling_participant_reconciliation(
|
||||
request=request,
|
||||
supplied_participants=supplied,
|
||||
participation_available=True,
|
||||
retirement_available=True,
|
||||
)
|
||||
|
||||
assert len(plan.updates) == 1
|
||||
assert plan.updates[0].participant_id == "alice"
|
||||
assert plan.updates[0].revoke_invitation is True
|
||||
assert set(plan.updates[0].changed_fields) == {"email", "required"}
|
||||
assert plan.creations[0].replaces_participant_id is None
|
||||
assert plan.creations[0].supplied.required is True
|
||||
assert plan.retirements == ("bob",)
|
||||
assert alice.email == "alice@example.test"
|
||||
assert alice.required is True
|
||||
assert bob.status == "responded"
|
||||
|
||||
|
||||
def test_request_plan_records_invitation_expiry_work_without_tokens() -> None:
|
||||
request = _request()
|
||||
participant = _participant(
|
||||
request,
|
||||
participant_id="alice",
|
||||
respondent_id="user-alice",
|
||||
email="alice@example.test",
|
||||
required=True,
|
||||
invitation_id="invitation-alice",
|
||||
)
|
||||
deadline = NOW + timedelta(days=2)
|
||||
|
||||
plan = _plan_scheduling_request_update(
|
||||
request=request,
|
||||
payload=SchedulingRequestUpdateRequest(deadline_at=deadline),
|
||||
participation_available=True,
|
||||
)
|
||||
|
||||
assert plan.deadline_changed is True
|
||||
assert plan.retained_invitation_ids == ((participant.id, "invitation-alice"),)
|
||||
assert "token" not in repr(plan).casefold()
|
||||
assert request.deadline_at is None
|
||||
|
||||
|
||||
def test_request_plan_rejects_policy_change_after_link_issuance() -> None:
|
||||
request = _request()
|
||||
_participant(
|
||||
request,
|
||||
participant_id="alice",
|
||||
respondent_id="user-alice",
|
||||
email="alice@example.test",
|
||||
required=True,
|
||||
invitation_id="invitation-alice",
|
||||
)
|
||||
|
||||
with pytest.raises(SchedulingError, match="cannot change"):
|
||||
_plan_scheduling_request_update(
|
||||
request=request,
|
||||
payload=SchedulingRequestUpdateRequest(single_choice=True),
|
||||
participation_available=True,
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,328 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
from pydantic import SecretStr
|
||||
|
||||
from govoplan_core.core.modules import ModuleContext
|
||||
from govoplan_core.core.registry import PlatformRegistry
|
||||
from govoplan_core.db.base import Base
|
||||
from govoplan_poll.backend.db.models import (
|
||||
Poll,
|
||||
PollInvitation,
|
||||
PollLifecycleTransition,
|
||||
PollOption,
|
||||
PollParticipationSubmission,
|
||||
PollResponse,
|
||||
)
|
||||
from govoplan_poll.backend.manifest import get_manifest as get_poll_manifest
|
||||
from govoplan_scheduling.backend.db.models import (
|
||||
SchedulingCandidateSlot,
|
||||
SchedulingNotification,
|
||||
SchedulingParticipant,
|
||||
SchedulingPublicEnrollmentLink,
|
||||
SchedulingRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.schemas import (
|
||||
SchedulingAuthenticatedEnrollmentSubmitRequest,
|
||||
SchedulingAvailabilityAnswerInput,
|
||||
SchedulingCandidateSlotInput,
|
||||
SchedulingEnrollmentLinkCreateRequest,
|
||||
SchedulingPublicEnrollmentAccessRequest,
|
||||
SchedulingPublicEnrollmentSubmitRequest,
|
||||
SchedulingRequestCreateRequest,
|
||||
)
|
||||
from govoplan_scheduling.backend.runtime import configure_runtime
|
||||
from govoplan_scheduling.backend.service import (
|
||||
SchedulingConflictError,
|
||||
SchedulingPublicParticipationError,
|
||||
create_scheduling_enrollment_link,
|
||||
create_scheduling_request,
|
||||
get_public_scheduling_enrollment,
|
||||
revoke_scheduling_enrollment_link,
|
||||
scheduling_request_is_visible,
|
||||
scheduling_slot_revision,
|
||||
submit_authenticated_scheduling_enrollment,
|
||||
submit_public_scheduling_enrollment,
|
||||
)
|
||||
|
||||
|
||||
class SchedulingSelfEnrollmentTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.now = datetime(2026, 8, 20, 10, tzinfo=timezone.utc)
|
||||
self.patches = (
|
||||
patch("govoplan_scheduling.backend.service._now", return_value=self.now),
|
||||
patch("govoplan_poll.backend.service._now", return_value=self.now),
|
||||
patch("govoplan_poll.backend.participation_service._now", return_value=self.now),
|
||||
)
|
||||
for item in self.patches:
|
||||
item.start()
|
||||
registry = PlatformRegistry()
|
||||
registry.register(get_poll_manifest())
|
||||
settings = SimpleNamespace(
|
||||
redis_url=None,
|
||||
scheduling_public_self_enrollment_enabled=True,
|
||||
scheduling_public_self_enrollment_max_capacity=100,
|
||||
)
|
||||
registry.configure_capability_context(
|
||||
ModuleContext(registry=registry, settings=settings)
|
||||
)
|
||||
configure_runtime(registry=registry, settings=settings)
|
||||
self.engine = create_engine("sqlite:///:memory:")
|
||||
Base.metadata.create_all(
|
||||
self.engine,
|
||||
tables=[
|
||||
Poll.__table__,
|
||||
PollOption.__table__,
|
||||
PollResponse.__table__,
|
||||
PollInvitation.__table__,
|
||||
PollParticipationSubmission.__table__,
|
||||
PollLifecycleTransition.__table__,
|
||||
SchedulingRequest.__table__,
|
||||
SchedulingPublicEnrollmentLink.__table__,
|
||||
SchedulingCandidateSlot.__table__,
|
||||
SchedulingParticipant.__table__,
|
||||
SchedulingNotification.__table__,
|
||||
],
|
||||
)
|
||||
self.Session = sessionmaker(bind=self.engine)
|
||||
self.session: Session = self.Session()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.session.close()
|
||||
Base.metadata.drop_all(self.engine)
|
||||
self.engine.dispose()
|
||||
for item in reversed(self.patches):
|
||||
item.stop()
|
||||
|
||||
def _request(self, *, email_required: bool = False) -> SchedulingRequest:
|
||||
start = self.now + timedelta(days=1)
|
||||
request, _tokens = create_scheduling_request(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
user_id="organizer-1",
|
||||
payload=SchedulingRequestCreateRequest(
|
||||
title="Public planning",
|
||||
status="collecting",
|
||||
deadline_at=self.now + timedelta(days=4),
|
||||
participant_email_required=email_required,
|
||||
slots=[
|
||||
SchedulingCandidateSlotInput(
|
||||
label="First option",
|
||||
start_at=start,
|
||||
end_at=start + timedelta(hours=1),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
return request
|
||||
|
||||
def _link(
|
||||
self,
|
||||
request: SchedulingRequest,
|
||||
*,
|
||||
capacity: int = 2,
|
||||
) -> tuple[SchedulingPublicEnrollmentLink, str]:
|
||||
return create_scheduling_enrollment_link(
|
||||
self.session,
|
||||
tenant_id=request.tenant_id,
|
||||
request_id=request.id,
|
||||
created_by="organizer-1",
|
||||
payload=SchedulingEnrollmentLinkCreateRequest(
|
||||
expires_at=self.now + timedelta(days=2),
|
||||
max_enrollments=capacity,
|
||||
),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _answer(request: SchedulingRequest) -> SchedulingAvailabilityAnswerInput:
|
||||
slot = request.slots[0]
|
||||
return SchedulingAvailabilityAnswerInput(
|
||||
slot_id=slot.id,
|
||||
value="available",
|
||||
option_revision=scheduling_slot_revision(slot),
|
||||
)
|
||||
|
||||
def test_anonymous_enrollment_requires_proof_for_updates_and_is_idempotent(self) -> None:
|
||||
request = self._request(email_required=True)
|
||||
link, token = self._link(request)
|
||||
|
||||
opened = get_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=SchedulingPublicEnrollmentAccessRequest(),
|
||||
client_address="192.0.2.1",
|
||||
)
|
||||
self.assertTrue(opened["participant_email_required"])
|
||||
self.assertEqual(opened["enrollment_remaining"], 2)
|
||||
|
||||
payload = SchedulingPublicEnrollmentSubmitRequest(
|
||||
display_name="Ada Example",
|
||||
email="ADA@example.test",
|
||||
participant_proof="proof-" + "a" * 40,
|
||||
idempotency_key="enrollment-submit-1",
|
||||
answers=[self._answer(request)],
|
||||
)
|
||||
created = submit_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=payload,
|
||||
client_address="192.0.2.1",
|
||||
)
|
||||
replayed = submit_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=payload,
|
||||
client_address="192.0.2.1",
|
||||
)
|
||||
|
||||
self.assertTrue(created["enrolled"])
|
||||
self.assertTrue(created["has_response"])
|
||||
self.assertTrue(replayed["replayed"])
|
||||
self.assertEqual(self.session.query(SchedulingParticipant).count(), 1)
|
||||
participant = self.session.query(SchedulingParticipant).one()
|
||||
self.assertEqual(participant.email, "ada@example.test")
|
||||
self.assertNotEqual(participant.self_enrollment_proof_hash, payload.participant_proof.get_secret_value())
|
||||
self.assertNotIn(token, repr(participant.metadata_))
|
||||
|
||||
with self.assertRaises(SchedulingPublicParticipationError):
|
||||
submit_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=payload.model_copy(
|
||||
update={
|
||||
"participant_proof": SecretStr("proof-" + "b" * 40),
|
||||
"idempotency_key": "enrollment-submit-2",
|
||||
}
|
||||
),
|
||||
client_address="192.0.2.2",
|
||||
)
|
||||
|
||||
def test_capacity_is_serialized_but_existing_proof_can_update(self) -> None:
|
||||
request = self._request()
|
||||
_link, token = self._link(request, capacity=1)
|
||||
first = SchedulingPublicEnrollmentSubmitRequest(
|
||||
display_name="Ada",
|
||||
participant_proof="proof-" + "a" * 40,
|
||||
idempotency_key="first",
|
||||
answers=[self._answer(request)],
|
||||
)
|
||||
submit_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=first,
|
||||
client_address="192.0.2.3",
|
||||
)
|
||||
updated = submit_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=first.model_copy(update={"idempotency_key": "update"}),
|
||||
client_address="192.0.2.3",
|
||||
)
|
||||
self.assertTrue(updated["has_response"])
|
||||
with self.assertRaises(SchedulingConflictError):
|
||||
submit_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=first.model_copy(
|
||||
update={
|
||||
"display_name": "Grace",
|
||||
"participant_proof": SecretStr("proof-" + "g" * 40),
|
||||
"idempotency_key": "second",
|
||||
}
|
||||
),
|
||||
client_address="192.0.2.4",
|
||||
)
|
||||
|
||||
def test_signed_in_binding_requires_confirmation_and_can_claim_proof(self) -> None:
|
||||
request = self._request()
|
||||
link, token = self._link(request)
|
||||
anonymous = SchedulingPublicEnrollmentSubmitRequest(
|
||||
display_name="Ada",
|
||||
participant_proof="proof-" + "a" * 40,
|
||||
idempotency_key="anonymous",
|
||||
answers=[self._answer(request)],
|
||||
)
|
||||
submit_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=anonymous,
|
||||
client_address="192.0.2.5",
|
||||
)
|
||||
authenticated = SchedulingAuthenticatedEnrollmentSubmitRequest(
|
||||
display_name="Ada",
|
||||
bind_account_confirmed=True,
|
||||
participant_proof=anonymous.participant_proof,
|
||||
idempotency_key="bound",
|
||||
answers=[self._answer(request)],
|
||||
)
|
||||
bound = submit_authenticated_scheduling_enrollment(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
account_id="account-ada",
|
||||
account_email="ada@example.test",
|
||||
payload=authenticated,
|
||||
client_address="192.0.2.5",
|
||||
)
|
||||
participant = self.session.query(SchedulingParticipant).one()
|
||||
self.assertTrue(bound["account_bound"])
|
||||
self.assertEqual(participant.bound_account_id, "account-ada")
|
||||
self.assertEqual(participant.self_enrollment_link_id, link.id)
|
||||
self.assertTrue(
|
||||
scheduling_request_is_visible(
|
||||
request,
|
||||
actor_ids=("account-ada",),
|
||||
)
|
||||
)
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "Account binding must be confirmed"):
|
||||
submit_authenticated_scheduling_enrollment(
|
||||
self.session,
|
||||
tenant_id="tenant-1",
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
account_id="other-account",
|
||||
account_email=None,
|
||||
payload=authenticated.model_copy(update={"bind_account_confirmed": False}),
|
||||
client_address="192.0.2.6",
|
||||
)
|
||||
|
||||
def test_revocation_invalidates_link_without_storing_raw_token(self) -> None:
|
||||
request = self._request()
|
||||
link, token = self._link(request)
|
||||
self.assertNotEqual(link.token_hash, token)
|
||||
revoked, replayed = revoke_scheduling_enrollment_link(
|
||||
self.session,
|
||||
tenant_id=request.tenant_id,
|
||||
request_id=request.id,
|
||||
link_id=link.id,
|
||||
)
|
||||
self.assertFalse(replayed)
|
||||
self.assertIsNotNone(revoked.revoked_at)
|
||||
with self.assertRaises(SchedulingPublicParticipationError):
|
||||
get_public_scheduling_enrollment(
|
||||
self.session,
|
||||
request_id=request.id,
|
||||
token=token,
|
||||
payload=SchedulingPublicEnrollmentAccessRequest(),
|
||||
client_address="192.0.2.7",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@govoplan/scheduling-webui",
|
||||
"version": "0.1.22",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"module": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"import": "./src/index.ts"
|
||||
},
|
||||
"./styles/scheduling.css": "./src/styles/scheduling.css"
|
||||
},
|
||||
"scripts": {
|
||||
"test:view-model": "node --experimental-strip-types --test tests/scheduling-view-model.test.ts",
|
||||
"test:ui-structure": "node scripts/test-scheduling-page-structure.mjs"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@govoplan/core-webui": "^0.1.45",
|
||||
"lucide-react": "^1.23.0",
|
||||
"react": ">=19.2.7 <20",
|
||||
"react-dom": ">=19.2.7 <20",
|
||||
"react-router": ">=8.3.0 <9",
|
||||
"@vitejs/plugin-react": "^5.2.0",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^7.3.6"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@govoplan/core-webui": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const pagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingPage.tsx", import.meta.url));
|
||||
const publicPagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingPublicPage.tsx", import.meta.url));
|
||||
const enrollmentPagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingEnrollmentPage.tsx", import.meta.url));
|
||||
const apiPath = fileURLToPath(new URL("../src/api/scheduling.ts", import.meta.url));
|
||||
const modulePath = fileURLToPath(new URL("../src/module.ts", import.meta.url));
|
||||
const widgetPath = fileURLToPath(new URL("../src/features/scheduling/SchedulingRequestsWidget.tsx", import.meta.url));
|
||||
const page = readFileSync(pagePath, "utf8");
|
||||
const publicPage = readFileSync(publicPagePath, "utf8");
|
||||
const enrollmentPage = readFileSync(enrollmentPagePath, "utf8");
|
||||
const api = readFileSync(apiPath, "utf8");
|
||||
const moduleSource = readFileSync(modulePath, "utf8");
|
||||
const widget = readFileSync(widgetPath, "utf8");
|
||||
|
||||
assert.match(page, /usePlatformUiCapability<CalendarPickerUiCapability>\("calendar\.picker"\)/);
|
||||
assert.match(page, /hasScope\(auth, "calendar:calendar:read"\)/);
|
||||
assert.match(page, /Boolean\(calendarPickerCapability\) && canReadCalendars && canReadAvailability && canWriteCalendarEvent/);
|
||||
assert.doesNotMatch(page, /@govoplan\/calendar-webui|govoplan-calendar\/webui/);
|
||||
assert.match(page, /Card,[\s\S]*DataGrid,[\s\S]*DataGridRowActions,[\s\S]*FormField,[\s\S]*MetricCard,[\s\S]*PasswordField,[\s\S]*PeoplePicker,[\s\S]*SelectionList,[\s\S]*ToggleSwitch,[\s\S]*from "@govoplan\/core-webui"/);
|
||||
assert.doesNotMatch(page, /@govoplan\/core-webui\/src\//);
|
||||
assert.match(page, /ActionBlockerHint,[\s\S]*DocumentationHelpLink,[\s\S]*StageRail,[\s\S]*from "@govoplan\/core-webui"/);
|
||||
|
||||
assert.match(page, /className="scheduling-workspace-layout"/);
|
||||
assert.match(page, /<aside className="scheduling-request-sidebar">/);
|
||||
assert.match(page, /<section className="scheduling-main-panel">/);
|
||||
const workspaceBar = page.slice(page.indexOf('<section className="scheduling-workspace">'), page.indexOf('<div className="scheduling-workspace-layout">'));
|
||||
assert.match(workspaceBar, /scope="workspace"[\s\S]*variant="collection"[\s\S]*reloadAction=/);
|
||||
assert.match(workspaceBar, /createAction=\{<Button[\s\S]*disabled=\{!canCreateOrWrite \|\| saving\}[\s\S]*I18N\.newRequest/);
|
||||
assert.doesNotMatch(workspaceBar, /createAction=\{canCreateOrWrite \?/);
|
||||
assert.match(workspaceBar, /!canCreateOrWrite \? I18N\.createPermissionRequired : undefined/);
|
||||
assert.doesNotMatch(page, /scheduling-sidebar-actions/);
|
||||
assert.match(page, /title=\{I18N\.myRequests\}/);
|
||||
assert.match(page, /title=\{I18N\.invitedRequests\}/);
|
||||
assert.ok(page.indexOf("title={I18N.myRequests}") < page.indexOf("title={I18N.invitedRequests}"));
|
||||
assert.match(page, /<SelectionList label=\{title\} className="scheduling-request-list">/);
|
||||
assert.match(page, /<SelectionListItem[\s\S]*selected=\{selectedId === request\.id\}[\s\S]*className="scheduling-list-item"/);
|
||||
assert.match(page, /className="scheduling-list-item"[\s\S]{0,100}disabled=\{disabled\}/);
|
||||
|
||||
assert.match(page, /editorMode \? \(/);
|
||||
assert.match(page, /id="scheduling-editor-form"/);
|
||||
assert.doesNotMatch(page, /ModuleSubnav|scheduling-create-subnav|scheduling-full-editor/);
|
||||
const editorStart = page.indexOf('<div className="scheduling-editor-surface">');
|
||||
const editorEnd = page.indexOf('</form>', editorStart);
|
||||
const editor = page.slice(editorStart, editorEnd);
|
||||
assert.ok(editor.indexOf("I18N.discard") < editor.indexOf("I18N.save"));
|
||||
assert.match(editor, /form:\s*"scheduling-editor-form"/);
|
||||
assert.match(editor, /<Card title=\{I18N\.basicInformation\}>/);
|
||||
assert.match(editor, /<Card title=\{I18N\.calendarIntegration\}>/);
|
||||
assert.match(page, /<Card title=\{I18N\.candidateSlots\}>/);
|
||||
assert.match(page, /<Card title=\{I18N\.participants\}>/);
|
||||
assert.match(page, /<StageRail[\s\S]*schedulingLifecycleStages\(selected\.status\)/);
|
||||
assert.match(page, /topicId: "scheduling\.find-and-decide-meeting-time"/);
|
||||
assert.match(page, /topicId: "scheduling\.calendar-coordination"/);
|
||||
assert.match(page, /topicId: "scheduling\.participation-governance"/);
|
||||
assert.match(page, /topicId: "scheduling\.public-self-enrollment"/);
|
||||
assert.match(page, /function SelfEnrollmentLinksCard/);
|
||||
assert.match(page, /createSchedulingEnrollmentLink/);
|
||||
assert.match(page, /revokeSchedulingEnrollmentLink/);
|
||||
assert.match(page, /title=\{I18N\.selfEnrollmentRevokeTitle\}[\s\S]*tone="danger"/);
|
||||
assert.match(page, /public_participation_policy_enforcement_available === false[\s\S]*<ActionBlockerHint/);
|
||||
assert.match(page, /<Card title=\{I18N\.generalSettings\}>/);
|
||||
assert.match(page, /<Card title=\{I18N\.participantPrivacy\}>/);
|
||||
assert.match(editor, /<FormField label=\{I18N\.title\}>/);
|
||||
assert.match(page, /useUnsavedDraftGuard\(/);
|
||||
assert.match(page, /requestDiscard\(exitEditor\)/);
|
||||
assert.match(page, /dirty: responseDirty,[\s\S]*onSave: persistAvailability,[\s\S]*onDiscard: resetResponseDraft/);
|
||||
assert.match(page, /calendarCleanup\?\.status === "retry_required"[\s\S]*I18N\.calendarCleanupRetryTitle/);
|
||||
assert.doesNotMatch(page, /window\.(?:alert|confirm)\(/);
|
||||
|
||||
for (const setting of [
|
||||
"participantRosterVisible",
|
||||
"notifyOnAnswers",
|
||||
"singleChoice",
|
||||
"participantLimitEnabled",
|
||||
"allowMaybe",
|
||||
"allowComments",
|
||||
"participantEmailRequired",
|
||||
"anonymousPasswordProtectionEnabled"
|
||||
]) {
|
||||
assert.match(page, new RegExp(`checked=\\{${setting}\\}`));
|
||||
}
|
||||
assert.match(page, /<PasswordField[\s\S]*minLength=\{8\}/);
|
||||
assert.match(page, /type="number"[\s\S]*min=\{1\}/);
|
||||
assert.match(page, /min=\{addLocalMinutes\(slot\.start_at, 1\)\}/);
|
||||
assert.match(page, /allow_external_participants: allowExternalParticipants/);
|
||||
assert.doesNotMatch(page, /usesGatewayPolicy|updateSchedulingCandidateSlot/);
|
||||
assert.match(page, /public_participation_policy_enforcement_available/);
|
||||
assert.match(page, /const canCreateOrWrite = canWrite \|\| canAdminister/);
|
||||
assert.match(page, /policyLocked=\{participationPolicyLocked\}/);
|
||||
|
||||
assert.match(page, /id="scheduling-create-candidate-slots-grid"/);
|
||||
assert.match(page, /id="scheduling-participant-picker"/);
|
||||
assert.match(page, /id="scheduling-candidate-slots-grid"/);
|
||||
assert.match(page, /id="scheduling-participants-grid"/);
|
||||
assert.match(page, /<DataGridRowActions/);
|
||||
assert.match(page, /disabled=\{!canCreateOrWrite\}[\s\S]{0,80}reorderable/);
|
||||
assert.doesNotMatch(page, /reorderable=\{editorMode === "create"\}/);
|
||||
assert.doesNotMatch(page, /EmailAddressInput|MailboxAddress|addressSuggestions|addressLookupQuery/);
|
||||
assert.doesNotMatch(page, /<input[\s\S]{0,220}aria-label=\{I18N\.participantEmail\}/);
|
||||
assert.match(page, /allowManualExternal=\{allowExternalParticipants\}/);
|
||||
assert.match(page, /search=\{participantSearch\}/);
|
||||
assert.doesNotMatch(page, /<table|scheduling-table|scheduling-card(?:\s|"|`)/);
|
||||
assert.match(page, /<TableActionGroup[\s\S]*disabled: saving \|\| !decisionEnabled/);
|
||||
assert.match(page, /showDecisionAction=\{canManageSelected\}/);
|
||||
assert.match(page, /<WorkspaceActionBar[\s\S]*refreshable[\s\S]*reloadAction=\{\{[\s\S]*label: I18N\.refresh/);
|
||||
assert.doesNotMatch(page, /AdminIconButton/);
|
||||
|
||||
const participantGridStart = page.indexOf("function ParticipantsGrid(");
|
||||
const participantGridEnd = page.indexOf("function invitationActionDisabledReason", participantGridStart);
|
||||
const participantGrid = page.slice(participantGridStart, participantGridEnd);
|
||||
assert.match(participantGrid, /\.\.\.\(canManage \? \[\{/);
|
||||
assert.match(participantGrid, /minimumSlots=\{3\}/);
|
||||
assert.ok(participantGrid.indexOf('id: "copy-invitation"') < participantGrid.indexOf('id: "send-invitation"'));
|
||||
assert.ok(participantGrid.indexOf('id: "send-invitation"') < participantGrid.indexOf('id: "revoke-invitation"'));
|
||||
assert.match(participantGrid, /schedulingInvitationActionBlocks\(request, participant, now\)/);
|
||||
assert.match(participantGrid, /disabledReason: saving \? I18N\.saving : copyDisabledReason/);
|
||||
assert.match(participantGrid, /disabledReason: saving \? I18N\.saving : deliveryDisabledReason/);
|
||||
assert.match(participantGrid, /disabledReason: saving \? I18N\.saving : revokeDisabledReason/);
|
||||
assert.match(page, /<ConfirmDialog[\s\S]*title=\{I18N\.revokeInvitationLabel\}[\s\S]*tone="danger"/);
|
||||
assert.match(page, /setConsequentialAction\(\{ kind: "close"/);
|
||||
assert.match(page, /setConsequentialAction\(\{ kind: "reminder"/);
|
||||
assert.match(page, /setConsequentialAction\(\{ kind: "holds"/);
|
||||
assert.match(page, /setConsequentialAction\(\{ kind: "final-event"/);
|
||||
assert.match(page, /setDecisionTarget\(\{ requestId: selected\.id, slot \}\)/);
|
||||
assert.match(page, /open=\{Boolean\(consequentialAction && consequentialActionCopy\)\}/);
|
||||
assert.match(page, /open=\{Boolean\(decisionTarget\)\}/);
|
||||
assert.match(page, /disabledReason=\{saving \? I18N\.saving/);
|
||||
assert.match(page, /navigator\.clipboard\.writeText\(value\)/);
|
||||
assert.match(page, /navigator\.clipboard\.write\(\[new ClipboardItem/);
|
||||
assert.match(page, /schedulingPublicInvitationUrl\(response\.action_url, window\.location\.origin\)/);
|
||||
assert.match(page, /\["failed", "skipped"\]\.includes\(result\.status\)/);
|
||||
assert.match(page, /isApiError\(err, 409\)/);
|
||||
assert.match(page, /scheduleExpiryRefresh/);
|
||||
assert.doesNotMatch(page, /(?:localStorage|sessionStorage).*action_url|action_url.*(?:localStorage|sessionStorage)/);
|
||||
|
||||
assert.match(page, /submitSchedulingAvailability\(settings, selected\.id/);
|
||||
assert.match(page, /option_revision: slot\.revision/);
|
||||
assert.match(page, /getSchedulingAvailabilityResponse\(settings, selected\.id\)/);
|
||||
assert.match(page, /const answers = Object\.fromEntries\(response\.answers\.map/);
|
||||
assert.match(page, /setSavedAvailability\(answers\)/);
|
||||
assert.match(page, /const comment = response\.comment \?\? ""/);
|
||||
assert.match(page, /setSavedAvailabilityComment\(comment\)/);
|
||||
assert.match(page, /<ParticipationStats/);
|
||||
assert.match(page, /selected\.effective_participant_visibility === "names_and_statuses"/);
|
||||
assert.doesNotMatch(page, /<p>\{selected\.calendar_id\}<\/p>/);
|
||||
assert.match(page, /className="scheduling-selected-calendar"/);
|
||||
|
||||
for (const field of [
|
||||
"notify_on_answers",
|
||||
"single_choice",
|
||||
"max_participants_per_option",
|
||||
"allow_maybe",
|
||||
"allow_comments",
|
||||
"participant_email_required",
|
||||
"anonymous_password_protection_enabled",
|
||||
"public_participation_policy_enforcement_available",
|
||||
"participant_invitation_delivery_available"
|
||||
]) {
|
||||
assert.match(api, new RegExp(`${field}:`));
|
||||
}
|
||||
assert.match(api, /method: "PATCH"/);
|
||||
assert.match(api, /\/api\/v1\/scheduling\/people\?/);
|
||||
assert.doesNotMatch(api, /address-lookup/);
|
||||
assert.match(page, /slots: slots\.map\(\(slot\) => \(\{/);
|
||||
assert.match(page, /participants: participants\.map\(participantPayload\)/);
|
||||
assert.doesNotMatch(page, /create_participant_invitations/);
|
||||
assert.match(api, /\/api\/v1\/scheduling\/requests\/\$\{requestId\}\/responses/);
|
||||
assert.match(api, /\/api\/v1\/scheduling\/requests\/\$\{requestId\}\/responses\/me/);
|
||||
assert.match(api, /issueSchedulingParticipantInvitation\([\s\S]*json\(\{ action, participant_revision: participantRevision \}\)/);
|
||||
assert.match(api, /revokeSchedulingParticipantInvitation\([\s\S]*method: "DELETE"[\s\S]*participant_revision: participantRevision/);
|
||||
assert.match(api, /participants\/\$\{encodeURIComponent\(participantId\)\}\/invitation/);
|
||||
assert.match(api, /\/api\/v1\/scheduling\/public\/\$\{encodeURIComponent\(requestId\)\}\/\$\{encodeURIComponent\(token\)\}/);
|
||||
assert.match(api, /\/api\/v1\/scheduling\/public-enrollment\/\$\{encodeURIComponent\(requestId\)\}\/\$\{encodeURIComponent\(token\)\}/);
|
||||
assert.match(page, /useSearchParams\(\)/);
|
||||
assert.match(page, /Promise\.allSettled/);
|
||||
|
||||
assert.match(moduleSource, /publicRoutes:[\s\S]*path: "\/scheduling\/public\/:requestId\/:token"/);
|
||||
assert.match(moduleSource, /SchedulingPublicPage/);
|
||||
assert.match(moduleSource, /path: "\/scheduling\/enrol\/:requestId\/:token"/);
|
||||
assert.match(moduleSource, /SchedulingEnrollmentPage/);
|
||||
assert.match(publicPage, /Card,[\s\S]*DismissibleAlert,[\s\S]*DocumentationHelpLink,[\s\S]*FormField,[\s\S]*LoadingFrame,[\s\S]*PasswordField,[\s\S]*from "@govoplan\/core-webui"/);
|
||||
assert.match(publicPage, /<PasswordField[\s\S]*autoComplete="current-password"/);
|
||||
assert.doesNotMatch(publicPage, /<input[\s\S]{0,120}type="password"/);
|
||||
assert.match(publicPage, /topicId: "scheduling\.find-and-decide-meeting-time"/);
|
||||
assert.match(publicPage, /disabledReason=\{saving \? I18N\.saving/);
|
||||
assert.match(publicPage, /getPublicSchedulingParticipation\(settings, requestId, token, \{\}\)/);
|
||||
assert.match(publicPage, /applySchedulingAvailabilityChoice\(/);
|
||||
assert.match(publicPage, /option_revision: slot\.revision/);
|
||||
assert.match(publicPage, /idempotency_key: newIdempotencyKey\(\)/);
|
||||
assert.doesNotMatch(publicPage, /window\.(?:alert|confirm)\(/);
|
||||
assert.doesNotMatch(publicPage, /(?:localStorage|sessionStorage).*token|token.*(?:localStorage|sessionStorage)/);
|
||||
|
||||
assert.match(enrollmentPage, /submitAuthenticatedSchedulingEnrollment/);
|
||||
assert.match(enrollmentPage, /submitPublicSchedulingEnrollment/);
|
||||
assert.match(enrollmentPage, /bind_account_confirmed: true/);
|
||||
assert.match(enrollmentPage, /participant_proof:/);
|
||||
assert.match(enrollmentPage, /topicId: "scheduling\.public-self-enrollment"/);
|
||||
assert.doesNotMatch(enrollmentPage, /window\.(?:alert|confirm)\(/);
|
||||
assert.doesNotMatch(enrollmentPage, /(?:localStorage|sessionStorage).*(?:token|proof)|(?:token|proof).*(?:localStorage|sessionStorage)/);
|
||||
|
||||
assert.match(widget, /DocumentationHelpLink/);
|
||||
assert.match(widget, /to: `\/scheduling\?request_id=\$\{encodeURIComponent\(request\.id\)\}`/);
|
||||
assert.match(widget, /label=\{request\.status === "collecting" \? I18N\.open : I18N\.draft\}/);
|
||||
assert.doesNotMatch(widget, /Loading scheduling requests|Open scheduling|No scheduling requests are awaiting responses/);
|
||||
|
||||
console.log("Scheduling pages satisfy the two-pane editor, public response, and policy contracts.");
|
||||
@@ -0,0 +1,637 @@
|
||||
import {
|
||||
apiFetch,
|
||||
type ApiSettings,
|
||||
type PeoplePickerSearchGroup
|
||||
} from "@govoplan/core-webui";
|
||||
|
||||
export type SchedulingStatus = "draft" | "collecting" | "closed" | "decided" | "handed_off" | "cancelled" | "archived";
|
||||
export type SchedulingParticipantVisibility = "aggregates_only" | "names_and_statuses";
|
||||
|
||||
export type SchedulingCandidateSlot = {
|
||||
id: string;
|
||||
poll_option_id?: string | null;
|
||||
label: string;
|
||||
description?: string | null;
|
||||
start_at: string;
|
||||
end_at: string;
|
||||
timezone: string;
|
||||
location?: string | null;
|
||||
position: number;
|
||||
revision: string;
|
||||
freebusy_checked_at?: string | null;
|
||||
freebusy_status?: string | null;
|
||||
freebusy_conflicts: Record<string, unknown>[];
|
||||
tentative_hold_event_id?: string | null;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type SchedulingParticipant = {
|
||||
id: string;
|
||||
revision?: string | null;
|
||||
is_current_participant: boolean;
|
||||
respondent_id?: string | null;
|
||||
display_name?: string | null;
|
||||
email?: string | null;
|
||||
participant_type: string | null;
|
||||
required: boolean | null;
|
||||
status: string;
|
||||
poll_invitation_id?: string | null;
|
||||
invitation_token?: string | null;
|
||||
last_invited_at?: string | null;
|
||||
responded_at?: string | null;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type SchedulingParticipantAggregate = {
|
||||
total: number;
|
||||
status_counts: Record<string, number>;
|
||||
};
|
||||
|
||||
export type SchedulingParticipantVisibilityDecision = {
|
||||
requested_visibility: SchedulingParticipantVisibility;
|
||||
effective_visibility: SchedulingParticipantVisibility;
|
||||
policy_applied: boolean;
|
||||
reason?: string | null;
|
||||
source_path: Record<string, unknown>[];
|
||||
details: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type SchedulingRequest = {
|
||||
id: string;
|
||||
tenant_id: string | null;
|
||||
title: string;
|
||||
description?: string | null;
|
||||
location?: string | null;
|
||||
timezone: string;
|
||||
status: SchedulingStatus;
|
||||
poll_id?: string | null;
|
||||
selected_slot_id?: string | null;
|
||||
organizer_user_id?: string | null;
|
||||
deadline_at?: string | null;
|
||||
allow_external_participants: boolean;
|
||||
allow_participant_updates: boolean;
|
||||
result_visibility: string;
|
||||
participant_visibility: SchedulingParticipantVisibility;
|
||||
effective_participant_visibility: SchedulingParticipantVisibility;
|
||||
participant_aggregate: SchedulingParticipantAggregate;
|
||||
participant_visibility_decision: SchedulingParticipantVisibilityDecision;
|
||||
notify_on_answers: boolean;
|
||||
single_choice: boolean;
|
||||
max_participants_per_option: number | null;
|
||||
allow_maybe: boolean;
|
||||
allow_comments: boolean;
|
||||
participant_email_required: boolean;
|
||||
anonymous_password_protection_enabled: boolean;
|
||||
public_participation_policy_enforcement_available: boolean | null;
|
||||
public_participation_policy_enforcement_reason?: string | null;
|
||||
participant_invitation_delivery_available: boolean | null;
|
||||
calendar_integration_enabled: boolean | null;
|
||||
calendar_id?: string | null;
|
||||
calendar_freebusy_enabled: boolean | null;
|
||||
calendar_hold_enabled: boolean | null;
|
||||
create_calendar_event_on_decision: boolean | null;
|
||||
calendar_event_id?: string | null;
|
||||
handed_off_at?: string | null;
|
||||
cancelled_at?: string | null;
|
||||
cancellation_notice_until?: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
slots: SchedulingCandidateSlot[];
|
||||
participants: SchedulingParticipant[];
|
||||
};
|
||||
|
||||
export type SchedulingRequestListResponse = { requests: SchedulingRequest[] };
|
||||
export type SchedulingStatusResponse = { request: SchedulingRequest };
|
||||
|
||||
export type SchedulingCandidateSlotPayload = {
|
||||
label?: string | null;
|
||||
description?: string | null;
|
||||
start_at: string;
|
||||
end_at: string;
|
||||
timezone?: string | null;
|
||||
location?: string | null;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type SchedulingParticipantPayload = {
|
||||
respondent_id?: string | null;
|
||||
display_name?: string | null;
|
||||
email?: string | null;
|
||||
participant_type?: "internal" | "external" | "resource";
|
||||
required?: boolean;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type SchedulingRequestCreatePayload = {
|
||||
title: string;
|
||||
description?: string | null;
|
||||
location?: string | null;
|
||||
timezone?: string;
|
||||
status?: "draft" | "collecting";
|
||||
deadline_at?: string | null;
|
||||
allow_external_participants?: boolean;
|
||||
allow_participant_updates?: boolean;
|
||||
result_visibility?: "organizer" | "after_response" | "after_close" | "public";
|
||||
participant_visibility?: SchedulingParticipantVisibility;
|
||||
notify_on_answers?: boolean;
|
||||
single_choice?: boolean;
|
||||
max_participants_per_option?: number | null;
|
||||
allow_maybe?: boolean;
|
||||
allow_comments?: boolean;
|
||||
participant_email_required?: boolean;
|
||||
anonymous_password_protection_enabled?: boolean;
|
||||
anonymous_password?: string;
|
||||
calendar?: {
|
||||
enabled?: boolean;
|
||||
calendar_id?: string | null;
|
||||
freebusy_enabled?: boolean;
|
||||
tentative_holds_enabled?: boolean;
|
||||
create_event_on_decision?: boolean;
|
||||
};
|
||||
slots: SchedulingCandidateSlotPayload[];
|
||||
participants?: SchedulingParticipantPayload[];
|
||||
create_participant_invitations?: boolean;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type SchedulingRequestUpdatePayload = Omit<
|
||||
SchedulingRequestCreatePayload,
|
||||
"timezone" | "status" | "slots" | "participants"
|
||||
> & {
|
||||
slots?: SchedulingCandidateSlotReconcilePayload[];
|
||||
participants?: SchedulingParticipantReconcilePayload[];
|
||||
};
|
||||
|
||||
export type SchedulingCandidateSlotReconcilePayload = SchedulingCandidateSlotPayload & {
|
||||
id?: string;
|
||||
revision?: string;
|
||||
};
|
||||
|
||||
export type SchedulingParticipantReconcilePayload = SchedulingParticipantPayload & {
|
||||
id?: string;
|
||||
revision?: string;
|
||||
};
|
||||
|
||||
export type SchedulingCandidateSlotUpdatePayload = {
|
||||
label?: string | null;
|
||||
description?: string | null;
|
||||
start_at?: string | null;
|
||||
end_at?: string | null;
|
||||
timezone?: string | null;
|
||||
location?: string | null;
|
||||
metadata?: Record<string, unknown> | null;
|
||||
};
|
||||
|
||||
export type SchedulingDecisionPayload = {
|
||||
slot_id?: string | null;
|
||||
poll_option_id?: string | null;
|
||||
handoff_to_calendar?: boolean | null;
|
||||
};
|
||||
|
||||
export type SchedulingAvailabilityValue = "available" | "maybe" | "unavailable";
|
||||
|
||||
export type SchedulingAvailabilityPayload = {
|
||||
answers: Array<{
|
||||
slot_id: string;
|
||||
value: SchedulingAvailabilityValue;
|
||||
option_revision: string;
|
||||
}>;
|
||||
comment?: string | null;
|
||||
};
|
||||
|
||||
export type SchedulingAvailabilityResponse = {
|
||||
request_id: string;
|
||||
participant_id: string;
|
||||
has_response: boolean;
|
||||
submitted_at?: string | null;
|
||||
comment?: string | null;
|
||||
answers: Array<{
|
||||
slot_id: string;
|
||||
value: SchedulingAvailabilityValue;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type SchedulingPublicCandidateSlot = {
|
||||
id: string;
|
||||
label: string;
|
||||
description?: string | null;
|
||||
start_at: string;
|
||||
end_at: string;
|
||||
timezone: string;
|
||||
location?: string | null;
|
||||
position: number;
|
||||
revision: string;
|
||||
};
|
||||
|
||||
export type SchedulingPublicParticipationResponse = {
|
||||
request_id: string;
|
||||
title: string;
|
||||
description?: string | null;
|
||||
location?: string | null;
|
||||
timezone: string;
|
||||
status: SchedulingStatus;
|
||||
deadline_at?: string | null;
|
||||
cancelled_at?: string | null;
|
||||
cancellation_notice_until?: string | null;
|
||||
cancellation_notice_only: boolean;
|
||||
participant_email_required: boolean;
|
||||
anonymous_password_required: boolean;
|
||||
single_choice: boolean;
|
||||
max_participants_per_option: number | null;
|
||||
allow_maybe: boolean;
|
||||
allow_comments: boolean;
|
||||
allow_participant_updates: boolean;
|
||||
has_response: boolean;
|
||||
submitted_at?: string | null;
|
||||
answers: Array<{
|
||||
slot_id: string;
|
||||
value: SchedulingAvailabilityValue;
|
||||
}>;
|
||||
comment?: string | null;
|
||||
replayed: boolean;
|
||||
slots: SchedulingPublicCandidateSlot[];
|
||||
};
|
||||
|
||||
export type SchedulingPublicParticipationAccessPayload = {
|
||||
participant_email?: string | null;
|
||||
password?: string | null;
|
||||
};
|
||||
|
||||
export type SchedulingPublicParticipationSubmitPayload = SchedulingPublicParticipationAccessPayload & {
|
||||
answers: SchedulingAvailabilityPayload["answers"];
|
||||
comment?: string | null;
|
||||
idempotency_key?: string;
|
||||
};
|
||||
|
||||
export type SchedulingEnrollmentLink = {
|
||||
id: string;
|
||||
request_id: string;
|
||||
status: "active" | "expired" | "revoked" | "exhausted";
|
||||
expires_at: string;
|
||||
max_enrollments: number;
|
||||
enrollment_count: number;
|
||||
allow_anonymous: boolean;
|
||||
allow_authenticated: boolean;
|
||||
created_at: string;
|
||||
revoked_at?: string | null;
|
||||
};
|
||||
|
||||
export type SchedulingEnrollmentLinkListResponse = { links: SchedulingEnrollmentLink[] };
|
||||
|
||||
export type SchedulingEnrollmentLinkActionResponse = {
|
||||
link: SchedulingEnrollmentLink;
|
||||
action_url?: string | null;
|
||||
replayed: boolean;
|
||||
};
|
||||
|
||||
export type SchedulingEnrollmentLinkCreatePayload = {
|
||||
expires_at: string;
|
||||
max_enrollments: number;
|
||||
allow_anonymous: boolean;
|
||||
allow_authenticated: boolean;
|
||||
};
|
||||
|
||||
export type SchedulingPublicEnrollmentResponse = {
|
||||
request_id: string;
|
||||
link_id: string;
|
||||
title: string;
|
||||
description?: string | null;
|
||||
location?: string | null;
|
||||
timezone: string;
|
||||
status: SchedulingStatus;
|
||||
deadline_at?: string | null;
|
||||
enrollment_expires_at: string;
|
||||
enrollment_remaining: number;
|
||||
display_name_required: boolean;
|
||||
participant_email_required: boolean;
|
||||
anonymous_allowed: boolean;
|
||||
authenticated_allowed: boolean;
|
||||
anonymous_password_required: boolean;
|
||||
single_choice: boolean;
|
||||
max_participants_per_option: number | null;
|
||||
allow_maybe: boolean;
|
||||
allow_comments: boolean;
|
||||
allow_participant_updates: boolean;
|
||||
enrolled: boolean;
|
||||
account_bound: boolean;
|
||||
has_response: boolean;
|
||||
submitted_at?: string | null;
|
||||
answers: Array<{ slot_id: string; value: SchedulingAvailabilityValue }>;
|
||||
comment?: string | null;
|
||||
replayed: boolean;
|
||||
slots: SchedulingPublicCandidateSlot[];
|
||||
};
|
||||
|
||||
export type SchedulingPublicEnrollmentSubmitPayload = SchedulingAvailabilityPayload & {
|
||||
display_name: string;
|
||||
email?: string | null;
|
||||
password?: string | null;
|
||||
participant_proof: string;
|
||||
idempotency_key: string;
|
||||
};
|
||||
|
||||
export type SchedulingAuthenticatedEnrollmentSubmitPayload = SchedulingAvailabilityPayload & {
|
||||
display_name: string;
|
||||
email?: string | null;
|
||||
password?: string | null;
|
||||
bind_account_confirmed: boolean;
|
||||
participant_proof?: string | null;
|
||||
idempotency_key: string;
|
||||
};
|
||||
|
||||
export type SchedulingCalendarActionResponse = {
|
||||
request: SchedulingRequest;
|
||||
created_event_ids: string[];
|
||||
updated_slot_ids: string[];
|
||||
warnings: string[];
|
||||
};
|
||||
|
||||
export type SchedulingNotification = {
|
||||
id: string;
|
||||
request_id: string;
|
||||
participant_id?: string | null;
|
||||
event_kind: string;
|
||||
channel: string;
|
||||
recipient?: string | null;
|
||||
status: string;
|
||||
payload: Record<string, unknown>;
|
||||
error?: string | null;
|
||||
sent_at?: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type SchedulingNotificationListResponse = { notifications: SchedulingNotification[] };
|
||||
|
||||
export type SchedulingInvitationAction = "copy" | "send" | "revoke";
|
||||
|
||||
export type SchedulingInvitationActionResponse = {
|
||||
participant_id: string;
|
||||
action: SchedulingInvitationAction;
|
||||
status: string;
|
||||
action_url?: string | null;
|
||||
issued_at?: string | null;
|
||||
replayed: boolean;
|
||||
notification?: SchedulingNotification | null;
|
||||
};
|
||||
|
||||
export type SchedulingPollOptionResult = {
|
||||
option_id: string;
|
||||
option_key: string;
|
||||
label: string;
|
||||
count: number;
|
||||
score: number;
|
||||
values: Record<string, number>;
|
||||
};
|
||||
|
||||
export type SchedulingSummaryResponse = {
|
||||
request: SchedulingRequest;
|
||||
poll_summary: {
|
||||
poll_id: string;
|
||||
kind: string;
|
||||
status: string;
|
||||
response_count: number;
|
||||
option_results: SchedulingPollOptionResult[];
|
||||
leading_option_ids: string[];
|
||||
};
|
||||
};
|
||||
|
||||
export type SchedulingPeopleSearchResponse = {
|
||||
groups: PeoplePickerSearchGroup[];
|
||||
};
|
||||
|
||||
const json = (payload: unknown) => ({ method: "POST", body: JSON.stringify(payload ?? {}) });
|
||||
|
||||
export async function searchSchedulingPeople(
|
||||
settings: ApiSettings,
|
||||
query: string,
|
||||
limit = 25,
|
||||
signal?: AbortSignal
|
||||
): Promise<PeoplePickerSearchGroup[]> {
|
||||
const params = new URLSearchParams({ query, limit: String(limit) });
|
||||
const response = await apiFetch<SchedulingPeopleSearchResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/people?${params.toString()}`,
|
||||
{ signal }
|
||||
);
|
||||
return response.groups;
|
||||
}
|
||||
|
||||
export function listSchedulingRequests(settings: ApiSettings, status?: string): Promise<SchedulingRequestListResponse> {
|
||||
const query = status ? `?status=${encodeURIComponent(status)}` : "";
|
||||
return apiFetch<SchedulingRequestListResponse>(settings, `/api/v1/scheduling/requests${query}`);
|
||||
}
|
||||
|
||||
export function createSchedulingRequest(settings: ApiSettings, payload: SchedulingRequestCreatePayload): Promise<SchedulingRequest> {
|
||||
return apiFetch<SchedulingRequest>(settings, "/api/v1/scheduling/requests", json(payload));
|
||||
}
|
||||
|
||||
export function updateSchedulingRequest(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
payload: SchedulingRequestUpdatePayload
|
||||
): Promise<SchedulingRequest> {
|
||||
return apiFetch<SchedulingRequest>(settings, `/api/v1/scheduling/requests/${requestId}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export function updateSchedulingCandidateSlot(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
slotId: string,
|
||||
payload: SchedulingCandidateSlotUpdatePayload
|
||||
): Promise<SchedulingRequest> {
|
||||
return apiFetch<SchedulingRequest>(settings, `/api/v1/scheduling/requests/${requestId}/slots/${slotId}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export function submitSchedulingAvailability(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
payload: SchedulingAvailabilityPayload
|
||||
): Promise<SchedulingStatusResponse> {
|
||||
return apiFetch<SchedulingStatusResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/responses`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function getSchedulingAvailabilityResponse(
|
||||
settings: ApiSettings,
|
||||
requestId: string
|
||||
): Promise<SchedulingAvailabilityResponse> {
|
||||
return apiFetch<SchedulingAvailabilityResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/responses/me`
|
||||
);
|
||||
}
|
||||
|
||||
export function getPublicSchedulingParticipation(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
payload: SchedulingPublicParticipationAccessPayload
|
||||
): Promise<SchedulingPublicParticipationResponse> {
|
||||
return apiFetch<SchedulingPublicParticipationResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function submitPublicSchedulingParticipation(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
payload: SchedulingPublicParticipationSubmitPayload
|
||||
): Promise<SchedulingPublicParticipationResponse> {
|
||||
return apiFetch<SchedulingPublicParticipationResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}/responses`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function listSchedulingEnrollmentLinks(
|
||||
settings: ApiSettings,
|
||||
requestId: string
|
||||
): Promise<SchedulingEnrollmentLinkListResponse> {
|
||||
return apiFetch<SchedulingEnrollmentLinkListResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/enrollment-links`
|
||||
);
|
||||
}
|
||||
|
||||
export function createSchedulingEnrollmentLink(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
payload: SchedulingEnrollmentLinkCreatePayload
|
||||
): Promise<SchedulingEnrollmentLinkActionResponse> {
|
||||
return apiFetch<SchedulingEnrollmentLinkActionResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/enrollment-links`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function revokeSchedulingEnrollmentLink(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
linkId: string
|
||||
): Promise<SchedulingEnrollmentLinkActionResponse> {
|
||||
return apiFetch<SchedulingEnrollmentLinkActionResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${requestId}/enrollment-links/${linkId}`,
|
||||
{ method: "DELETE" }
|
||||
);
|
||||
}
|
||||
|
||||
export function getPublicSchedulingEnrollment(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
password?: string
|
||||
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}`,
|
||||
json({ password: password || null })
|
||||
);
|
||||
}
|
||||
|
||||
export function submitPublicSchedulingEnrollment(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
payload: SchedulingPublicEnrollmentSubmitPayload
|
||||
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}/responses`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function submitAuthenticatedSchedulingEnrollment(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
token: string,
|
||||
payload: SchedulingAuthenticatedEnrollmentSubmitPayload
|
||||
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}/authenticated-responses`,
|
||||
json(payload)
|
||||
);
|
||||
}
|
||||
|
||||
export function openSchedulingRequest(settings: ApiSettings, requestId: string): Promise<SchedulingStatusResponse> {
|
||||
return apiFetch<SchedulingStatusResponse>(settings, `/api/v1/scheduling/requests/${requestId}/open`, json({}));
|
||||
}
|
||||
|
||||
export function closeSchedulingRequest(settings: ApiSettings, requestId: string): Promise<SchedulingStatusResponse> {
|
||||
return apiFetch<SchedulingStatusResponse>(settings, `/api/v1/scheduling/requests/${requestId}/close`, json({}));
|
||||
}
|
||||
|
||||
export function decideSchedulingRequest(settings: ApiSettings, requestId: string, payload: SchedulingDecisionPayload): Promise<SchedulingStatusResponse> {
|
||||
return apiFetch<SchedulingStatusResponse>(settings, `/api/v1/scheduling/requests/${requestId}/decide`, json(payload));
|
||||
}
|
||||
|
||||
export function evaluateSchedulingFreeBusy(settings: ApiSettings, requestId: string): Promise<SchedulingCalendarActionResponse> {
|
||||
return apiFetch<SchedulingCalendarActionResponse>(settings, `/api/v1/scheduling/requests/${requestId}/calendar/freebusy`, json({}));
|
||||
}
|
||||
|
||||
export function createSchedulingHolds(settings: ApiSettings, requestId: string): Promise<SchedulingCalendarActionResponse> {
|
||||
return apiFetch<SchedulingCalendarActionResponse>(settings, `/api/v1/scheduling/requests/${requestId}/calendar/holds`, json({}));
|
||||
}
|
||||
|
||||
export function createSchedulingCalendarEvent(settings: ApiSettings, requestId: string): Promise<SchedulingCalendarActionResponse> {
|
||||
return apiFetch<SchedulingCalendarActionResponse>(settings, `/api/v1/scheduling/requests/${requestId}/calendar/event`, json({}));
|
||||
}
|
||||
|
||||
export function schedulingSummary(settings: ApiSettings, requestId: string): Promise<SchedulingSummaryResponse> {
|
||||
return apiFetch<SchedulingSummaryResponse>(settings, `/api/v1/scheduling/requests/${requestId}/summary`);
|
||||
}
|
||||
|
||||
export function createSchedulingNotifications(settings: ApiSettings, requestId: string, eventKind: string): Promise<SchedulingNotificationListResponse> {
|
||||
return apiFetch<SchedulingNotificationListResponse>(settings, `/api/v1/scheduling/requests/${requestId}/notifications`, json({ event_kind: eventKind }));
|
||||
}
|
||||
|
||||
export function listSchedulingNotifications(settings: ApiSettings, requestId?: string): Promise<SchedulingNotificationListResponse> {
|
||||
const query = requestId ? `?request_id=${encodeURIComponent(requestId)}` : "";
|
||||
return apiFetch<SchedulingNotificationListResponse>(settings, `/api/v1/scheduling/notifications${query}`);
|
||||
}
|
||||
|
||||
export function issueSchedulingParticipantInvitation(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
participantId: string,
|
||||
participantRevision: string,
|
||||
action: Exclude<SchedulingInvitationAction, "revoke">
|
||||
): Promise<SchedulingInvitationActionResponse> {
|
||||
return apiFetch<SchedulingInvitationActionResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${encodeURIComponent(requestId)}/participants/${encodeURIComponent(participantId)}/invitation`,
|
||||
json({ action, participant_revision: participantRevision })
|
||||
);
|
||||
}
|
||||
|
||||
export function revokeSchedulingParticipantInvitation(
|
||||
settings: ApiSettings,
|
||||
requestId: string,
|
||||
participantId: string,
|
||||
participantRevision: string
|
||||
): Promise<SchedulingInvitationActionResponse> {
|
||||
return apiFetch<SchedulingInvitationActionResponse>(
|
||||
settings,
|
||||
`/api/v1/scheduling/requests/${encodeURIComponent(requestId)}/participants/${encodeURIComponent(participantId)}/invitation`,
|
||||
{ method: "DELETE", body: JSON.stringify({ participant_revision: participantRevision }) }
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
||||
import { Link, useParams } from "react-router";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DismissibleAlert,
|
||||
DocumentationHelpLink,
|
||||
FormField,
|
||||
FormGrid,
|
||||
LoadingFrame,
|
||||
PasswordField,
|
||||
formatDateTime,
|
||||
type ApiSettings,
|
||||
type AuthInfo
|
||||
} from "@govoplan/core-webui";
|
||||
import {
|
||||
getPublicSchedulingEnrollment,
|
||||
submitAuthenticatedSchedulingEnrollment,
|
||||
submitPublicSchedulingEnrollment,
|
||||
type SchedulingAvailabilityValue,
|
||||
type SchedulingPublicEnrollmentResponse
|
||||
} from "../../api/scheduling";
|
||||
import { applySchedulingAvailabilityChoice } from "./schedulingViewModel";
|
||||
|
||||
type SchedulingEnrollmentPageProps = {
|
||||
settings: ApiSettings;
|
||||
auth: AuthInfo | null;
|
||||
};
|
||||
|
||||
const I18N = {
|
||||
access: "i18n:govoplan-scheduling.self_enrollment.access",
|
||||
answerRequired: "i18n:govoplan-scheduling.choose_availability_for_at_least_one_candidate_slot.28d2111f",
|
||||
available: "i18n:govoplan-scheduling.available.7c62a142",
|
||||
back: "i18n:govoplan-scheduling.open_in_scheduling.48df1541",
|
||||
bindAccount: "i18n:govoplan-scheduling.self_enrollment.bind_account",
|
||||
bindHelp: "i18n:govoplan-scheduling.self_enrollment.bind_help",
|
||||
claimAnonymous: "i18n:govoplan-scheduling.self_enrollment.claim_anonymous",
|
||||
comment: "i18n:govoplan-scheduling.comment.d03495b1",
|
||||
deadline: "i18n:govoplan-scheduling.response_deadline.7fd9e3aa",
|
||||
displayName: "i18n:govoplan-scheduling.name.709a2322",
|
||||
email: "i18n:govoplan-scheduling.participant_email.2cadfd9e",
|
||||
expires: "i18n:govoplan-scheduling.self_enrollment.expires",
|
||||
invalid: "i18n:govoplan-scheduling.self_enrollment.invalid",
|
||||
loading: "i18n:govoplan-scheduling.loading_scheduling_request.43c39c1b",
|
||||
maybe: "i18n:govoplan-scheduling.maybe.56dd8d0b",
|
||||
participantDetails: "i18n:govoplan-scheduling.self_enrollment.participant_details",
|
||||
password: "i18n:govoplan-scheduling.guest_password.94545e82",
|
||||
proof: "i18n:govoplan-scheduling.self_enrollment.proof",
|
||||
proofHelp: "i18n:govoplan-scheduling.self_enrollment.proof_help",
|
||||
remaining: "i18n:govoplan-scheduling.self_enrollment.remaining",
|
||||
response: "i18n:govoplan-scheduling.your_availability.f86c8215",
|
||||
saved: "i18n:govoplan-scheduling.self_enrollment.saved",
|
||||
saving: "i18n:govoplan-scheduling.saving.56a2285c",
|
||||
submit: "i18n:govoplan-scheduling.self_enrollment.submit",
|
||||
unavailable: "i18n:govoplan-scheduling.unavailable.2c9c1f79"
|
||||
} as const;
|
||||
|
||||
function newSecret(prefix: string): string {
|
||||
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
|
||||
return `${prefix}-${crypto.randomUUID()}`;
|
||||
}
|
||||
return `${prefix}-${Date.now()}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`;
|
||||
}
|
||||
|
||||
function initialAvailability(response: SchedulingPublicEnrollmentResponse) {
|
||||
const previous = new Map(response.answers.map((answer) => [answer.slot_id, answer.value]));
|
||||
return Object.fromEntries(response.slots.map((slot) => [slot.id, previous.get(slot.id) ?? ""])) as Record<
|
||||
string,
|
||||
SchedulingAvailabilityValue | ""
|
||||
>;
|
||||
}
|
||||
|
||||
export default function SchedulingEnrollmentPage({ settings, auth }: SchedulingEnrollmentPageProps) {
|
||||
const { requestId = "", token = "" } = useParams();
|
||||
const [enrollment, setEnrollment] = useState<SchedulingPublicEnrollmentResponse | null>(null);
|
||||
const [displayName, setDisplayName] = useState(auth?.user.display_name ?? "");
|
||||
const [email, setEmail] = useState(auth?.user.email ?? "");
|
||||
const [password, setPassword] = useState("");
|
||||
const [proof, setProof] = useState(() => newSecret("scheduling-proof"));
|
||||
const [bindAccount, setBindAccount] = useState(Boolean(auth));
|
||||
const [claimAnonymous, setClaimAnonymous] = useState(false);
|
||||
const [availability, setAvailability] = useState<Record<string, SchedulingAvailabilityValue | "">>({});
|
||||
const [comment, setComment] = useState("");
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [needsAccess, setNeedsAccess] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [success, setSuccess] = useState("");
|
||||
|
||||
const slotIds = useMemo(() => enrollment?.slots.map((slot) => slot.id) ?? [], [enrollment]);
|
||||
|
||||
function applyResponse(next: SchedulingPublicEnrollmentResponse) {
|
||||
setEnrollment(next);
|
||||
setAvailability(initialAvailability(next));
|
||||
setComment(next.comment ?? "");
|
||||
setNeedsAccess(false);
|
||||
setError("");
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setLoading(true);
|
||||
void getPublicSchedulingEnrollment(settings, requestId, token)
|
||||
.then((next) => {
|
||||
if (!cancelled) applyResponse(next);
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) setNeedsAccess(true);
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [requestId, settings.apiBaseUrl, settings.apiKey, token]);
|
||||
|
||||
async function openEnrollment(event: FormEvent) {
|
||||
event.preventDefault();
|
||||
setLoading(true);
|
||||
setError("");
|
||||
try {
|
||||
applyResponse(await getPublicSchedulingEnrollment(settings, requestId, token, password));
|
||||
} catch {
|
||||
setError(I18N.invalid);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function submit(event: FormEvent) {
|
||||
event.preventDefault();
|
||||
if (!enrollment || !enrollment.slots.some((slot) => availability[slot.id])) {
|
||||
setError(I18N.answerRequired);
|
||||
return;
|
||||
}
|
||||
setSaving(true);
|
||||
setError("");
|
||||
setSuccess("");
|
||||
const common = {
|
||||
display_name: displayName.trim(),
|
||||
email: email.trim() || null,
|
||||
password: password || null,
|
||||
answers: enrollment.slots
|
||||
.filter((slot) => availability[slot.id])
|
||||
.map((slot) => ({
|
||||
slot_id: slot.id,
|
||||
value: availability[slot.id] as SchedulingAvailabilityValue,
|
||||
option_revision: slot.revision
|
||||
})),
|
||||
comment: enrollment.allow_comments ? comment.trim() || null : null,
|
||||
idempotency_key: newSecret("scheduling-enrollment")
|
||||
};
|
||||
try {
|
||||
const next = auth && bindAccount
|
||||
? await submitAuthenticatedSchedulingEnrollment(settings, requestId, token, {
|
||||
...common,
|
||||
bind_account_confirmed: true,
|
||||
participant_proof: claimAnonymous || (enrollment.enrolled && !enrollment.account_bound) ? proof : null
|
||||
})
|
||||
: await submitPublicSchedulingEnrollment(settings, requestId, token, {
|
||||
...common,
|
||||
participant_proof: proof
|
||||
});
|
||||
applyResponse(next);
|
||||
setSuccess(I18N.saved);
|
||||
} catch {
|
||||
setError(I18N.invalid);
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="scheduling-public-page">
|
||||
<LoadingFrame loading={loading} label={I18N.loading}>
|
||||
{auth ? (
|
||||
<div className="scheduling-public-deep-link">
|
||||
<Link className="btn btn-secondary" to={`/scheduling?request_id=${encodeURIComponent(requestId)}`}>
|
||||
{I18N.back}
|
||||
</Link>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{needsAccess && !enrollment ? (
|
||||
<Card title={I18N.access}>
|
||||
<form className="scheduling-public-access-form" onSubmit={openEnrollment}>
|
||||
{error ? <DismissibleAlert tone="danger">{error}</DismissibleAlert> : null}
|
||||
<FormField label={I18N.password}>
|
||||
<PasswordField
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onValueChange={setPassword} />
|
||||
</FormField>
|
||||
<div className="scheduling-public-actions">
|
||||
<Button type="submit" variant="primary" disabled={loading}>{I18N.access}</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{enrollment ? (
|
||||
<form className="scheduling-public-content" onSubmit={submit}>
|
||||
<Card
|
||||
title={enrollment.title}
|
||||
actions={<DocumentationHelpLink reference={{
|
||||
topicId: "scheduling.public-self-enrollment",
|
||||
documentationType: "user"
|
||||
}} />}>
|
||||
{enrollment.description ? <p>{enrollment.description}</p> : null}
|
||||
<dl className="scheduling-public-summary">
|
||||
{enrollment.deadline_at ? <><dt>{I18N.deadline}</dt><dd>{formatDateTime(enrollment.deadline_at)}</dd></> : null}
|
||||
<dt>{I18N.expires}</dt><dd>{formatDateTime(enrollment.enrollment_expires_at)}</dd>
|
||||
<dt>{I18N.remaining}</dt><dd>{enrollment.enrollment_remaining}</dd>
|
||||
</dl>
|
||||
</Card>
|
||||
|
||||
{error ? <DismissibleAlert tone="danger">{error}</DismissibleAlert> : null}
|
||||
{success ? <DismissibleAlert tone="success">{success}</DismissibleAlert> : null}
|
||||
|
||||
<Card title={I18N.participantDetails}>
|
||||
<FormGrid columns={2} collapseAt="standard" className="">
|
||||
<FormField label={I18N.displayName}>
|
||||
<input required maxLength={500} value={displayName} onChange={(event) => setDisplayName(event.target.value)} />
|
||||
</FormField>
|
||||
<FormField label={I18N.email}>
|
||||
<input type="email" required={enrollment.participant_email_required} maxLength={320} value={email} onChange={(event) => setEmail(event.target.value)} />
|
||||
</FormField>
|
||||
</FormGrid>
|
||||
{auth && enrollment.authenticated_allowed ? (
|
||||
<>
|
||||
<label className="scheduling-enrollment-confirmation">
|
||||
<input type="checkbox" checked={bindAccount} onChange={(event) => setBindAccount(event.target.checked)} />
|
||||
<span><strong>{I18N.bindAccount}</strong><small>{I18N.bindHelp}</small></span>
|
||||
</label>
|
||||
{bindAccount ? (
|
||||
<label className="scheduling-enrollment-confirmation">
|
||||
<input type="checkbox" checked={claimAnonymous} onChange={(event) => setClaimAnonymous(event.target.checked)} />
|
||||
<span>{I18N.claimAnonymous}</span>
|
||||
</label>
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
{((!auth || !bindAccount) && enrollment.anonymous_allowed) || claimAnonymous ? (
|
||||
<FormField label={I18N.proof} help={I18N.proofHelp}>
|
||||
<PasswordField
|
||||
autoComplete="off"
|
||||
value={proof}
|
||||
onValueChange={setProof} />
|
||||
</FormField>
|
||||
) : null}
|
||||
</Card>
|
||||
|
||||
<Card title={I18N.response}>
|
||||
<div className="scheduling-public-slots">
|
||||
{enrollment.slots.map((slot) => (
|
||||
<fieldset className="scheduling-public-slot" key={slot.id} disabled={saving}>
|
||||
<legend>{slot.label}</legend>
|
||||
<p>{formatDateTime(slot.start_at)} – {formatDateTime(slot.end_at)}</p>
|
||||
<div className="scheduling-public-choice-group">
|
||||
{([
|
||||
["available", I18N.available],
|
||||
...(enrollment.allow_maybe ? [["maybe", I18N.maybe] as const] : []),
|
||||
["unavailable", I18N.unavailable]
|
||||
] as Array<[SchedulingAvailabilityValue, string]>).map(([value, label]) => (
|
||||
<label key={value}>
|
||||
<input
|
||||
type="radio"
|
||||
name={`slot-${slot.id}`}
|
||||
checked={availability[slot.id] === value}
|
||||
onChange={() => setAvailability((current) => applySchedulingAvailabilityChoice(
|
||||
slotIds,
|
||||
current,
|
||||
slot.id,
|
||||
value,
|
||||
enrollment.single_choice
|
||||
))} />
|
||||
<span>{label}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
))}
|
||||
</div>
|
||||
{enrollment.allow_comments ? (
|
||||
<FormField label={I18N.comment}>
|
||||
<textarea rows={4} maxLength={4000} value={comment} onChange={(event) => setComment(event.target.value)} />
|
||||
</FormField>
|
||||
) : null}
|
||||
<div className="scheduling-public-actions">
|
||||
<Button type="submit" variant="primary" disabled={saving || !displayName.trim()}>
|
||||
{saving ? I18N.saving : I18N.submit}
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
</form>
|
||||
) : null}
|
||||
</LoadingFrame>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,304 @@
|
||||
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
||||
import { Link, useParams } from "react-router";
|
||||
import { FormGrid,
|
||||
Button,
|
||||
Card,
|
||||
DismissibleAlert,
|
||||
DocumentationHelpLink,
|
||||
FormField,
|
||||
LoadingFrame,
|
||||
PasswordField,
|
||||
formatDateTime,
|
||||
type ApiSettings,
|
||||
type AuthInfo
|
||||
} from "@govoplan/core-webui";
|
||||
import {
|
||||
getPublicSchedulingParticipation,
|
||||
submitPublicSchedulingParticipation,
|
||||
type SchedulingAvailabilityValue,
|
||||
type SchedulingPublicParticipationAccessPayload,
|
||||
type SchedulingPublicParticipationResponse
|
||||
} from "../../api/scheduling";
|
||||
import { applySchedulingAvailabilityChoice } from "./schedulingViewModel";
|
||||
|
||||
type SchedulingPublicPageProps = {
|
||||
settings: ApiSettings;
|
||||
auth: AuthInfo | null;
|
||||
};
|
||||
|
||||
const I18N = {
|
||||
accessDetails: "i18n:govoplan-scheduling.access_details.79c06b89",
|
||||
accessHelp: "i18n:govoplan-scheduling.enter_the_details_supplied_with_the_invitation_for_privacy.81ba419c",
|
||||
accessRequest: "i18n:govoplan-scheduling.open_scheduling_request.31829cce",
|
||||
alreadySubmitted: "i18n:govoplan-scheduling.responses_may_be_updated_while_this_request_remains_open.4faecbbe",
|
||||
answerRequired: "i18n:govoplan-scheduling.choose_availability_for_at_least_one_candidate_slot.28d2111f",
|
||||
available: "i18n:govoplan-scheduling.available.7c62a142",
|
||||
backToScheduling: "i18n:govoplan-scheduling.open_in_scheduling.48df1541",
|
||||
comment: "i18n:govoplan-scheduling.comment.d03495b1",
|
||||
cancelled: "i18n:govoplan-scheduling.this_scheduling_request_was_cancelled.1af3c85e",
|
||||
cancellationNoticeUntil: "i18n:govoplan-scheduling.cancellation_notice_available_until.f840d1e6",
|
||||
deadline: "i18n:govoplan-scheduling.response_deadline.7fd9e3aa",
|
||||
email: "i18n:govoplan-scheduling.participant_email.2cadfd9e",
|
||||
invalidAccess: "i18n:govoplan-scheduling.this_scheduling_link_is_invalid_expired_or_the_access_details.8e7aa197",
|
||||
loading: "i18n:govoplan-scheduling.loading_scheduling_request.43c39c1b",
|
||||
maybe: "i18n:govoplan-scheduling.maybe.56dd8d0b",
|
||||
noLongerOpen: "i18n:govoplan-scheduling.this_scheduling_request_is_no_longer_accepting_responses.c612e78a",
|
||||
password: "i18n:govoplan-scheduling.guest_password.94545e82",
|
||||
response: "i18n:govoplan-scheduling.your_availability.f86c8215",
|
||||
saved: "i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d",
|
||||
saving: "i18n:govoplan-scheduling.saving.56a2285c",
|
||||
submit: "i18n:govoplan-scheduling.submit_response.a5f0c053",
|
||||
unavailable: "i18n:govoplan-scheduling.unavailable.2c9c1f79"
|
||||
} as const;
|
||||
|
||||
function accessPayload(email: string, password: string): SchedulingPublicParticipationAccessPayload {
|
||||
return {
|
||||
participant_email: email.trim() || null,
|
||||
password: password || null
|
||||
};
|
||||
}
|
||||
|
||||
function initialAvailability(response: SchedulingPublicParticipationResponse): Record<string, SchedulingAvailabilityValue | ""> {
|
||||
const previous = new Map(response.answers.map((answer) => [answer.slot_id, answer.value]));
|
||||
return Object.fromEntries(response.slots.map((slot) => [slot.id, previous.get(slot.id) ?? ""]));
|
||||
}
|
||||
|
||||
function newIdempotencyKey(): string {
|
||||
if (typeof crypto !== "undefined" && "randomUUID" in crypto) return crypto.randomUUID();
|
||||
return `scheduling-response-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
||||
}
|
||||
|
||||
export default function SchedulingPublicPage({ settings, auth }: SchedulingPublicPageProps) {
|
||||
const { requestId = "", token = "" } = useParams();
|
||||
const [response, setResponse] = useState<SchedulingPublicParticipationResponse | null>(null);
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [availability, setAvailability] = useState<Record<string, SchedulingAvailabilityValue | "">>({});
|
||||
const [comment, setComment] = useState("");
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [accessAttempted, setAccessAttempted] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [success, setSuccess] = useState("");
|
||||
|
||||
const slotIds = useMemo(() => response?.slots.map((slot) => slot.id) ?? [], [response]);
|
||||
const collecting = response?.status === "collecting";
|
||||
|
||||
function applyResponse(next: SchedulingPublicParticipationResponse) {
|
||||
setResponse(next);
|
||||
setAvailability(initialAvailability(next));
|
||||
setComment(next.comment ?? "");
|
||||
setError("");
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setLoading(true);
|
||||
setResponse(null);
|
||||
setAccessAttempted(false);
|
||||
setError("");
|
||||
void getPublicSchedulingParticipation(settings, requestId, token, {})
|
||||
.then((next) => {
|
||||
if (!cancelled) applyResponse(next);
|
||||
})
|
||||
.catch(() => undefined)
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [requestId, settings.apiBaseUrl, settings.apiKey, token]);
|
||||
|
||||
async function openRequest(event: FormEvent) {
|
||||
event.preventDefault();
|
||||
setLoading(true);
|
||||
setAccessAttempted(true);
|
||||
setError("");
|
||||
try {
|
||||
applyResponse(await getPublicSchedulingParticipation(settings, requestId, token, accessPayload(email, password)));
|
||||
} catch {
|
||||
setResponse(null);
|
||||
setError(I18N.invalidAccess);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveResponse(event: FormEvent) {
|
||||
event.preventDefault();
|
||||
if (!response) return;
|
||||
if (!response.slots.some((slot) => availability[slot.id])) {
|
||||
setError(I18N.answerRequired);
|
||||
return;
|
||||
}
|
||||
setSaving(true);
|
||||
setError("");
|
||||
setSuccess("");
|
||||
try {
|
||||
const next = await submitPublicSchedulingParticipation(settings, requestId, token, {
|
||||
...accessPayload(email, password),
|
||||
answers: response.slots
|
||||
.filter((slot) => availability[slot.id])
|
||||
.map((slot) => ({
|
||||
slot_id: slot.id,
|
||||
value: availability[slot.id] as SchedulingAvailabilityValue,
|
||||
option_revision: slot.revision
|
||||
})),
|
||||
comment: response.allow_comments ? comment : null,
|
||||
idempotency_key: newIdempotencyKey()
|
||||
});
|
||||
applyResponse(next);
|
||||
setSuccess(I18N.saved);
|
||||
} catch {
|
||||
setError(I18N.invalidAccess);
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="scheduling-public-page">
|
||||
<LoadingFrame loading={loading} label={I18N.loading}>
|
||||
{auth && (
|
||||
<div className="scheduling-public-deep-link">
|
||||
<Link className="btn btn-secondary" to={`/scheduling?request_id=${encodeURIComponent(requestId)}`}>
|
||||
{I18N.backToScheduling}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!response && !loading && (
|
||||
<Card
|
||||
title={I18N.accessDetails}
|
||||
actions={(
|
||||
<DocumentationHelpLink
|
||||
reference={{
|
||||
topicId: "scheduling.find-and-decide-meeting-time",
|
||||
documentationType: "user"
|
||||
}} />
|
||||
)}>
|
||||
<form className="scheduling-public-access-form" onSubmit={openRequest}>
|
||||
<p className="muted">{I18N.accessHelp}</p>
|
||||
{accessAttempted && error && <DismissibleAlert tone="danger">{error}</DismissibleAlert>}
|
||||
<FormGrid columns={2} collapseAt="standard" className="">
|
||||
<FormField label={I18N.email}>
|
||||
<input
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
/>
|
||||
</FormField>
|
||||
<FormField label={I18N.password}>
|
||||
<PasswordField
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onValueChange={setPassword} />
|
||||
</FormField>
|
||||
</FormGrid>
|
||||
<div className="scheduling-public-actions">
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={loading}
|
||||
disabledReason={loading ? I18N.loading : undefined}>
|
||||
{I18N.accessRequest}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{response && (
|
||||
<form className="scheduling-public-content" onSubmit={saveResponse}>
|
||||
<Card
|
||||
title={response.title}
|
||||
actions={(
|
||||
<DocumentationHelpLink
|
||||
reference={{
|
||||
topicId: "scheduling.find-and-decide-meeting-time",
|
||||
documentationType: "user"
|
||||
}} />
|
||||
)}>
|
||||
{response.description && <p className="scheduling-public-description">{response.description}</p>}
|
||||
<dl className="scheduling-public-summary">
|
||||
{response.location && <><dt>i18n:govoplan-scheduling.location.d219c681</dt><dd>{response.location}</dd></>}
|
||||
{response.deadline_at && <><dt>{I18N.deadline}</dt><dd>{formatDateTime(response.deadline_at)}</dd></>}
|
||||
</dl>
|
||||
{response.cancellation_notice_only
|
||||
? <DismissibleAlert tone="warning" dismissible={false}>{I18N.cancelled}</DismissibleAlert>
|
||||
: !collecting && <DismissibleAlert tone="info" dismissible={false}>{I18N.noLongerOpen}</DismissibleAlert>}
|
||||
{response.has_response && collecting && <DismissibleAlert tone="info" dismissible={false}>{I18N.alreadySubmitted}</DismissibleAlert>}
|
||||
{response.cancellation_notice_only && response.cancellation_notice_until && (
|
||||
<p className="muted">{I18N.cancellationNoticeUntil}: {formatDateTime(response.cancellation_notice_until)}</p>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
{error && <DismissibleAlert tone="danger">{error}</DismissibleAlert>}
|
||||
{success && <DismissibleAlert tone="success">{success}</DismissibleAlert>}
|
||||
|
||||
{!response.cancellation_notice_only && <Card title={I18N.response}>
|
||||
<div className="scheduling-public-slots">
|
||||
{response.slots.map((slot) => (
|
||||
<fieldset className="scheduling-public-slot" key={slot.id} disabled={!collecting || saving}>
|
||||
<legend>{slot.label}</legend>
|
||||
<p>{formatDateTime(slot.start_at)} – {formatDateTime(slot.end_at)}</p>
|
||||
{slot.description && <p className="muted">{slot.description}</p>}
|
||||
{(slot.location || response.location) && <p className="muted">{slot.location || response.location}</p>}
|
||||
<div className="scheduling-public-choice-group">
|
||||
{([
|
||||
["available", I18N.available],
|
||||
...(response.allow_maybe ? [["maybe", I18N.maybe] as const] : []),
|
||||
["unavailable", I18N.unavailable]
|
||||
] as Array<[SchedulingAvailabilityValue, string]>).map(([value, label]) => (
|
||||
<label key={value}>
|
||||
<input
|
||||
type="radio"
|
||||
name={`slot-${slot.id}`}
|
||||
value={value}
|
||||
checked={availability[slot.id] === value}
|
||||
onChange={() => setAvailability((current) => applySchedulingAvailabilityChoice(
|
||||
slotIds,
|
||||
current,
|
||||
slot.id,
|
||||
value,
|
||||
response.single_choice
|
||||
))}
|
||||
/>
|
||||
<span>{label}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
))}
|
||||
</div>
|
||||
{response.allow_comments && (
|
||||
<FormField label={I18N.comment}>
|
||||
<textarea
|
||||
rows={4}
|
||||
maxLength={4000}
|
||||
disabled={!collecting || saving}
|
||||
value={comment}
|
||||
onChange={(event) => setComment(event.target.value)}
|
||||
/>
|
||||
</FormField>
|
||||
)}
|
||||
{collecting && (
|
||||
<div className="scheduling-public-actions">
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={saving}
|
||||
disabledReason={saving ? I18N.saving : undefined}>
|
||||
{I18N.submit}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Card>}
|
||||
</form>
|
||||
)}
|
||||
</LoadingFrame>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
import { useCallback, type ReactNode } from "react";
|
||||
import { CalendarClock } from "lucide-react";
|
||||
import { Link } from "react-router";
|
||||
import {
|
||||
DashboardWidgetList,
|
||||
DismissibleAlert,
|
||||
DocumentationHelpLink,
|
||||
LoadingFrame,
|
||||
StatusBadge,
|
||||
formatDateTime,
|
||||
useDashboardWidgetData,
|
||||
type ApiSettings,
|
||||
type DashboardWidgetConfiguration
|
||||
} from "@govoplan/core-webui";
|
||||
import {
|
||||
listSchedulingRequests,
|
||||
type SchedulingRequest
|
||||
} from "../../api/scheduling";
|
||||
|
||||
const I18N = {
|
||||
candidateSlots: "i18n:govoplan-scheduling.candidate_slots.c414946b",
|
||||
deadline: "i18n:govoplan-scheduling.response_deadline.7fd9e3aa",
|
||||
draft: "i18n:govoplan-scheduling.draft.23d33e22",
|
||||
empty: "i18n:govoplan-scheduling.no_scheduling_request_selected.ac940664",
|
||||
loading: "i18n:govoplan-scheduling.loading_scheduling_requests.f42be95d",
|
||||
open: "i18n:govoplan-scheduling.open.cf9b7706",
|
||||
openScheduling: "i18n:govoplan-scheduling.open_in_scheduling.48df1541",
|
||||
responded: "i18n:govoplan-scheduling.responded.4f218211"
|
||||
} as const;
|
||||
|
||||
export default function SchedulingRequestsWidget({
|
||||
settings,
|
||||
refreshKey,
|
||||
configuration
|
||||
}: {
|
||||
settings: ApiSettings;
|
||||
refreshKey: number;
|
||||
configuration: DashboardWidgetConfiguration;
|
||||
}) {
|
||||
const maxItems = numberSetting(configuration.maxItems, 5, 1, 12);
|
||||
const includeDrafts = configuration.includeDrafts === true;
|
||||
const load = useCallback(async () => {
|
||||
const response = await listSchedulingRequests(settings);
|
||||
return response.requests
|
||||
.filter(
|
||||
(request) =>
|
||||
request.status === "collecting"
|
||||
|| (includeDrafts && request.status === "draft")
|
||||
)
|
||||
.sort(compareRequests)
|
||||
.slice(0, maxItems);
|
||||
}, [includeDrafts, maxItems, settings]);
|
||||
const { data: requests, loading, error } = useDashboardWidgetData(
|
||||
load,
|
||||
refreshKey
|
||||
);
|
||||
|
||||
return (
|
||||
<LoadingFrame loading={loading} label={I18N.loading}>
|
||||
{error && (
|
||||
<DismissibleAlert tone="warning" resetKey={error}>
|
||||
{error}
|
||||
</DismissibleAlert>
|
||||
)}
|
||||
<DashboardWidgetList
|
||||
emptyText={I18N.empty}
|
||||
items={(requests ?? []).map((request) => ({
|
||||
id: request.id,
|
||||
title: request.title,
|
||||
detail: responseLabel(request),
|
||||
meta: deadlineLabel(request),
|
||||
leading: <CalendarClock size={17} aria-hidden="true" />,
|
||||
trailing: (
|
||||
<StatusBadge
|
||||
status={request.status}
|
||||
label={request.status === "collecting" ? I18N.open : I18N.draft}
|
||||
/>
|
||||
),
|
||||
to: `/scheduling?request_id=${encodeURIComponent(request.id)}`
|
||||
}))}
|
||||
/>
|
||||
<div className="dashboard-contribution-footer">
|
||||
<DocumentationHelpLink
|
||||
reference={{
|
||||
topicId: "scheduling.find-and-decide-meeting-time",
|
||||
documentationType: "user"
|
||||
}} />
|
||||
<Link className="btn btn-secondary" to="/scheduling">
|
||||
{I18N.openScheduling}
|
||||
</Link>
|
||||
</div>
|
||||
</LoadingFrame>
|
||||
);
|
||||
}
|
||||
|
||||
function compareRequests(
|
||||
left: SchedulingRequest,
|
||||
right: SchedulingRequest
|
||||
): number {
|
||||
if (left.status !== right.status) {
|
||||
return left.status === "collecting" ? -1 : 1;
|
||||
}
|
||||
const leftDeadline = left.deadline_at
|
||||
? new Date(left.deadline_at).getTime()
|
||||
: Number.POSITIVE_INFINITY;
|
||||
const rightDeadline = right.deadline_at
|
||||
? new Date(right.deadline_at).getTime()
|
||||
: Number.POSITIVE_INFINITY;
|
||||
return (
|
||||
leftDeadline - rightDeadline
|
||||
|| new Date(right.updated_at).getTime() - new Date(left.updated_at).getTime()
|
||||
);
|
||||
}
|
||||
|
||||
function responseLabel(request: SchedulingRequest): ReactNode {
|
||||
const responded = request.participant_aggregate.status_counts.responded ?? 0;
|
||||
return <>{responded}/{request.participant_aggregate.total} {I18N.responded}</>;
|
||||
}
|
||||
|
||||
function deadlineLabel(request: SchedulingRequest): ReactNode {
|
||||
if (!request.deadline_at) return <>{request.slots.length} {I18N.candidateSlots}</>;
|
||||
return <>{I18N.deadline}: {formatDateTime(request.deadline_at, {
|
||||
day: "2-digit",
|
||||
month: "short"
|
||||
})}</>;
|
||||
}
|
||||
|
||||
function numberSetting(
|
||||
value: unknown,
|
||||
fallback: number,
|
||||
minimum: number,
|
||||
maximum: number
|
||||
): number {
|
||||
const numeric = typeof value === "number" ? value : Number(value);
|
||||
return Number.isFinite(numeric)
|
||||
? Math.max(minimum, Math.min(maximum, Math.floor(numeric)))
|
||||
: fallback;
|
||||
}
|
||||
@@ -0,0 +1,416 @@
|
||||
import type {
|
||||
SchedulingAvailabilityValue,
|
||||
SchedulingParticipant,
|
||||
SchedulingParticipantPayload,
|
||||
SchedulingRequest
|
||||
} from "../../api/scheduling";
|
||||
import type { PeoplePickerItem } from "@govoplan/core-webui";
|
||||
|
||||
const DIRECTORY_SELECTION_METADATA_KEY = "directory_selection";
|
||||
|
||||
export type SchedulingParticipantDraft = PeoplePickerItem & {
|
||||
draftId: string;
|
||||
sourceId?: string;
|
||||
revision?: string;
|
||||
respondent_id?: string | null;
|
||||
display_name: string;
|
||||
email: string;
|
||||
participant_type: "internal" | "external" | "resource";
|
||||
required: boolean;
|
||||
metadata?: Record<string, unknown>;
|
||||
identityLocked?: boolean;
|
||||
};
|
||||
|
||||
export type SchedulingActor = {
|
||||
accountId?: string | null;
|
||||
userId?: string | null;
|
||||
membershipId?: string | null;
|
||||
identityId?: string | null;
|
||||
email?: string | null;
|
||||
};
|
||||
|
||||
export type SchedulingRequestGroups = {
|
||||
owned: SchedulingRequest[];
|
||||
invited: SchedulingRequest[];
|
||||
other: SchedulingRequest[];
|
||||
};
|
||||
|
||||
export type SchedulingLifecycleStageId = "prepare" | "participate" | "decide";
|
||||
|
||||
export type SchedulingLifecycleStageState =
|
||||
| "complete"
|
||||
| "current"
|
||||
| "locked"
|
||||
| "stopped";
|
||||
|
||||
export type SchedulingLifecycleStage = {
|
||||
id: SchedulingLifecycleStageId;
|
||||
state: SchedulingLifecycleStageState;
|
||||
current: boolean;
|
||||
locked: boolean;
|
||||
};
|
||||
|
||||
export type SchedulingSortPhase =
|
||||
| "unanswered"
|
||||
| "answered"
|
||||
| "closed"
|
||||
| "determined"
|
||||
| "past";
|
||||
|
||||
export type SchedulingInvitationActionBlock =
|
||||
| "participation_policy_unavailable"
|
||||
| "cancellation_notice_expired"
|
||||
| "delivery_unavailable"
|
||||
| "no_delivery_target"
|
||||
| "no_active_invitation"
|
||||
| "participant_revision_unavailable";
|
||||
|
||||
export type SchedulingInvitationActionBlocks = {
|
||||
copy: SchedulingInvitationActionBlock | null;
|
||||
send: SchedulingInvitationActionBlock | null;
|
||||
revoke: SchedulingInvitationActionBlock | null;
|
||||
};
|
||||
|
||||
type DirectorySelection = {
|
||||
selection_key?: string;
|
||||
kind?: PeoplePickerItem["kind"];
|
||||
reference_id?: string | null;
|
||||
source_module?: string | null;
|
||||
source_label?: string | null;
|
||||
source_revision?: string | null;
|
||||
};
|
||||
|
||||
function directorySelection(metadata?: Record<string, unknown>): DirectorySelection | null {
|
||||
const value = metadata?.[DIRECTORY_SELECTION_METADATA_KEY];
|
||||
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
||||
return value as DirectorySelection;
|
||||
}
|
||||
|
||||
function normalizedParticipantType(value: string | null): SchedulingParticipantDraft["participant_type"] {
|
||||
return value === "internal" || value === "resource" ? value : "external";
|
||||
}
|
||||
|
||||
function selectionMetadata(item: PeoplePickerItem): Record<string, unknown> {
|
||||
if (item.kind === "external") return {};
|
||||
return {
|
||||
[DIRECTORY_SELECTION_METADATA_KEY]: {
|
||||
selection_key: item.selection_key,
|
||||
kind: item.kind,
|
||||
reference_id: item.reference_id ?? null,
|
||||
source_module: item.source_module ?? null,
|
||||
source_label: item.source_label ?? null,
|
||||
source_revision: item.source_revision ?? null
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function participantDraftFromResponse(
|
||||
participant: SchedulingParticipant,
|
||||
draftId: string
|
||||
): SchedulingParticipantDraft {
|
||||
const selection = directorySelection(participant.metadata);
|
||||
const kind = selection?.kind ?? (participant.respondent_id ? "account" : "external");
|
||||
const referenceId = selection?.reference_id
|
||||
?? (kind === "account" ? participant.respondent_id : null);
|
||||
const email = participant.email?.trim().toLowerCase() || null;
|
||||
return {
|
||||
selection_key: selection?.selection_key
|
||||
?? (email ? `${kind}:${email}` : `${kind}:participant:${participant.id}`),
|
||||
kind,
|
||||
reference_id: referenceId,
|
||||
display_name: participant.display_name?.trim() || email || "—",
|
||||
email: email ?? "",
|
||||
source_module: selection?.source_module ?? null,
|
||||
source_label: selection?.source_label ?? null,
|
||||
source_revision: selection?.source_revision ?? null,
|
||||
draftId,
|
||||
sourceId: participant.id,
|
||||
revision: participant.revision ?? undefined,
|
||||
respondent_id: participant.respondent_id,
|
||||
participant_type: normalizedParticipantType(participant.participant_type),
|
||||
required: participant.required ?? true,
|
||||
metadata: participant.metadata ?? {},
|
||||
identityLocked: Boolean(participant.poll_invitation_id)
|
||||
};
|
||||
}
|
||||
|
||||
export function participantDraftsFromPicker(
|
||||
selected: PeoplePickerItem[],
|
||||
current: SchedulingParticipantDraft[],
|
||||
nextDraftId: () => string
|
||||
): SchedulingParticipantDraft[] {
|
||||
const currentByKey = new Map(current.map((participant) => [participant.selection_key, participant]));
|
||||
return selected.map((item) => {
|
||||
const existing = currentByKey.get(item.selection_key);
|
||||
if (existing) return existing;
|
||||
const kind = item.kind === "account" ? "account" : item.kind === "contact" ? "contact" : "external";
|
||||
return {
|
||||
...item,
|
||||
kind,
|
||||
email: item.email?.trim().toLowerCase() || "",
|
||||
draftId: nextDraftId(),
|
||||
respondent_id: kind === "account" ? item.reference_id ?? null : null,
|
||||
participant_type: kind === "account" ? "internal" : "external",
|
||||
required: true,
|
||||
metadata: selectionMetadata(item),
|
||||
identityLocked: false
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function participantPayload(
|
||||
participant: SchedulingParticipantDraft
|
||||
): SchedulingParticipantPayload & { id?: string; revision?: string } {
|
||||
return {
|
||||
...(participant.sourceId
|
||||
? { id: participant.sourceId, revision: participant.revision }
|
||||
: {}),
|
||||
respondent_id: participant.respondent_id ?? null,
|
||||
display_name: participant.display_name.trim() || null,
|
||||
email: participant.email.trim() || null,
|
||||
participant_type: participant.participant_type,
|
||||
required: participant.required,
|
||||
metadata: participant.metadata ?? {}
|
||||
};
|
||||
}
|
||||
|
||||
export function schedulingActorIds(actor: SchedulingActor): string[] {
|
||||
return Array.from(new Set([
|
||||
actor.accountId,
|
||||
actor.userId,
|
||||
actor.membershipId,
|
||||
actor.identityId,
|
||||
actor.email
|
||||
].filter((value): value is string => Boolean(value)).flatMap((value) =>
|
||||
value.includes("@") ? [value, value.trim().toLowerCase()] : [value]
|
||||
)));
|
||||
}
|
||||
|
||||
export function schedulingParticipantForActor(
|
||||
request: SchedulingRequest,
|
||||
actor: SchedulingActor
|
||||
): SchedulingParticipant | null {
|
||||
const projected = request.participants.find(
|
||||
(participant) => participant.is_current_participant
|
||||
);
|
||||
if (projected) return projected;
|
||||
const ids = new Set(schedulingActorIds(actor));
|
||||
return request.participants.find((participant) => {
|
||||
const email = participant.email?.trim().toLowerCase();
|
||||
return Boolean(
|
||||
(participant.respondent_id && ids.has(participant.respondent_id)) ||
|
||||
(email && ids.has(email))
|
||||
);
|
||||
}) ?? null;
|
||||
}
|
||||
|
||||
export function schedulingRequestIsOwned(
|
||||
request: SchedulingRequest,
|
||||
actor: SchedulingActor
|
||||
): boolean {
|
||||
return Boolean(
|
||||
request.organizer_user_id &&
|
||||
schedulingActorIds(actor).includes(request.organizer_user_id)
|
||||
);
|
||||
}
|
||||
|
||||
export function schedulingSortPhase(
|
||||
request: SchedulingRequest,
|
||||
actor: SchedulingActor,
|
||||
now = new Date()
|
||||
): SchedulingSortPhase {
|
||||
if (schedulingRequestIsPast(request, now)) return "past";
|
||||
if (["decided", "handed_off"].includes(request.status)) return "determined";
|
||||
if (["closed", "cancelled", "archived"].includes(request.status)) return "closed";
|
||||
if (schedulingRequestIsOwned(request, actor)) return "unanswered";
|
||||
const participant = schedulingParticipantForActor(request, actor);
|
||||
return participant && ["responded", "declined"].includes(participant.status)
|
||||
? "answered"
|
||||
: "unanswered";
|
||||
}
|
||||
|
||||
export function compareSchedulingRequests(
|
||||
left: SchedulingRequest,
|
||||
right: SchedulingRequest,
|
||||
actor: SchedulingActor,
|
||||
now = new Date()
|
||||
): number {
|
||||
const leftPhase = schedulingSortPhase(left, actor, now);
|
||||
const rightPhase = schedulingSortPhase(right, actor, now);
|
||||
const phaseDifference = SORT_PHASE_ORDER[leftPhase] - SORT_PHASE_ORDER[rightPhase];
|
||||
if (phaseDifference !== 0) return phaseDifference;
|
||||
const leftDate = schedulingRelevantTimestamp(left, now);
|
||||
const rightDate = schedulingRelevantTimestamp(right, now);
|
||||
const dateDifference = leftPhase === "past"
|
||||
? rightDate - leftDate
|
||||
: leftDate - rightDate;
|
||||
if (dateDifference !== 0) return dateDifference;
|
||||
const titleDifference = left.title.localeCompare(right.title);
|
||||
return titleDifference || left.id.localeCompare(right.id);
|
||||
}
|
||||
|
||||
export function groupSchedulingRequests(
|
||||
requests: SchedulingRequest[],
|
||||
actor: SchedulingActor,
|
||||
now = new Date()
|
||||
): SchedulingRequestGroups {
|
||||
const groups: SchedulingRequestGroups = { owned: [], invited: [], other: [] };
|
||||
for (const request of requests) {
|
||||
if (schedulingRequestIsOwned(request, actor)) {
|
||||
groups.owned.push(request);
|
||||
} else if (schedulingParticipantForActor(request, actor)) {
|
||||
groups.invited.push(request);
|
||||
} else {
|
||||
groups.other.push(request);
|
||||
}
|
||||
}
|
||||
for (const group of Object.values(groups)) {
|
||||
group.sort((left, right) => compareSchedulingRequests(left, right, actor, now));
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
export function schedulingRelevantTimestamp(
|
||||
request: SchedulingRequest,
|
||||
now = new Date()
|
||||
): number {
|
||||
const nowValue = now.getTime();
|
||||
const futureStarts = request.slots
|
||||
.map((slot) => Date.parse(slot.start_at))
|
||||
.filter((value) => Number.isFinite(value) && value >= nowValue)
|
||||
.sort((left, right) => left - right);
|
||||
if (futureStarts[0] !== undefined) return futureStarts[0];
|
||||
const slotEnds = request.slots
|
||||
.map((slot) => Date.parse(slot.end_at))
|
||||
.filter(Number.isFinite);
|
||||
if (slotEnds.length) return Math.max(...slotEnds);
|
||||
const fallback = Date.parse(request.deadline_at || request.updated_at || request.created_at);
|
||||
return Number.isFinite(fallback) ? fallback : Number.MAX_SAFE_INTEGER;
|
||||
}
|
||||
|
||||
export function schedulingRequestIsPast(
|
||||
request: SchedulingRequest,
|
||||
now = new Date()
|
||||
): boolean {
|
||||
if (!request.slots.length) return false;
|
||||
const slotEnds = request.slots.map((slot) => Date.parse(slot.end_at));
|
||||
return slotEnds.every((value) => Number.isFinite(value) && value < now.getTime());
|
||||
}
|
||||
|
||||
export function schedulingLifecycleStages(
|
||||
status: SchedulingRequest["status"]
|
||||
): SchedulingLifecycleStage[] {
|
||||
const currentIndex = status === "draft"
|
||||
? 0
|
||||
: status === "collecting" || status === "cancelled"
|
||||
? 1
|
||||
: 2;
|
||||
const completedThrough = status === "draft"
|
||||
? -1
|
||||
: status === "collecting" || status === "cancelled"
|
||||
? 0
|
||||
: status === "closed"
|
||||
? 1
|
||||
: 2;
|
||||
const stopped = status === "cancelled";
|
||||
|
||||
return (["prepare", "participate", "decide"] as const).map((id, index) => {
|
||||
const current = index === currentIndex;
|
||||
const locked = index > completedThrough + 1;
|
||||
const state: SchedulingLifecycleStageState = stopped && current
|
||||
? "stopped"
|
||||
: index <= completedThrough
|
||||
? "complete"
|
||||
: current
|
||||
? "current"
|
||||
: "locked";
|
||||
return { id, state, current, locked };
|
||||
});
|
||||
}
|
||||
|
||||
export function schedulingInvitationActionBlocks(
|
||||
request: SchedulingRequest,
|
||||
participant: SchedulingParticipant,
|
||||
now = new Date()
|
||||
): SchedulingInvitationActionBlocks {
|
||||
if (!participant.revision) {
|
||||
return {
|
||||
copy: "participant_revision_unavailable",
|
||||
send: "participant_revision_unavailable",
|
||||
revoke: "participant_revision_unavailable"
|
||||
};
|
||||
}
|
||||
const policyAvailable = Boolean(
|
||||
request.poll_id &&
|
||||
request.public_participation_policy_enforcement_available === true
|
||||
);
|
||||
let issueBlock: SchedulingInvitationActionBlock | null = policyAvailable
|
||||
? null
|
||||
: "participation_policy_unavailable";
|
||||
if (!issueBlock && request.status === "cancelled") {
|
||||
const noticeUntil = request.cancellation_notice_until
|
||||
? Date.parse(request.cancellation_notice_until)
|
||||
: Number.NaN;
|
||||
if (!Number.isFinite(noticeUntil) || noticeUntil <= now.getTime()) {
|
||||
issueBlock = "cancellation_notice_expired";
|
||||
}
|
||||
}
|
||||
|
||||
const respondentId = participant.respondent_id?.trim() ?? "";
|
||||
const hasDeliveryTarget = Boolean(
|
||||
participant.email?.trim() ||
|
||||
(respondentId && !respondentId.startsWith("scheduling-participant:"))
|
||||
);
|
||||
const sendBlock = issueBlock
|
||||
?? (request.participant_invitation_delivery_available === true
|
||||
? null
|
||||
: "delivery_unavailable")
|
||||
?? (hasDeliveryTarget ? null : "no_delivery_target");
|
||||
const revokeBlock = participant.poll_invitation_id
|
||||
? (policyAvailable ? null : "participation_policy_unavailable")
|
||||
: "no_active_invitation";
|
||||
|
||||
return { copy: issueBlock, send: sendBlock, revoke: revokeBlock };
|
||||
}
|
||||
|
||||
export function schedulingPublicInvitationUrl(
|
||||
actionUrl: string,
|
||||
applicationOrigin: string
|
||||
): string | null {
|
||||
try {
|
||||
const origin = new URL(applicationOrigin);
|
||||
const url = new URL(actionUrl, origin);
|
||||
if (url.origin !== origin.origin || !url.pathname.startsWith("/scheduling/public/")) return null;
|
||||
return url.toString();
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function applySchedulingAvailabilityChoice(
|
||||
slotIds: string[],
|
||||
current: Record<string, SchedulingAvailabilityValue | "">,
|
||||
slotId: string,
|
||||
value: SchedulingAvailabilityValue | "",
|
||||
singleChoice: boolean
|
||||
): Record<string, SchedulingAvailabilityValue | ""> {
|
||||
if (!singleChoice || !["available", "maybe"].includes(value)) {
|
||||
return { ...current, [slotId]: value };
|
||||
}
|
||||
return Object.fromEntries(slotIds.map((candidateId) => [
|
||||
candidateId,
|
||||
candidateId === slotId
|
||||
? value
|
||||
: current[candidateId] && current[candidateId] !== "unavailable"
|
||||
? "unavailable"
|
||||
: current[candidateId] ?? ""
|
||||
]));
|
||||
}
|
||||
|
||||
const SORT_PHASE_ORDER: Record<SchedulingSortPhase, number> = {
|
||||
unanswered: 0,
|
||||
answered: 1,
|
||||
closed: 2,
|
||||
determined: 3,
|
||||
past: 4
|
||||
};
|
||||
@@ -0,0 +1,440 @@
|
||||
export const generatedTranslations = {
|
||||
en: {
|
||||
"i18n:govoplan-scheduling.self_enrollment.access": "Open self-enrollment",
|
||||
"i18n:govoplan-scheduling.self_enrollment.bind_account": "Bind this enrollment to my signed-in account",
|
||||
"i18n:govoplan-scheduling.self_enrollment.bind_help": "Account binding requires confirmation and lets you manage this response from Scheduling.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.claim_anonymous": "Bind an earlier anonymous enrollment using its recovery proof",
|
||||
"i18n:govoplan-scheduling.self_enrollment.expires": "Self-enrollment link expires",
|
||||
"i18n:govoplan-scheduling.self_enrollment.invalid": "This self-enrollment link is invalid, expired, full, or the supplied details are incorrect.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.proof": "Anonymous recovery proof",
|
||||
"i18n:govoplan-scheduling.self_enrollment.proof_help": "Keep this value privately. It is required to update or later bind an anonymous response and is never stored in clear text.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.remaining": "Enrollment places remaining",
|
||||
"i18n:govoplan-scheduling.self_enrollment.submit": "Enroll and submit response",
|
||||
"i18n:govoplan-scheduling.self_enrollment.saved": "Your enrollment and response have been recorded.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.participant_details": "Participant details",
|
||||
"i18n:govoplan-scheduling.self_enrollment.links": "Public self-enrollment links",
|
||||
"i18n:govoplan-scheduling.self_enrollment.links_help": "Reusable links are separate from participant invitations. Every link requires a capacity and expiry and is shown only once when copied.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.expires_at": "Expires at",
|
||||
"i18n:govoplan-scheduling.self_enrollment.maximum": "Maximum enrollments",
|
||||
"i18n:govoplan-scheduling.self_enrollment.allow_anonymous": "Allow anonymous enrollment with a recovery proof",
|
||||
"i18n:govoplan-scheduling.self_enrollment.allow_authenticated": "Allow signed-in enrollment after account-binding confirmation",
|
||||
"i18n:govoplan-scheduling.self_enrollment.issue_copy": "Issue and copy link",
|
||||
"i18n:govoplan-scheduling.self_enrollment.open_first": "Open the request before issuing a self-enrollment link.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.loading_links": "Loading self-enrollment links…",
|
||||
"i18n:govoplan-scheduling.self_enrollment.no_links": "No self-enrollment links have been issued.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoke_title": "Revoke self-enrollment link",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoke_message": "This stops the reusable link immediately. Existing participant responses remain governed by the request policy.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.copied": "A new self-enrollment link was issued and copied. Its credential will not be shown again.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoked": "The self-enrollment link was revoked.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.load_failed": "Self-enrollment links could not be loaded.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.issue_failed": "The self-enrollment link could not be issued.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoke_failed": "The self-enrollment link could not be revoked.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.clipboard_failed": "The link was issued, but clipboard access is unavailable. The new link will be revoked automatically.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.mode_anonymous": "anonymous",
|
||||
"i18n:govoplan-scheduling.self_enrollment.mode_authenticated": "signed in",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_active": "Active",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_expired": "Expired",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_revoked": "Revoked",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_exhausted": "Full",
|
||||
"i18n:govoplan-scheduling.calendar_cleanup_retry_title": "Calendar cleanup requires attention.",
|
||||
"i18n:govoplan-scheduling.calendar_cleanup_retry_message": "{value0} tentative hold operations remain. Reconcile failed Calendar outbound changes if necessary, then repeat the original decision or cancellation action.",
|
||||
"i18n:govoplan-scheduling.access_details.79c06b89": "Access details",
|
||||
"i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3": "Automatic invitation delivery is unavailable; copy the link instead.",
|
||||
"i18n:govoplan-scheduling.cancellation_notice_available_until.f840d1e6": "Cancellation notice available until",
|
||||
"i18n:govoplan-scheduling.copy_a_fresh_invitation_link_for_value0.e3799c79": "Copy a fresh invitation link for {value0}",
|
||||
"i18n:govoplan-scheduling.enter_the_details_supplied_with_the_invitation_for_privacy.81ba419c": "Enter the details supplied with the invitation. For privacy, invalid and expired links use the same response.",
|
||||
"i18n:govoplan-scheduling.loading_scheduling_request.43c39c1b": "Loading scheduling request…",
|
||||
"i18n:govoplan-scheduling.invitation_delivery_failed_the_link_was_created_but_was_not_delivered.8db0c306": "Invitation delivery failed. The link was created but was not delivered.",
|
||||
"i18n:govoplan-scheduling.invitation_delivery_requested.1aaa78ba": "Invitation delivery requested.",
|
||||
"i18n:govoplan-scheduling.invitation_link_copied.332973ec": "Invitation link copied.",
|
||||
"i18n:govoplan-scheduling.invitation_link_revoked.c7dd20d4": "Invitation link revoked.",
|
||||
"i18n:govoplan-scheduling.no_active_invitation_link_to_revoke.4ad0f0cc": "No active invitation link to revoke.",
|
||||
"i18n:govoplan-scheduling.open_in_scheduling.48df1541": "Open in Scheduling",
|
||||
"i18n:govoplan-scheduling.open_scheduling_request.31829cce": "Open scheduling request",
|
||||
"i18n:govoplan-scheduling.response_deadline.7fd9e3aa": "Response deadline",
|
||||
"i18n:govoplan-scheduling.reload_the_request_before_changing_this_invitation.9e685df4": "Reload the request before changing this invitation.",
|
||||
"i18n:govoplan-scheduling.participant.554f4235": "Participant",
|
||||
"i18n:govoplan-scheduling.revoke_invitation_link.87bf89cf": "Revoke invitation link",
|
||||
"i18n:govoplan-scheduling.revoke_link.da371ee1": "Revoke link",
|
||||
"i18n:govoplan-scheduling.revoke_the_current_invitation_link_for_value0_it_will_stop_working_immediately.3cdc5817": "Revoke the current invitation link for {value0}? It will stop working immediately.",
|
||||
"i18n:govoplan-scheduling.revoke_the_invitation_link_for_value0.15a9c9fa": "Revoke the invitation link for {value0}",
|
||||
"i18n:govoplan-scheduling.send_a_fresh_invitation_to_value0.fd8d9dea": "Send a fresh invitation to {value0}",
|
||||
"i18n:govoplan-scheduling.the_cancellation_notice_has_expired_a_new_link_cannot_be_issued.9c6ccc7c": "The cancellation notice has expired; a new link cannot be issued.",
|
||||
"i18n:govoplan-scheduling.the_invitation_link_could_not_be_copied_check_browser_clipboard_permissions_and_try_again.a8b17cbc": "The invitation link could not be copied. Check browser clipboard permissions and try again.",
|
||||
"i18n:govoplan-scheduling.this_participant_has_no_deliverable_email_address_or_account.dbe14180": "This participant has no deliverable email address or account.",
|
||||
"i18n:govoplan-scheduling.this_invitation_changed_the_request_was_reloaded_try_again.c7095533": "This invitation changed. The request was reloaded; try again.",
|
||||
"i18n:govoplan-scheduling.this_scheduling_link_is_invalid_expired_or_the_access_details.8e7aa197": "This scheduling link is invalid, expired, or the access details do not match.",
|
||||
"i18n:govoplan-scheduling.this_scheduling_request_was_cancelled.1af3c85e": "This scheduling request was cancelled.",
|
||||
"i18n:govoplan-scheduling.this_scheduling_request_is_no_longer_accepting_responses.c612e78a": "This scheduling request is no longer accepting responses.",
|
||||
"i18n:govoplan-scheduling.your_availability.f86c8215": "Your availability",
|
||||
"i18n:govoplan-scheduling.save_or_discard_your_unsent_availability_changes_before_leaving.97e10df1": "Save or discard your unsent availability changes before leaving.",
|
||||
"i18n:govoplan-scheduling.a_slot_can_be_selected_after_the_request_is_closed.f91ec02d": "A slot can be selected after the request is closed.",
|
||||
"i18n:govoplan-scheduling.add_maybe_between_yes_and_no_for_each_candidate_slot.74dc9db6": "Add Maybe between Available and Unavailable for each candidate slot.",
|
||||
"i18n:govoplan-scheduling.allow_comments.d63202a6": "Allow comments",
|
||||
"i18n:govoplan-scheduling.allow_external_participants.a9efcb52": "Allow external participants",
|
||||
"i18n:govoplan-scheduling.awaiting.42aa82e0": "Awaiting",
|
||||
"i18n:govoplan-scheduling.capacity.d3c375f8": "Capacity",
|
||||
"i18n:govoplan-scheduling.comment.d03495b1": "Comment",
|
||||
"i18n:govoplan-scheduling.create_an_organizer_notification_whenever_a_response_is.253ddca8": "Create an organizer notification whenever a response is submitted or updated.",
|
||||
"i18n:govoplan-scheduling.each_participant_can_answer_yes_to_at_most_one_candidate.5313a465": "Each participant can select Available or Maybe for at most one candidate slot.",
|
||||
"i18n:govoplan-scheduling.edit_scheduling_request.7e749c19": "Edit scheduling request",
|
||||
"i18n:govoplan-scheduling.invited_participant_identity_is_locked_remove_and_add_the_participant_to_change_it.34e1201a": "An invited participant's name and email are locked. Remove and add the participant to change them.",
|
||||
"i18n:govoplan-scheduling.guest_links_are_not_issued_while_the_configured_participation.0794ebf0": "Guest links are not issued while the configured participation controls cannot be enforced by the public response gateway. Signed-in participants can still respond here.",
|
||||
"i18n:govoplan-scheduling.guest_password.94545e82": "Guest password",
|
||||
"i18n:govoplan-scheduling.let_participants_add_a_comment_to_their_response.9dce8d17": "Let participants add a comment to their response.",
|
||||
"i18n:govoplan-scheduling.limit_participants_per_option.1e9aa51d": "Limit participants per option",
|
||||
"i18n:govoplan-scheduling.maximum_participants_per_option.5abdfb27": "Maximum participants per option",
|
||||
"i18n:govoplan-scheduling.notify_me_about_each_answer.505749d6": "Notify me about each answer",
|
||||
"i18n:govoplan-scheduling.participants_can_choose_only_one_option.4311f51c": "Participants can choose only one option",
|
||||
"i18n:govoplan-scheduling.participation.9ad70cc4": "Participation",
|
||||
"i18n:govoplan-scheduling.participation_rate.46bc5504": "Participation rate",
|
||||
"i18n:govoplan-scheduling.participation_settings.8dc6f62c": "Participation settings",
|
||||
"i18n:govoplan-scheduling.participant_privacy.108c470f": "Participant privacy",
|
||||
"i18n:govoplan-scheduling.participation_controls_are_locked_after_invitation_links_are_issued.66f5a740": "Participation controls are locked after invitation links are issued. Participant visibility and answer notifications can still be changed.",
|
||||
"i18n:govoplan-scheduling.password_protect_guest_access.13d7f08b": "Password-protect guest access",
|
||||
"i18n:govoplan-scheduling.people_responding_without_an_account_must_provide_an_email.19fd3dc8": "People responding without an account must provide an email address.",
|
||||
"i18n:govoplan-scheduling.people_who_are_not_signed_in_must_enter_this_password.82bcc4ce": "People who are not signed in must enter this password before viewing the request.",
|
||||
"i18n:govoplan-scheduling.search_visible_accounts_and_contacts_or_add_an_external_perso.877f6b44": "Search accounts and contacts you are allowed to discover. If external participants are enabled, you can also add a name and email address manually.",
|
||||
"i18n:govoplan-scheduling.when_enabled_people_outside_the_configured_accounts_and.78829735": "When enabled, people outside the configured accounts and contacts can be added manually.",
|
||||
"i18n:govoplan-scheduling.provide_a_maybe_option.e39da57a": "Provide a Maybe option",
|
||||
"i18n:govoplan-scheduling.require_an_email_address_from_guests.c2289a58": "Require an email address from guests",
|
||||
"i18n:govoplan-scheduling.responses.3427e3ab": "Responses",
|
||||
"i18n:govoplan-scheduling.response_results_are_not_available_for_this_view.1e82db18": "Response results are not available for this view.",
|
||||
"i18n:govoplan-scheduling.notifications_could_not_be_loaded.f0e1b2c3": "Notifications could not be loaded.",
|
||||
"i18n:govoplan-scheduling.stop_accepting_yes_responses_for_an_option_when_its_limit.79af21db": "Stop accepting Available responses for an option when its limit is reached.",
|
||||
"i18n:govoplan-scheduling.use_at_least_8_characters_the_password_is_never_displayed.035708a2": "Use at least 8 characters. The password is never displayed after it is saved.",
|
||||
"i18n:govoplan-scheduling.add_participant.6cff957d": "Add participant",
|
||||
"i18n:govoplan-scheduling.add_scheduling_request.3c71be15": "Add scheduling request",
|
||||
"i18n:govoplan-scheduling.add_slot.9fcff3ed": "Add slot",
|
||||
"i18n:govoplan-scheduling.answered.e0aafffa": "Answered",
|
||||
"i18n:govoplan-scheduling.available.7c62a142": "Available",
|
||||
"i18n:govoplan-scheduling.awaiting_response.ee646ea9": "Awaiting response",
|
||||
"i18n:govoplan-scheduling.basic_information.d8bc7383": "Basic information",
|
||||
"i18n:govoplan-scheduling.busy.592a9d16": "Busy",
|
||||
"i18n:govoplan-scheduling.calendar.adab5090": "Calendar",
|
||||
"i18n:govoplan-scheduling.calendar_coordination.291ab00a": "Calendar coordination",
|
||||
"i18n:govoplan-scheduling.configured_calendar.e2e8ebd5": "Configured calendar",
|
||||
"i18n:govoplan-scheduling.calendar_integration.181ad18b": "Calendar integration",
|
||||
"i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e": "Calendar integration requires the Calendar module plus calendar-read, availability-read, and event-write access.",
|
||||
"i18n:govoplan-scheduling.enable_calendar_and_grant_calendar_availability_and_event_access.f1a20106": "Enable Calendar and grant calendar, availability, and event access.",
|
||||
"i18n:govoplan-scheduling.candidate_availability.9541c4b5": "Candidate availability",
|
||||
"i18n:govoplan-scheduling.candidate_slots.c414946b": "Candidate slots",
|
||||
"i18n:govoplan-scheduling.check_free_busy.e9700e00": "Check free/busy",
|
||||
"i18n:govoplan-scheduling.choose_availability.ac95b8f6": "Choose availability",
|
||||
"i18n:govoplan-scheduling.choose_availability_for_at_least_one_candidate_slot.28d2111f": "Choose availability for at least one candidate slot.",
|
||||
"i18n:govoplan-scheduling.close_poll.a6a18916": "Close poll",
|
||||
"i18n:govoplan-scheduling.close_stops_accepting_new_availability_responses.a1d57519": "Close stops accepting new availability responses.",
|
||||
"i18n:govoplan-scheduling.closed.88d86b77": "Closed",
|
||||
"i18n:govoplan-scheduling.create_calendar_event.0b87cfcf": "Create calendar event",
|
||||
"i18n:govoplan-scheduling.create_tentative_holds.51c4744e": "Create tentative holds",
|
||||
"i18n:govoplan-scheduling.cancellation.319aaae4": "Cancellation",
|
||||
"i18n:govoplan-scheduling.decision.7f59a1f1": "Decision",
|
||||
"i18n:govoplan-scheduling.declined.ff59b80f": "Declined",
|
||||
"i18n:govoplan-scheduling.decide_on_value.196409cd": "Decide on {value0}",
|
||||
"i18n:govoplan-scheduling.description.55f8ebc8": "Description",
|
||||
"i18n:govoplan-scheduling.determined.9f23293d": "Determined",
|
||||
"i18n:govoplan-scheduling.discard.36fff63c": "Discard",
|
||||
"i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2": "Discard this unsaved scheduling request?",
|
||||
"i18n:govoplan-scheduling.draft.23d33e22": "Draft",
|
||||
"i18n:govoplan-scheduling.enable_enforceable_public_participation_controls_or_keep_participation_signed_in.f1a20105": "Enable enforceable public participation controls, or keep participation signed in.",
|
||||
"i18n:govoplan-scheduling.end.a2bb9d34": "End",
|
||||
"i18n:govoplan-scheduling.error.7f2f6a15": "Error",
|
||||
"i18n:govoplan-scheduling.every_candidate_slot_must_end_after_it_starts.47836010": "Every candidate slot must end after it starts.",
|
||||
"i18n:govoplan-scheduling.failed.09fef5d8": "Failed",
|
||||
"i18n:govoplan-scheduling.free.75f52718": "Free",
|
||||
"i18n:govoplan-scheduling.free_busy_checks_each_candidate_slot_against_the_selecte.50f0371a": "Free/busy checks each candidate slot against the selected calendar.",
|
||||
"i18n:govoplan-scheduling.loading_scheduling_requests.f42be95d": "Loading scheduling requests…",
|
||||
"i18n:govoplan-scheduling.invitation.6306ef74": "Invitation",
|
||||
"i18n:govoplan-scheduling.invited.53469df1": "Invited",
|
||||
"i18n:govoplan-scheduling.location.d219c681": "Location",
|
||||
"i18n:govoplan-scheduling.managed_scheduling_requests.7a45972f": "Managed scheduling requests",
|
||||
"i18n:govoplan-scheduling.maybe.56dd8d0b": "Maybe",
|
||||
"i18n:govoplan-scheduling.my_scheduling_requests.d28ef235": "My scheduling requests",
|
||||
"i18n:govoplan-scheduling.name.709a2322": "Name",
|
||||
"i18n:govoplan-scheduling.new_scheduling_request.2080f675": "New scheduling request",
|
||||
"i18n:govoplan-scheduling.no_notifications_have_been_created.c8d43ca3": "No notifications have been created.",
|
||||
"i18n:govoplan-scheduling.no_participants.73a89101": "No participants",
|
||||
"i18n:govoplan-scheduling.no_requests_in_this_group.a63c1b40": "No requests in this group",
|
||||
"i18n:govoplan-scheduling.no_scheduling_request_selected.ac940664": "No scheduling request selected",
|
||||
"i18n:govoplan-scheduling.notifications.753a22b2": "Notifications",
|
||||
"i18n:govoplan-scheduling.open.cf9b7706": "Open",
|
||||
"i18n:govoplan-scheduling.open_poll.2beac9a7": "Open poll",
|
||||
"i18n:govoplan-scheduling.open_starts_collecting_availability_responses.c8ec34e5": "Open starts collecting availability responses.",
|
||||
"i18n:govoplan-scheduling.option_value.3f643dc0": "Option {value0}",
|
||||
"i18n:govoplan-scheduling.other_scheduling_requests.5cb6eb30": "Other scheduling requests",
|
||||
"i18n:govoplan-scheduling.participant_email.2cadfd9e": "Participant email",
|
||||
"i18n:govoplan-scheduling.participant_names_and_statuses_are_hidden_aggregate_counts_r.d811a69a": "Participant names and statuses are hidden. Aggregate counts remain visible.",
|
||||
"i18n:govoplan-scheduling.participant_removed.0cf4ec4c": "Participant removed",
|
||||
"i18n:govoplan-scheduling.participant_replaced.2623752d": "Participant replaced",
|
||||
"i18n:govoplan-scheduling.share_participant_names_and_response_statuses.df0bf9e0": "Share participant names and response statuses",
|
||||
"i18n:govoplan-scheduling.when_enabled_participants_can_see_other_participants_names.3ac78361": "When enabled, participants can see other participants' names and response statuses. Email addresses and invitation details remain private.",
|
||||
"i18n:govoplan-scheduling.participants.cd56e083": "Participants",
|
||||
"i18n:govoplan-scheduling.past.405c12fb": "Past",
|
||||
"i18n:govoplan-scheduling.pending.96f608c1": "Pending",
|
||||
"i18n:govoplan-scheduling.queued.6a599877": "Queued",
|
||||
"i18n:govoplan-scheduling.refresh_requests.0a3ed7a1": "Refresh requests",
|
||||
"i18n:govoplan-scheduling.required_action.f1a20101": "Required action",
|
||||
"i18n:govoplan-scheduling.reminder_creates_a_notification_job_for_every_active_par.7ec68797": "Reminder creates a notification job for every active participant.",
|
||||
"i18n:govoplan-scheduling.remove.e963907d": "Remove",
|
||||
"i18n:govoplan-scheduling.remove_participant_value.e55f2b70": "Remove participant {value0}",
|
||||
"i18n:govoplan-scheduling.remove_slot_value.3adc7576": "Remove slot {value0}",
|
||||
"i18n:govoplan-scheduling.removed.b5e77c5c": "Removed",
|
||||
"i18n:govoplan-scheduling.reminder.b87a1929": "Reminder",
|
||||
"i18n:govoplan-scheduling.request_failed.9fcda32c": "Request failed",
|
||||
"i18n:govoplan-scheduling.required.eed6bfb4": "Required",
|
||||
"i18n:govoplan-scheduling.requires_calendar_availability_read_access.b48ed91b": "Requires Calendar availability-read access.",
|
||||
"i18n:govoplan-scheduling.requires_calendar_event_write_access.887b0763": "Requires Calendar event-write access.",
|
||||
"i18n:govoplan-scheduling.responses_may_be_updated_while_this_request_remains_open.4faecbbe": "Responses may be updated while this request remains open.",
|
||||
"i18n:govoplan-scheduling.responded.4f218211": "Responded",
|
||||
"i18n:govoplan-scheduling.save.efc007a3": "Save",
|
||||
"i18n:govoplan-scheduling.saving.56a2285c": "Saving…",
|
||||
"i18n:govoplan-scheduling.scheduling_requests.b3c12f4d": "Scheduling requests",
|
||||
"i18n:govoplan-scheduling.scheduling_request_title_is_required.a27338be": "Scheduling request title is required.",
|
||||
"i18n:govoplan-scheduling.scheduling_requests_for_me.1d521aba": "Scheduling requests for me",
|
||||
"i18n:govoplan-scheduling.select_a_calendar.f6af95bb": "Select a calendar",
|
||||
"i18n:govoplan-scheduling.select_a_calendar_or_turn_off_calendar_integration.cc3652a9": "Select a calendar or turn off Calendar integration.",
|
||||
"i18n:govoplan-scheduling.send_reminder.cf5eb3bf": "Send reminder",
|
||||
"i18n:govoplan-scheduling.sending.ceafde86": "Sending",
|
||||
"i18n:govoplan-scheduling.sent.35f49dcf": "Sent",
|
||||
"i18n:govoplan-scheduling.skipped.5a000ad7": "Skipped",
|
||||
"i18n:govoplan-scheduling.start.952f3754": "Start",
|
||||
"i18n:govoplan-scheduling.system_or_tenant_administrator.f1a20104": "System or tenant administrator",
|
||||
"i18n:govoplan-scheduling.status.bae7d5be": "Status",
|
||||
"i18n:govoplan-scheduling.submit_response.a5f0c053": "Submit response",
|
||||
"i18n:govoplan-scheduling.tentative_holds_create_one_provisional_calendar_event_pe.ff3f1884": "Tentative holds create one provisional calendar event per candidate slot.",
|
||||
"i18n:govoplan-scheduling.the_final_event_is_created_only_for_the_selected_slot.e3621252": "The final event is created only for the selected slot.",
|
||||
"i18n:govoplan-scheduling.the_response_replaces_your_previous_availability_choices.74c16d53": "The response replaces your previous availability choices.",
|
||||
"i18n:govoplan-scheduling.title.768e0c1c": "Title",
|
||||
"i18n:govoplan-scheduling.unavailable.2c9c1f79": "Unavailable",
|
||||
"i18n:govoplan-scheduling.create_permission_required": "Creating a scheduling request requires Scheduling write or administration permission. Ask an Access or tenant administrator to grant it.",
|
||||
"i18n:govoplan-scheduling.unchecked.1b927dec": "Unchecked",
|
||||
"i18n:govoplan-scheduling.update_response.346233cf": "Update response",
|
||||
"i18n:govoplan-scheduling.use_a_calendar_for_availability_checks_tentative_holds_a.20ccc1fa": "Use a calendar for availability checks, tentative holds, and the final event.",
|
||||
"i18n:govoplan-scheduling.value_participants.e776b092": "{value0} participants",
|
||||
"i18n:govoplan-scheduling.value_responses.ba17af9a": "{value0} responses",
|
||||
"i18n:govoplan-scheduling.what_do_these_actions_do.9a9aee0e": "What do these actions do?",
|
||||
"i18n:govoplan-scheduling.where_to_go.f1a20103": "Where to go",
|
||||
"i18n:govoplan-scheduling.who_can_fix_it.f1a20102": "Who can fix it",
|
||||
"i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53": "You can respond here or use the invitation link you received.",
|
||||
"i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d": "Your response has been recorded."
|
||||
},
|
||||
de: {
|
||||
"i18n:govoplan-scheduling.self_enrollment.access": "Selbstanmeldung öffnen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.bind_account": "Diese Anmeldung mit meinem angemeldeten Konto verknüpfen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.bind_help": "Die Kontoverknüpfung muss bestätigt werden und ermöglicht die Verwaltung dieser Antwort in der Terminplanung.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.claim_anonymous": "Eine frühere anonyme Anmeldung mit ihrem Wiederherstellungsnachweis verknüpfen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.expires": "Link zur Selbstanmeldung läuft ab",
|
||||
"i18n:govoplan-scheduling.self_enrollment.invalid": "Dieser Link zur Selbstanmeldung ist ungültig, abgelaufen oder vollständig belegt, oder die angegebenen Daten sind falsch.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.proof": "Wiederherstellungsnachweis für anonyme Anmeldung",
|
||||
"i18n:govoplan-scheduling.self_enrollment.proof_help": "Bewahren Sie diesen Wert vertraulich auf. Er wird zum Aktualisieren oder späteren Verknüpfen einer anonymen Antwort benötigt und nie im Klartext gespeichert.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.remaining": "Verbleibende Anmeldeplätze",
|
||||
"i18n:govoplan-scheduling.self_enrollment.submit": "Anmelden und Antwort senden",
|
||||
"i18n:govoplan-scheduling.self_enrollment.saved": "Ihre Anmeldung und Antwort wurden gespeichert.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.participant_details": "Angaben zur teilnehmenden Person",
|
||||
"i18n:govoplan-scheduling.self_enrollment.links": "Öffentliche Links zur Selbstanmeldung",
|
||||
"i18n:govoplan-scheduling.self_enrollment.links_help": "Wiederverwendbare Links sind von persönlichen Einladungen getrennt. Jeder Link benötigt eine Kapazität und ein Ablaufdatum und wird beim Kopieren nur einmal angezeigt.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.expires_at": "Läuft ab am",
|
||||
"i18n:govoplan-scheduling.self_enrollment.maximum": "Maximale Anmeldungen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.allow_anonymous": "Anonyme Anmeldung mit Wiederherstellungsnachweis zulassen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.allow_authenticated": "Anmeldung mit Konto nach Bestätigung der Verknüpfung zulassen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.issue_copy": "Link ausstellen und kopieren",
|
||||
"i18n:govoplan-scheduling.self_enrollment.open_first": "Öffnen Sie die Anfrage, bevor Sie einen Link zur Selbstanmeldung ausstellen.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.loading_links": "Links zur Selbstanmeldung werden geladen …",
|
||||
"i18n:govoplan-scheduling.self_enrollment.no_links": "Es wurden noch keine Links zur Selbstanmeldung ausgestellt.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoke_title": "Link zur Selbstanmeldung widerrufen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoke_message": "Der wiederverwendbare Link wird sofort deaktiviert. Vorhandene Antworten bleiben weiterhin durch die Richtlinie der Anfrage geregelt.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.copied": "Ein neuer Link zur Selbstanmeldung wurde ausgestellt und kopiert. Seine Zugangsdaten werden nicht erneut angezeigt.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoked": "Der Link zur Selbstanmeldung wurde widerrufen.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.load_failed": "Die Links zur Selbstanmeldung konnten nicht geladen werden.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.issue_failed": "Der Link zur Selbstanmeldung konnte nicht ausgestellt werden.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.revoke_failed": "Der Link zur Selbstanmeldung konnte nicht widerrufen werden.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.clipboard_failed": "Der Link wurde ausgestellt, aber die Zwischenablage ist nicht verfügbar. Der neue Link wird automatisch widerrufen.",
|
||||
"i18n:govoplan-scheduling.self_enrollment.mode_anonymous": "anonym",
|
||||
"i18n:govoplan-scheduling.self_enrollment.mode_authenticated": "angemeldet",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_active": "Aktiv",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_expired": "Abgelaufen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_revoked": "Widerrufen",
|
||||
"i18n:govoplan-scheduling.self_enrollment.status_exhausted": "Vollständig belegt",
|
||||
"i18n:govoplan-scheduling.calendar_cleanup_retry_title": "Die Kalenderbereinigung erfordert Aufmerksamkeit.",
|
||||
"i18n:govoplan-scheduling.calendar_cleanup_retry_message": "{value0} Vorgänge für vorläufige Reservierungen stehen noch aus. Gleichen Sie fehlgeschlagene ausgehende Kalenderänderungen bei Bedarf ab und wiederholen Sie anschließend die ursprüngliche Entscheidungs- oder Abbruchaktion.",
|
||||
"i18n:govoplan-scheduling.access_details.79c06b89": "Zugangsdaten",
|
||||
"i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3": "Die automatische Einladungszustellung ist nicht verfügbar; kopieren Sie stattdessen den Link.",
|
||||
"i18n:govoplan-scheduling.cancellation_notice_available_until.f840d1e6": "Stornierungshinweis verfügbar bis",
|
||||
"i18n:govoplan-scheduling.copy_a_fresh_invitation_link_for_value0.e3799c79": "Einen neuen Einladungslink für {value0} kopieren",
|
||||
"i18n:govoplan-scheduling.enter_the_details_supplied_with_the_invitation_for_privacy.81ba419c": "Geben Sie die mit der Einladung übermittelten Daten ein. Aus Datenschutzgründen wird für ungültige und abgelaufene Links dieselbe Meldung angezeigt.",
|
||||
"i18n:govoplan-scheduling.loading_scheduling_request.43c39c1b": "Terminanfrage wird geladen …",
|
||||
"i18n:govoplan-scheduling.invitation_delivery_failed_the_link_was_created_but_was_not_delivered.8db0c306": "Die Zustellung der Einladung ist fehlgeschlagen. Der Link wurde erstellt, aber nicht zugestellt.",
|
||||
"i18n:govoplan-scheduling.invitation_delivery_requested.1aaa78ba": "Die Zustellung der Einladung wurde angefordert.",
|
||||
"i18n:govoplan-scheduling.invitation_link_copied.332973ec": "Einladungslink kopiert.",
|
||||
"i18n:govoplan-scheduling.invitation_link_revoked.c7dd20d4": "Einladungslink widerrufen.",
|
||||
"i18n:govoplan-scheduling.no_active_invitation_link_to_revoke.4ad0f0cc": "Kein aktiver Einladungslink zum Widerrufen vorhanden.",
|
||||
"i18n:govoplan-scheduling.open_in_scheduling.48df1541": "In der Terminplanung öffnen",
|
||||
"i18n:govoplan-scheduling.open_scheduling_request.31829cce": "Terminanfrage öffnen",
|
||||
"i18n:govoplan-scheduling.response_deadline.7fd9e3aa": "Antwortfrist",
|
||||
"i18n:govoplan-scheduling.reload_the_request_before_changing_this_invitation.9e685df4": "Laden Sie die Anfrage neu, bevor Sie diese Einladung ändern.",
|
||||
"i18n:govoplan-scheduling.participant.554f4235": "Teilnehmende Person",
|
||||
"i18n:govoplan-scheduling.revoke_invitation_link.87bf89cf": "Einladungslink widerrufen",
|
||||
"i18n:govoplan-scheduling.revoke_link.da371ee1": "Link widerrufen",
|
||||
"i18n:govoplan-scheduling.revoke_the_current_invitation_link_for_value0_it_will_stop_working_immediately.3cdc5817": "Den aktuellen Einladungslink für {value0} widerrufen? Er funktioniert danach sofort nicht mehr.",
|
||||
"i18n:govoplan-scheduling.revoke_the_invitation_link_for_value0.15a9c9fa": "Den Einladungslink für {value0} widerrufen",
|
||||
"i18n:govoplan-scheduling.send_a_fresh_invitation_to_value0.fd8d9dea": "Eine neue Einladung an {value0} senden",
|
||||
"i18n:govoplan-scheduling.the_cancellation_notice_has_expired_a_new_link_cannot_be_issued.9c6ccc7c": "Der Stornierungshinweis ist abgelaufen; ein neuer Link kann nicht ausgestellt werden.",
|
||||
"i18n:govoplan-scheduling.the_invitation_link_could_not_be_copied_check_browser_clipboard_permissions_and_try_again.a8b17cbc": "Der Einladungslink konnte nicht kopiert werden. Prüfen Sie die Zwischenablageberechtigungen des Browsers und versuchen Sie es erneut.",
|
||||
"i18n:govoplan-scheduling.this_participant_has_no_deliverable_email_address_or_account.dbe14180": "Für diese teilnehmende Person ist weder eine zustellbare E-Mail-Adresse noch ein Konto hinterlegt.",
|
||||
"i18n:govoplan-scheduling.this_invitation_changed_the_request_was_reloaded_try_again.c7095533": "Diese Einladung wurde zwischenzeitlich geändert. Die Anfrage wurde neu geladen; versuchen Sie es erneut.",
|
||||
"i18n:govoplan-scheduling.this_scheduling_link_is_invalid_expired_or_the_access_details.8e7aa197": "Dieser Terminlink ist ungültig oder abgelaufen, oder die Zugangsdaten stimmen nicht überein.",
|
||||
"i18n:govoplan-scheduling.this_scheduling_request_was_cancelled.1af3c85e": "Diese Terminanfrage wurde storniert.",
|
||||
"i18n:govoplan-scheduling.this_scheduling_request_is_no_longer_accepting_responses.c612e78a": "Diese Terminanfrage nimmt keine Antworten mehr an.",
|
||||
"i18n:govoplan-scheduling.your_availability.f86c8215": "Ihre Verfügbarkeit",
|
||||
"i18n:govoplan-scheduling.save_or_discard_your_unsent_availability_changes_before_leaving.97e10df1": "Speichern oder verwerfen Sie Ihre noch nicht gesendeten Verfügbarkeitsänderungen, bevor Sie die Ansicht verlassen.",
|
||||
"i18n:govoplan-scheduling.a_slot_can_be_selected_after_the_request_is_closed.f91ec02d": "Ein Terminvorschlag kann ausgewählt werden, nachdem die Anfrage geschlossen wurde.",
|
||||
"i18n:govoplan-scheduling.add_maybe_between_yes_and_no_for_each_candidate_slot.74dc9db6": "Für jeden Terminvorschlag Vielleicht zwischen Verfügbar und Nicht verfügbar anbieten.",
|
||||
"i18n:govoplan-scheduling.allow_comments.d63202a6": "Kommentare erlauben",
|
||||
"i18n:govoplan-scheduling.allow_external_participants.a9efcb52": "Externe Teilnehmende erlauben",
|
||||
"i18n:govoplan-scheduling.awaiting.42aa82e0": "Ausstehend",
|
||||
"i18n:govoplan-scheduling.capacity.d3c375f8": "Kapazität",
|
||||
"i18n:govoplan-scheduling.comment.d03495b1": "Kommentar",
|
||||
"i18n:govoplan-scheduling.create_an_organizer_notification_whenever_a_response_is.253ddca8": "Bei jeder neuen oder geänderten Antwort eine Benachrichtigung für die organisierende Person erstellen.",
|
||||
"i18n:govoplan-scheduling.each_participant_can_answer_yes_to_at_most_one_candidate.5313a465": "Jede teilnehmende Person kann höchstens einen Terminvorschlag als Verfügbar oder Vielleicht markieren.",
|
||||
"i18n:govoplan-scheduling.edit_scheduling_request.7e749c19": "Terminanfrage bearbeiten",
|
||||
"i18n:govoplan-scheduling.invited_participant_identity_is_locked_remove_and_add_the_participant_to_change_it.34e1201a": "Name und E-Mail-Adresse einer eingeladenen Person sind gesperrt. Entfernen Sie die Person und fügen Sie sie erneut hinzu, um diese Angaben zu ändern.",
|
||||
"i18n:govoplan-scheduling.guest_links_are_not_issued_while_the_configured_participation.0794ebf0": "Gastlinks werden nicht ausgegeben, solange die konfigurierten Teilnahmeregeln am öffentlichen Antwortzugang nicht durchgesetzt werden können. Angemeldete Teilnehmende können weiterhin hier antworten.",
|
||||
"i18n:govoplan-scheduling.guest_password.94545e82": "Gastpasswort",
|
||||
"i18n:govoplan-scheduling.let_participants_add_a_comment_to_their_response.9dce8d17": "Teilnehmende können ihrer Antwort einen Kommentar hinzufügen.",
|
||||
"i18n:govoplan-scheduling.limit_participants_per_option.1e9aa51d": "Teilnehmende je Terminvorschlag begrenzen",
|
||||
"i18n:govoplan-scheduling.maximum_participants_per_option.5abdfb27": "Maximale Teilnehmendenzahl je Terminvorschlag",
|
||||
"i18n:govoplan-scheduling.notify_me_about_each_answer.505749d6": "Über jede Antwort benachrichtigen",
|
||||
"i18n:govoplan-scheduling.participants_can_choose_only_one_option.4311f51c": "Teilnehmende können nur einen Terminvorschlag wählen",
|
||||
"i18n:govoplan-scheduling.participation.9ad70cc4": "Teilnahme",
|
||||
"i18n:govoplan-scheduling.participation_rate.46bc5504": "Teilnahmequote",
|
||||
"i18n:govoplan-scheduling.participation_settings.8dc6f62c": "Teilnahmeeinstellungen",
|
||||
"i18n:govoplan-scheduling.participant_privacy.108c470f": "Datenschutz für Teilnehmende",
|
||||
"i18n:govoplan-scheduling.participation_controls_are_locked_after_invitation_links_are_issued.66f5a740": "Teilnahmeregeln sind gesperrt, nachdem Einladungslinks erstellt wurden. Sichtbarkeit und Antwortbenachrichtigungen können weiterhin geändert werden.",
|
||||
"i18n:govoplan-scheduling.password_protect_guest_access.13d7f08b": "Gastzugang mit Passwort schützen",
|
||||
"i18n:govoplan-scheduling.people_responding_without_an_account_must_provide_an_email.19fd3dc8": "Personen ohne Konto müssen für ihre Antwort eine E-Mail-Adresse angeben.",
|
||||
"i18n:govoplan-scheduling.people_who_are_not_signed_in_must_enter_this_password.82bcc4ce": "Nicht angemeldete Personen müssen dieses Passwort eingeben, bevor sie die Anfrage sehen können.",
|
||||
"i18n:govoplan-scheduling.search_visible_accounts_and_contacts_or_add_an_external_perso.877f6b44": "Suchen Sie nach Konten und Kontakten, die Sie sehen dürfen. Wenn externe Teilnehmende erlaubt sind, können Sie Name und E-Mail-Adresse auch manuell hinzufügen.",
|
||||
"i18n:govoplan-scheduling.when_enabled_people_outside_the_configured_accounts_and.78829735": "Wenn diese Option aktiviert ist, können Personen außerhalb der eingerichteten Konten und Kontakte manuell hinzugefügt werden.",
|
||||
"i18n:govoplan-scheduling.provide_a_maybe_option.e39da57a": "Antwort Vielleicht anbieten",
|
||||
"i18n:govoplan-scheduling.require_an_email_address_from_guests.c2289a58": "E-Mail-Adresse von Gästen verlangen",
|
||||
"i18n:govoplan-scheduling.responses.3427e3ab": "Antworten",
|
||||
"i18n:govoplan-scheduling.response_results_are_not_available_for_this_view.1e82db18": "Antwortergebnisse sind für diese Ansicht nicht verfügbar.",
|
||||
"i18n:govoplan-scheduling.notifications_could_not_be_loaded.f0e1b2c3": "Benachrichtigungen konnten nicht geladen werden.",
|
||||
"i18n:govoplan-scheduling.stop_accepting_yes_responses_for_an_option_when_its_limit.79af21db": "Keine weiteren Verfügbar-Antworten annehmen, sobald die Begrenzung eines Terminvorschlags erreicht ist.",
|
||||
"i18n:govoplan-scheduling.use_at_least_8_characters_the_password_is_never_displayed.035708a2": "Verwenden Sie mindestens 8 Zeichen. Das Passwort wird nach dem Speichern nicht mehr angezeigt.",
|
||||
"i18n:govoplan-scheduling.add_participant.6cff957d": "Teilnehmende Person hinzufügen",
|
||||
"i18n:govoplan-scheduling.add_scheduling_request.3c71be15": "Terminanfrage hinzufügen",
|
||||
"i18n:govoplan-scheduling.add_slot.9fcff3ed": "Terminvorschlag hinzufügen",
|
||||
"i18n:govoplan-scheduling.answered.e0aafffa": "Beantwortet",
|
||||
"i18n:govoplan-scheduling.available.7c62a142": "Verfügbar",
|
||||
"i18n:govoplan-scheduling.awaiting_response.ee646ea9": "Antwort ausstehend",
|
||||
"i18n:govoplan-scheduling.basic_information.d8bc7383": "Grunddaten",
|
||||
"i18n:govoplan-scheduling.busy.592a9d16": "Belegt",
|
||||
"i18n:govoplan-scheduling.calendar.adab5090": "Kalender",
|
||||
"i18n:govoplan-scheduling.calendar_coordination.291ab00a": "Kalenderabgleich",
|
||||
"i18n:govoplan-scheduling.configured_calendar.e2e8ebd5": "Ausgewählter Kalender",
|
||||
"i18n:govoplan-scheduling.calendar_integration.181ad18b": "Kalenderintegration",
|
||||
"i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e": "Die Kalenderintegration benötigt das Kalendermodul sowie Leserechte für Kalender und Verfügbarkeiten und Schreibrechte für Termine.",
|
||||
"i18n:govoplan-scheduling.enable_calendar_and_grant_calendar_availability_and_event_access.f1a20106": "Aktivieren Sie Kalender und vergeben Sie Rechte für Kalender, Verfügbarkeiten und Termine.",
|
||||
"i18n:govoplan-scheduling.candidate_availability.9541c4b5": "Verfügbarkeit zu den Vorschlägen",
|
||||
"i18n:govoplan-scheduling.candidate_slots.c414946b": "Terminvorschläge",
|
||||
"i18n:govoplan-scheduling.check_free_busy.e9700e00": "Frei/Belegt prüfen",
|
||||
"i18n:govoplan-scheduling.choose_availability.ac95b8f6": "Verfügbarkeit auswählen",
|
||||
"i18n:govoplan-scheduling.choose_availability_for_at_least_one_candidate_slot.28d2111f": "Wählen Sie für mindestens einen Terminvorschlag eine Verfügbarkeit aus.",
|
||||
"i18n:govoplan-scheduling.close_poll.a6a18916": "Abstimmung schließen",
|
||||
"i18n:govoplan-scheduling.close_stops_accepting_new_availability_responses.a1d57519": "Schließen beendet die Annahme neuer Verfügbarkeitsantworten.",
|
||||
"i18n:govoplan-scheduling.closed.88d86b77": "Geschlossen",
|
||||
"i18n:govoplan-scheduling.create_calendar_event.0b87cfcf": "Kalendertermin erstellen",
|
||||
"i18n:govoplan-scheduling.create_tentative_holds.51c4744e": "Vorläufige Reservierungen erstellen",
|
||||
"i18n:govoplan-scheduling.cancellation.319aaae4": "Stornierung",
|
||||
"i18n:govoplan-scheduling.decision.7f59a1f1": "Entscheidung",
|
||||
"i18n:govoplan-scheduling.declined.ff59b80f": "Abgelehnt",
|
||||
"i18n:govoplan-scheduling.decide_on_value.196409cd": "{value0} als Termin festlegen",
|
||||
"i18n:govoplan-scheduling.description.55f8ebc8": "Beschreibung",
|
||||
"i18n:govoplan-scheduling.determined.9f23293d": "Festgelegt",
|
||||
"i18n:govoplan-scheduling.discard.36fff63c": "Verwerfen",
|
||||
"i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2": "Diese ungespeicherte Terminanfrage verwerfen?",
|
||||
"i18n:govoplan-scheduling.draft.23d33e22": "Entwurf",
|
||||
"i18n:govoplan-scheduling.enable_enforceable_public_participation_controls_or_keep_participation_signed_in.f1a20105": "Aktivieren Sie durchsetzbare Regeln für die öffentliche Teilnahme oder beschränken Sie die Teilnahme auf angemeldete Personen.",
|
||||
"i18n:govoplan-scheduling.end.a2bb9d34": "Ende",
|
||||
"i18n:govoplan-scheduling.error.7f2f6a15": "Fehler",
|
||||
"i18n:govoplan-scheduling.every_candidate_slot_must_end_after_it_starts.47836010": "Jeder Terminvorschlag muss nach seinem Beginn enden.",
|
||||
"i18n:govoplan-scheduling.failed.09fef5d8": "Fehlgeschlagen",
|
||||
"i18n:govoplan-scheduling.free.75f52718": "Frei",
|
||||
"i18n:govoplan-scheduling.free_busy_checks_each_candidate_slot_against_the_selecte.50f0371a": "Frei/Belegt prüft jeden Terminvorschlag gegen den ausgewählten Kalender.",
|
||||
"i18n:govoplan-scheduling.loading_scheduling_requests.f42be95d": "Terminanfragen werden geladen …",
|
||||
"i18n:govoplan-scheduling.invitation.6306ef74": "Einladung",
|
||||
"i18n:govoplan-scheduling.invited.53469df1": "Eingeladen",
|
||||
"i18n:govoplan-scheduling.location.d219c681": "Ort",
|
||||
"i18n:govoplan-scheduling.managed_scheduling_requests.7a45972f": "Verwaltete Terminanfragen",
|
||||
"i18n:govoplan-scheduling.maybe.56dd8d0b": "Vielleicht",
|
||||
"i18n:govoplan-scheduling.my_scheduling_requests.d28ef235": "Meine Terminanfragen",
|
||||
"i18n:govoplan-scheduling.name.709a2322": "Name",
|
||||
"i18n:govoplan-scheduling.new_scheduling_request.2080f675": "Neue Terminanfrage",
|
||||
"i18n:govoplan-scheduling.no_notifications_have_been_created.c8d43ca3": "Es wurden noch keine Benachrichtigungen erstellt.",
|
||||
"i18n:govoplan-scheduling.no_participants.73a89101": "Keine Teilnehmenden",
|
||||
"i18n:govoplan-scheduling.no_requests_in_this_group.a63c1b40": "Keine Anfragen in dieser Gruppe",
|
||||
"i18n:govoplan-scheduling.no_scheduling_request_selected.ac940664": "Keine Terminanfrage ausgewählt",
|
||||
"i18n:govoplan-scheduling.notifications.753a22b2": "Benachrichtigungen",
|
||||
"i18n:govoplan-scheduling.open.cf9b7706": "Offen",
|
||||
"i18n:govoplan-scheduling.open_poll.2beac9a7": "Abstimmung öffnen",
|
||||
"i18n:govoplan-scheduling.open_starts_collecting_availability_responses.c8ec34e5": "Öffnen startet die Erfassung von Verfügbarkeitsantworten.",
|
||||
"i18n:govoplan-scheduling.option_value.3f643dc0": "Vorschlag {value0}",
|
||||
"i18n:govoplan-scheduling.other_scheduling_requests.5cb6eb30": "Andere Terminanfragen",
|
||||
"i18n:govoplan-scheduling.participant_email.2cadfd9e": "E-Mail der teilnehmenden Person",
|
||||
"i18n:govoplan-scheduling.participant_names_and_statuses_are_hidden_aggregate_counts_r.d811a69a": "Namen und Antwortstatus der Teilnehmenden sind ausgeblendet. Zusammengefasste Anzahlen bleiben sichtbar.",
|
||||
"i18n:govoplan-scheduling.participant_removed.0cf4ec4c": "Teilnehmende Person entfernt",
|
||||
"i18n:govoplan-scheduling.participant_replaced.2623752d": "Teilnehmende Person ersetzt",
|
||||
"i18n:govoplan-scheduling.share_participant_names_and_response_statuses.df0bf9e0": "Namen und Antwortstatus der Teilnehmenden freigeben",
|
||||
"i18n:govoplan-scheduling.when_enabled_participants_can_see_other_participants_names.3ac78361": "Wenn aktiviert, sehen Teilnehmende die Namen und Antwortstatus anderer Teilnehmender. E-Mail-Adressen und Einladungsdetails bleiben privat.",
|
||||
"i18n:govoplan-scheduling.participants.cd56e083": "Teilnehmende",
|
||||
"i18n:govoplan-scheduling.past.405c12fb": "Vergangen",
|
||||
"i18n:govoplan-scheduling.pending.96f608c1": "Ausstehend",
|
||||
"i18n:govoplan-scheduling.queued.6a599877": "Eingereiht",
|
||||
"i18n:govoplan-scheduling.refresh_requests.0a3ed7a1": "Anfragen aktualisieren",
|
||||
"i18n:govoplan-scheduling.required_action.f1a20101": "Erforderliche Maßnahme",
|
||||
"i18n:govoplan-scheduling.reminder_creates_a_notification_job_for_every_active_par.7ec68797": "Erinnern erstellt für jede aktive teilnehmende Person einen Benachrichtigungsauftrag.",
|
||||
"i18n:govoplan-scheduling.remove.e963907d": "Entfernen",
|
||||
"i18n:govoplan-scheduling.remove_participant_value.e55f2b70": "Teilnehmende Person {value0} entfernen",
|
||||
"i18n:govoplan-scheduling.remove_slot_value.3adc7576": "Terminvorschlag {value0} entfernen",
|
||||
"i18n:govoplan-scheduling.removed.b5e77c5c": "Entfernt",
|
||||
"i18n:govoplan-scheduling.reminder.b87a1929": "Erinnerung",
|
||||
"i18n:govoplan-scheduling.request_failed.9fcda32c": "Anfrage fehlgeschlagen",
|
||||
"i18n:govoplan-scheduling.required.eed6bfb4": "Erforderlich",
|
||||
"i18n:govoplan-scheduling.requires_calendar_availability_read_access.b48ed91b": "Erfordert Leserechte für Kalenderverfügbarkeiten.",
|
||||
"i18n:govoplan-scheduling.requires_calendar_event_write_access.887b0763": "Erfordert Schreibrechte für Kalendertermine.",
|
||||
"i18n:govoplan-scheduling.responses_may_be_updated_while_this_request_remains_open.4faecbbe": "Antworten können aktualisiert werden, solange diese Anfrage offen ist.",
|
||||
"i18n:govoplan-scheduling.responded.4f218211": "Geantwortet",
|
||||
"i18n:govoplan-scheduling.save.efc007a3": "Speichern",
|
||||
"i18n:govoplan-scheduling.saving.56a2285c": "Wird gespeichert …",
|
||||
"i18n:govoplan-scheduling.scheduling_requests.b3c12f4d": "Terminanfragen",
|
||||
"i18n:govoplan-scheduling.scheduling_request_title_is_required.a27338be": "Für die Terminanfrage ist ein Titel erforderlich.",
|
||||
"i18n:govoplan-scheduling.scheduling_requests_for_me.1d521aba": "Terminanfragen an mich",
|
||||
"i18n:govoplan-scheduling.select_a_calendar.f6af95bb": "Kalender auswählen",
|
||||
"i18n:govoplan-scheduling.select_a_calendar_or_turn_off_calendar_integration.cc3652a9": "Wählen Sie einen Kalender aus oder schalten Sie die Kalenderintegration aus.",
|
||||
"i18n:govoplan-scheduling.send_reminder.cf5eb3bf": "Erinnerung senden",
|
||||
"i18n:govoplan-scheduling.sending.ceafde86": "Wird gesendet",
|
||||
"i18n:govoplan-scheduling.sent.35f49dcf": "Gesendet",
|
||||
"i18n:govoplan-scheduling.skipped.5a000ad7": "Übersprungen",
|
||||
"i18n:govoplan-scheduling.start.952f3754": "Beginn",
|
||||
"i18n:govoplan-scheduling.system_or_tenant_administrator.f1a20104": "System- oder Mandantenadministration",
|
||||
"i18n:govoplan-scheduling.status.bae7d5be": "Status",
|
||||
"i18n:govoplan-scheduling.submit_response.a5f0c053": "Antwort senden",
|
||||
"i18n:govoplan-scheduling.tentative_holds_create_one_provisional_calendar_event_pe.ff3f1884": "Vorläufige Reservierungen erstellen je Terminvorschlag einen provisorischen Kalendereintrag.",
|
||||
"i18n:govoplan-scheduling.the_final_event_is_created_only_for_the_selected_slot.e3621252": "Der endgültige Kalendereintrag wird nur für den ausgewählten Termin erstellt.",
|
||||
"i18n:govoplan-scheduling.the_response_replaces_your_previous_availability_choices.74c16d53": "Die Antwort ersetzt Ihre vorherige Verfügbarkeitsauswahl.",
|
||||
"i18n:govoplan-scheduling.title.768e0c1c": "Titel",
|
||||
"i18n:govoplan-scheduling.unavailable.2c9c1f79": "Nicht verfügbar",
|
||||
"i18n:govoplan-scheduling.create_permission_required": "Zum Anlegen einer Terminanfrage benötigen Sie Schreib- oder Administrationsrechte für Scheduling. Bitten Sie die Access- oder Mandantenadministration um diese Berechtigung.",
|
||||
"i18n:govoplan-scheduling.unchecked.1b927dec": "Nicht geprüft",
|
||||
"i18n:govoplan-scheduling.update_response.346233cf": "Antwort aktualisieren",
|
||||
"i18n:govoplan-scheduling.use_a_calendar_for_availability_checks_tentative_holds_a.20ccc1fa": "Einen Kalender für Verfügbarkeitsprüfungen, vorläufige Reservierungen und den endgültigen Termin verwenden.",
|
||||
"i18n:govoplan-scheduling.value_participants.e776b092": "{value0} Teilnehmende",
|
||||
"i18n:govoplan-scheduling.value_responses.ba17af9a": "{value0} Antworten",
|
||||
"i18n:govoplan-scheduling.what_do_these_actions_do.9a9aee0e": "Was bewirken diese Aktionen?",
|
||||
"i18n:govoplan-scheduling.where_to_go.f1a20103": "Ziel",
|
||||
"i18n:govoplan-scheduling.who_can_fix_it.f1a20102": "Zuständig",
|
||||
"i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53": "Sie können hier oder über den erhaltenen Einladungslink antworten.",
|
||||
"i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d": "Ihre Antwort wurde gespeichert."
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
export { schedulingModule as default, schedulingModule } from "./module";
|
||||
export * from "./api/scheduling";
|
||||
@@ -0,0 +1,97 @@
|
||||
import { createElement, lazy } from "react";
|
||||
import type {
|
||||
DashboardWidgetsUiCapability,
|
||||
PlatformWebModule
|
||||
} from "@govoplan/core-webui";
|
||||
import SchedulingRequestsWidget from "./features/scheduling/SchedulingRequestsWidget";
|
||||
import { generatedTranslations } from "./i18n/generatedTranslations";
|
||||
import "./styles/scheduling.css";
|
||||
|
||||
const SchedulingPage = lazy(() => import("./features/scheduling/SchedulingPage"));
|
||||
const SchedulingPublicPage = lazy(() => import("./features/scheduling/SchedulingPublicPage"));
|
||||
const SchedulingEnrollmentPage = lazy(() => import("./features/scheduling/SchedulingEnrollmentPage"));
|
||||
|
||||
const scheduleRead = ["scheduling:schedule:read"];
|
||||
const schedulingDashboardWidgets: DashboardWidgetsUiCapability = {
|
||||
widgets: [
|
||||
{
|
||||
id: "scheduling.open-requests",
|
||||
surfaceId: "scheduling.widget.open-requests",
|
||||
title: "Scheduling requests",
|
||||
description: "Open scheduling polls and their response progress.",
|
||||
moduleId: "scheduling",
|
||||
category: "Planning",
|
||||
order: 45,
|
||||
defaultVisible: false,
|
||||
defaultSize: "medium",
|
||||
supportedSizes: ["medium", "wide"],
|
||||
anyOf: scheduleRead,
|
||||
refreshIntervalMs: 60_000,
|
||||
defaultConfiguration: {
|
||||
maxItems: 5,
|
||||
includeDrafts: false
|
||||
},
|
||||
configurationFields: [
|
||||
{
|
||||
id: "maxItems",
|
||||
label: "Maximum requests",
|
||||
kind: "number",
|
||||
min: 1,
|
||||
max: 12,
|
||||
step: 1,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
id: "includeDrafts",
|
||||
label: "Include drafts",
|
||||
kind: "boolean"
|
||||
}
|
||||
],
|
||||
render: ({ settings, refreshKey, configuration }) =>
|
||||
createElement(SchedulingRequestsWidget, {
|
||||
settings,
|
||||
refreshKey,
|
||||
configuration
|
||||
})
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const schedulingModule: PlatformWebModule = {
|
||||
id: "scheduling",
|
||||
label: "Scheduling",
|
||||
version: "0.1.20",
|
||||
dependencies: ["poll"],
|
||||
optionalDependencies: ["access", "calendar", "mail", "notifications", "workflow", "appointments", "addresses"],
|
||||
translations: generatedTranslations,
|
||||
viewSurfaces: [
|
||||
{
|
||||
id: "scheduling.widget.open-requests",
|
||||
moduleId: "scheduling",
|
||||
kind: "section",
|
||||
label: "Scheduling requests widget",
|
||||
order: 45
|
||||
}
|
||||
],
|
||||
navItems: [{ to: "/scheduling", label: "Scheduling", iconName: "calendar-clock", anyOf: scheduleRead, order: 56 }],
|
||||
routes: [
|
||||
{ path: "/scheduling", anyOf: scheduleRead, order: 56, render: ({ settings, auth }) => createElement(SchedulingPage, { settings, auth }) }
|
||||
],
|
||||
publicRoutes: [
|
||||
{
|
||||
path: "/scheduling/public/:requestId/:token",
|
||||
order: 10,
|
||||
render: ({ settings, auth }) => createElement(SchedulingPublicPage, { settings, auth })
|
||||
},
|
||||
{
|
||||
path: "/scheduling/enrol/:requestId/:token",
|
||||
order: 11,
|
||||
render: ({ settings, auth }) => createElement(SchedulingEnrollmentPage, { settings, auth })
|
||||
}
|
||||
],
|
||||
uiCapabilities: {
|
||||
"dashboard.widgets": schedulingDashboardWidgets
|
||||
}
|
||||
};
|
||||
|
||||
export default schedulingModule;
|
||||
@@ -0,0 +1,462 @@
|
||||
.scheduling-public-page {
|
||||
width: min(920px, calc(100% - 32px));
|
||||
margin: 0 auto;
|
||||
padding: 24px 0 48px;
|
||||
}
|
||||
|
||||
.scheduling-public-page .loading-frame {
|
||||
min-height: 240px;
|
||||
}
|
||||
|
||||
.scheduling-public-content,
|
||||
.scheduling-public-access-form,
|
||||
.scheduling-public-slots {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.scheduling-public-deep-link,
|
||||
.scheduling-public-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.scheduling-public-actions {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.scheduling-public-description {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.scheduling-public-summary {
|
||||
display: grid;
|
||||
grid-template-columns: max-content minmax(0, 1fr);
|
||||
gap: 6px 14px;
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.scheduling-public-summary dt {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.scheduling-public-summary dd {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.scheduling-public-slot {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 14px;
|
||||
border: var(--border-line);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.scheduling-public-slot legend {
|
||||
padding: 0 4px;
|
||||
color: var(--text-strong);
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.scheduling-public-slot p {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.scheduling-public-choice-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.scheduling-public-choice-group label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
border: var(--border-line);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--panel-soft);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.scheduling-public-choice-group label:has(input:checked) {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.scheduling-public-page {
|
||||
width: min(100% - 20px, 920px);
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.scheduling-public-summary {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.scheduling-workspace {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
border: var(--border-line);
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.scheduling-workspace-layout {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
flex: 1 1 auto;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(310px, 370px) minmax(0, 1fr);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scheduling-request-sidebar,
|
||||
.scheduling-main-panel,
|
||||
.scheduling-editor-surface {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.scheduling-request-sidebar {
|
||||
padding: 12px;
|
||||
border-right: var(--border-line);
|
||||
background: var(--panel-soft);
|
||||
}
|
||||
|
||||
.scheduling-request-sidebar > .card {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.scheduling-request-sidebar > .card > .card-body {
|
||||
min-height: 0;
|
||||
flex: 1 1 auto;
|
||||
overflow: auto;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.scheduling-main-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.scheduling-main-panel > .alert {
|
||||
flex: 0 0 auto;
|
||||
margin: 12px 14px 0;
|
||||
}
|
||||
|
||||
.scheduling-editor-surface {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scheduling-page-title,
|
||||
.scheduling-page-actions,
|
||||
.scheduling-card-actions,
|
||||
.scheduling-actions,
|
||||
.scheduling-status-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.scheduling-page-title {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.scheduling-page-title > div {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.scheduling-page-title h1 {
|
||||
margin: 0;
|
||||
color: var(--text-strong);
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
.scheduling-page-title p {
|
||||
margin: 3px 0 0;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.scheduling-page-actions,
|
||||
.scheduling-card-actions,
|
||||
.scheduling-actions {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.scheduling-page-actions {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.scheduling-page-actions .btn,
|
||||
.scheduling-card-actions .btn,
|
||||
.scheduling-actions .btn,
|
||||
.scheduling-response-card + .btn {
|
||||
min-height: 34px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.scheduling-detail,
|
||||
.scheduling-editor-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.scheduling-detail,
|
||||
.scheduling-editor-scroll {
|
||||
display: grid;
|
||||
align-content: start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.scheduling-request-group + .scheduling-request-group {
|
||||
margin-top: 14px;
|
||||
padding-top: 14px;
|
||||
border-top: var(--border-line);
|
||||
}
|
||||
|
||||
.scheduling-request-group h2 {
|
||||
margin: 0 0 8px;
|
||||
color: var(--text-strong);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.scheduling-list-group {
|
||||
min-height: 52px;
|
||||
max-height: min(31vh, 320px);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.scheduling-request-list {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.scheduling-list-item {
|
||||
min-height: 50px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.scheduling-list-item > span {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.scheduling-list-item strong,
|
||||
.scheduling-list-item small,
|
||||
.scheduling-compact-row span {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.scheduling-list-item small,
|
||||
.scheduling-note,
|
||||
.scheduling-list-empty,
|
||||
.scheduling-compact-row small {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.scheduling-list-empty {
|
||||
margin: 3px 0 8px;
|
||||
}
|
||||
|
||||
.scheduling-status-row {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.scheduling-slot-title {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
justify-items: start;
|
||||
}
|
||||
|
||||
.scheduling-compact-row {
|
||||
min-height: 36px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
border-bottom: var(--border-line);
|
||||
}
|
||||
|
||||
.scheduling-compact-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.scheduling-response-card {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.scheduling-response-card > p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.scheduling-response-grid {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.scheduling-response-grid label {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 1fr) minmax(160px, 240px);
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
border-bottom: var(--border-line);
|
||||
}
|
||||
|
||||
.scheduling-response-grid label:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.scheduling-response-grid label > span {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.scheduling-response-grid small {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.scheduling-action-help {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.scheduling-empty {
|
||||
padding: 28px;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.scheduling-setting-with-field {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.scheduling-setting-with-field .form-field {
|
||||
padding-left: 48px;
|
||||
}
|
||||
|
||||
.scheduling-capability-note {
|
||||
margin: 10px 0 0;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.scheduling-selected-calendar {
|
||||
max-width: 560px;
|
||||
}
|
||||
|
||||
.scheduling-enrollment-confirmation {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.scheduling-enrollment-confirmation span {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.scheduling-enrollment-confirmation small,
|
||||
.scheduling-enrollment-links small {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.scheduling-enrollment-modes,
|
||||
.scheduling-enrollment-links {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.scheduling-enrollment-links .scheduling-compact-row > span:first-child {
|
||||
display: grid;
|
||||
flex: 1;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.scheduling-workspace-layout {
|
||||
grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.scheduling-page {
|
||||
height: auto;
|
||||
min-height: calc(100vh - 115px);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.scheduling-workspace,
|
||||
.scheduling-workspace-layout,
|
||||
.scheduling-main-panel,
|
||||
.scheduling-editor-surface,
|
||||
.scheduling-detail,
|
||||
.scheduling-editor-scroll {
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.scheduling-workspace-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.scheduling-request-sidebar {
|
||||
max-height: 48vh;
|
||||
border-right: 0;
|
||||
border-bottom: var(--border-line);
|
||||
}
|
||||
|
||||
.scheduling-page-actions,
|
||||
.scheduling-card-actions,
|
||||
.scheduling-actions {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.scheduling-page-actions .btn:last-child,
|
||||
.scheduling-card-actions .btn:last-child,
|
||||
.scheduling-actions .btn:last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.scheduling-response-grid label {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_API_BASE_URL?: string;
|
||||
readonly VITE_CSRF_COOKIE_NAME?: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
|
||||
declare module "virtual:govoplan-installed-modules" {
|
||||
const modules: any[];
|
||||
export default modules;
|
||||
}
|
||||
@@ -0,0 +1,409 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import type { SchedulingRequest } from "../src/api/scheduling.ts";
|
||||
import {
|
||||
applySchedulingAvailabilityChoice,
|
||||
groupSchedulingRequests,
|
||||
participantDraftFromResponse,
|
||||
participantDraftsFromPicker,
|
||||
participantPayload,
|
||||
schedulingInvitationActionBlocks,
|
||||
schedulingLifecycleStages,
|
||||
schedulingPublicInvitationUrl,
|
||||
schedulingSortPhase,
|
||||
type SchedulingActor
|
||||
} from "../src/features/scheduling/schedulingViewModel.ts";
|
||||
|
||||
test("derives the scheduling lifecycle without inventing new backend states", () => {
|
||||
assert.deepEqual(schedulingLifecycleStages("draft"), [
|
||||
{ id: "prepare", state: "current", current: true, locked: false },
|
||||
{ id: "participate", state: "locked", current: false, locked: true },
|
||||
{ id: "decide", state: "locked", current: false, locked: true }
|
||||
]);
|
||||
assert.deepEqual(schedulingLifecycleStages("collecting"), [
|
||||
{ id: "prepare", state: "complete", current: false, locked: false },
|
||||
{ id: "participate", state: "current", current: true, locked: false },
|
||||
{ id: "decide", state: "locked", current: false, locked: true }
|
||||
]);
|
||||
assert.deepEqual(schedulingLifecycleStages("closed"), [
|
||||
{ id: "prepare", state: "complete", current: false, locked: false },
|
||||
{ id: "participate", state: "complete", current: false, locked: false },
|
||||
{ id: "decide", state: "current", current: true, locked: false }
|
||||
]);
|
||||
assert.deepEqual(schedulingLifecycleStages("handed_off").map((stage) => stage.state), [
|
||||
"complete",
|
||||
"complete",
|
||||
"complete"
|
||||
]);
|
||||
assert.deepEqual(schedulingLifecycleStages("cancelled"), [
|
||||
{ id: "prepare", state: "complete", current: false, locked: false },
|
||||
{ id: "participate", state: "stopped", current: true, locked: false },
|
||||
{ id: "decide", state: "locked", current: false, locked: true }
|
||||
]);
|
||||
});
|
||||
|
||||
test("maps visible account and contact selections into bounded scheduling participant payloads", () => {
|
||||
let sequence = 0;
|
||||
const selected = participantDraftsFromPicker([
|
||||
{
|
||||
selection_key: "account:account-2",
|
||||
kind: "account",
|
||||
reference_id: "account-2",
|
||||
display_name: "Ada Account",
|
||||
email: "ADA@EXAMPLE.TEST",
|
||||
source_module: "access",
|
||||
source_label: "Accounts",
|
||||
provenance: { tenant_id: "must-not-be-persisted" },
|
||||
metadata: { group_ids: ["must-not-be-persisted"] }
|
||||
},
|
||||
{
|
||||
selection_key: "contact:contact-3:contact@example.test",
|
||||
kind: "contact",
|
||||
reference_id: "contact-3",
|
||||
display_name: "Contact Person",
|
||||
email: "contact@example.test",
|
||||
source_module: "addresses",
|
||||
source_label: "Contacts",
|
||||
source_revision: "revision-3",
|
||||
provenance: { address_book_id: "must-not-be-persisted" }
|
||||
}
|
||||
], [], () => `participant-${++sequence}`);
|
||||
|
||||
assert.equal(selected[0].respondent_id, "account-2");
|
||||
assert.equal(selected[0].participant_type, "internal");
|
||||
assert.equal(selected[0].email, "ada@example.test");
|
||||
assert.deepEqual(selected[0].metadata, {
|
||||
directory_selection: {
|
||||
selection_key: "account:account-2",
|
||||
kind: "account",
|
||||
reference_id: "account-2",
|
||||
source_module: "access",
|
||||
source_label: "Accounts",
|
||||
source_revision: null
|
||||
}
|
||||
});
|
||||
assert.equal(selected[1].respondent_id, null);
|
||||
assert.equal(selected[1].participant_type, "external");
|
||||
assert.equal(
|
||||
(selected[1].metadata?.directory_selection as { source_revision: string }).source_revision,
|
||||
"revision-3"
|
||||
);
|
||||
assert.deepEqual(participantPayload(selected[1]), {
|
||||
respondent_id: null,
|
||||
display_name: "Contact Person",
|
||||
email: "contact@example.test",
|
||||
participant_type: "external",
|
||||
required: true,
|
||||
metadata: selected[1].metadata
|
||||
});
|
||||
});
|
||||
|
||||
test("reconstructs saved directory selections and preserves existing reconciliation identity", () => {
|
||||
const responseParticipant = {
|
||||
id: "stored-participant",
|
||||
revision: "a".repeat(64),
|
||||
is_current_participant: false,
|
||||
respondent_id: "account-2",
|
||||
display_name: "Ada Account",
|
||||
email: "ada@example.test",
|
||||
participant_type: "internal",
|
||||
required: true,
|
||||
status: "invited",
|
||||
poll_invitation_id: "invitation-1",
|
||||
metadata: {
|
||||
directory_selection: {
|
||||
selection_key: "account:account-2",
|
||||
kind: "account",
|
||||
reference_id: "account-2",
|
||||
source_module: "access",
|
||||
source_label: "Accounts"
|
||||
}
|
||||
}
|
||||
};
|
||||
const draft = participantDraftFromResponse(responseParticipant, "draft-1");
|
||||
const remapped = participantDraftsFromPicker([draft], [draft], () => "unexpected");
|
||||
|
||||
assert.equal(remapped[0], draft);
|
||||
assert.equal(draft.sourceId, "stored-participant");
|
||||
assert.equal(draft.identityLocked, true);
|
||||
assert.equal(participantPayload(draft).id, "stored-participant");
|
||||
assert.equal(participantPayload(draft).revision, "a".repeat(64));
|
||||
});
|
||||
|
||||
const now = new Date("2026-07-20T10:00:00Z");
|
||||
const actor: SchedulingActor = {
|
||||
accountId: "account-1",
|
||||
membershipId: "membership-1",
|
||||
email: "person@example.test"
|
||||
};
|
||||
|
||||
function request(
|
||||
id: string,
|
||||
options: {
|
||||
organizer?: string;
|
||||
participantStatus?: string;
|
||||
status?: SchedulingRequest["status"];
|
||||
start?: string;
|
||||
end?: string;
|
||||
} = {}
|
||||
): SchedulingRequest {
|
||||
return {
|
||||
id,
|
||||
tenant_id: "tenant-1",
|
||||
title: id,
|
||||
timezone: "UTC",
|
||||
status: options.status ?? "collecting",
|
||||
organizer_user_id: options.organizer ?? "organizer-elsewhere",
|
||||
allow_external_participants: true,
|
||||
allow_participant_updates: true,
|
||||
result_visibility: "after_close",
|
||||
participant_visibility: "aggregates_only",
|
||||
effective_participant_visibility: "aggregates_only",
|
||||
participant_aggregate: {
|
||||
total: options.participantStatus ? 1 : 0,
|
||||
status_counts: options.participantStatus ? { [options.participantStatus]: 1 } : {}
|
||||
},
|
||||
participant_visibility_decision: {
|
||||
requested_visibility: "aggregates_only",
|
||||
effective_visibility: "aggregates_only",
|
||||
policy_applied: false,
|
||||
source_path: [],
|
||||
details: {}
|
||||
},
|
||||
notify_on_answers: true,
|
||||
single_choice: false,
|
||||
max_participants_per_option: null,
|
||||
allow_maybe: true,
|
||||
allow_comments: false,
|
||||
participant_email_required: false,
|
||||
anonymous_password_protection_enabled: false,
|
||||
public_participation_policy_enforcement_available: false,
|
||||
public_participation_policy_enforcement_reason: "Public participation gateway not installed",
|
||||
participant_invitation_delivery_available: false,
|
||||
calendar_integration_enabled: false,
|
||||
calendar_freebusy_enabled: false,
|
||||
calendar_hold_enabled: false,
|
||||
create_calendar_event_on_decision: false,
|
||||
created_at: "2026-07-01T00:00:00Z",
|
||||
updated_at: "2026-07-01T00:00:00Z",
|
||||
metadata: {},
|
||||
slots: [{
|
||||
id: `slot-${id}`,
|
||||
label: id,
|
||||
start_at: options.start ?? "2026-07-21T09:00:00Z",
|
||||
end_at: options.end ?? "2026-07-21T10:00:00Z",
|
||||
timezone: "UTC",
|
||||
position: 0,
|
||||
revision: "0".repeat(64),
|
||||
freebusy_conflicts: [],
|
||||
metadata: {}
|
||||
}],
|
||||
participants: options.participantStatus ? [{
|
||||
id: `participant-${id}`,
|
||||
is_current_participant: true,
|
||||
respondent_id: "membership-1",
|
||||
email: "person@example.test",
|
||||
participant_type: "internal",
|
||||
required: true,
|
||||
status: options.participantStatus,
|
||||
metadata: {}
|
||||
}] : []
|
||||
};
|
||||
}
|
||||
|
||||
test("groups owned, invited, and administrator-only requests without hiding any", () => {
|
||||
const groups = groupSchedulingRequests([
|
||||
request("managed"),
|
||||
request("mine", { organizer: "account-1" }),
|
||||
request("invited", { participantStatus: "invited" })
|
||||
], actor, now);
|
||||
|
||||
assert.deepEqual(groups.owned.map((item) => item.id), ["mine"]);
|
||||
assert.deepEqual(groups.invited.map((item) => item.id), ["invited"]);
|
||||
assert.deepEqual(groups.other.map((item) => item.id), ["managed"]);
|
||||
});
|
||||
|
||||
test("matches email-only invitations without case sensitivity", () => {
|
||||
const invited = request("email-case", { participantStatus: "invited" });
|
||||
invited.participants[0].is_current_participant = false;
|
||||
invited.participants[0].respondent_id = null;
|
||||
invited.participants[0].email = "Person@Example.Test";
|
||||
|
||||
const groups = groupSchedulingRequests([invited], actor, now);
|
||||
|
||||
assert.deepEqual(groups.invited.map((item) => item.id), ["email-case"]);
|
||||
assert.deepEqual(groups.other, []);
|
||||
});
|
||||
|
||||
test("recognizes the current participant after identity bindings are redacted", () => {
|
||||
const invited = request("safe-projection", { participantStatus: "invited" });
|
||||
invited.participants[0].respondent_id = null;
|
||||
invited.participants[0].email = null;
|
||||
|
||||
const groups = groupSchedulingRequests([invited], actor, now);
|
||||
|
||||
assert.deepEqual(groups.invited.map((item) => item.id), ["safe-projection"]);
|
||||
assert.deepEqual(groups.other, []);
|
||||
});
|
||||
|
||||
test("keeps an organizer's active request in the open phase even if they also responded", () => {
|
||||
const owned = request("mine-and-invited", {
|
||||
organizer: "account-1",
|
||||
participantStatus: "responded"
|
||||
});
|
||||
|
||||
assert.equal(schedulingSortPhase(owned, actor, now), "unanswered");
|
||||
});
|
||||
|
||||
test("orders unanswered by nearest slot before answered, closed, determined, and past", () => {
|
||||
const groups = groupSchedulingRequests([
|
||||
request("past", {
|
||||
participantStatus: "invited",
|
||||
start: "2026-07-18T09:00:00Z",
|
||||
end: "2026-07-18T10:00:00Z"
|
||||
}),
|
||||
request("determined", { participantStatus: "invited", status: "decided" }),
|
||||
request("closed", { participantStatus: "invited", status: "closed" }),
|
||||
request("answered", { participantStatus: "responded" }),
|
||||
request("later", { participantStatus: "invited", start: "2026-07-23T09:00:00Z" }),
|
||||
request("nearer", { participantStatus: "invited", start: "2026-07-21T09:00:00Z" })
|
||||
], actor, now);
|
||||
|
||||
assert.deepEqual(groups.invited.map((item) => item.id), [
|
||||
"nearer",
|
||||
"later",
|
||||
"answered",
|
||||
"closed",
|
||||
"determined",
|
||||
"past"
|
||||
]);
|
||||
assert.equal(schedulingSortPhase(groups.invited[0], actor, now), "unanswered");
|
||||
assert.equal(schedulingSortPhase(groups.invited.at(-1)!, actor, now), "past");
|
||||
});
|
||||
|
||||
test("derives stable invitation action blocks from policy, delivery, and participant state", () => {
|
||||
const managed = request("invitation-actions", { participantStatus: "invited" });
|
||||
managed.poll_id = "poll-1";
|
||||
managed.public_participation_policy_enforcement_available = true;
|
||||
managed.public_participation_policy_enforcement_reason = null;
|
||||
managed.participant_invitation_delivery_available = true;
|
||||
const participant = managed.participants[0];
|
||||
assert.deepEqual(schedulingInvitationActionBlocks(managed, participant, now), {
|
||||
copy: "participant_revision_unavailable",
|
||||
send: "participant_revision_unavailable",
|
||||
revoke: "participant_revision_unavailable"
|
||||
});
|
||||
participant.revision = "a".repeat(64);
|
||||
participant.poll_invitation_id = "invitation-1";
|
||||
|
||||
assert.deepEqual(schedulingInvitationActionBlocks(managed, participant, now), {
|
||||
copy: null,
|
||||
send: null,
|
||||
revoke: null
|
||||
});
|
||||
|
||||
managed.participant_invitation_delivery_available = false;
|
||||
assert.equal(
|
||||
schedulingInvitationActionBlocks(managed, participant, now).send,
|
||||
"delivery_unavailable"
|
||||
);
|
||||
|
||||
managed.participant_invitation_delivery_available = true;
|
||||
participant.email = null;
|
||||
participant.respondent_id = `scheduling-participant:${participant.id}`;
|
||||
assert.equal(
|
||||
schedulingInvitationActionBlocks(managed, participant, now).send,
|
||||
"no_delivery_target"
|
||||
);
|
||||
|
||||
managed.public_participation_policy_enforcement_available = false;
|
||||
assert.deepEqual(schedulingInvitationActionBlocks(managed, participant, now), {
|
||||
copy: "participation_policy_unavailable",
|
||||
send: "participation_policy_unavailable",
|
||||
revoke: "participation_policy_unavailable"
|
||||
});
|
||||
|
||||
participant.poll_invitation_id = null;
|
||||
assert.equal(
|
||||
schedulingInvitationActionBlocks(managed, participant, now).revoke,
|
||||
"no_active_invitation"
|
||||
);
|
||||
});
|
||||
|
||||
test("allows bounded cancelled-request links until the notice expires without blocking revocation", () => {
|
||||
const cancelled = request("cancelled-invitation", {
|
||||
participantStatus: "invited",
|
||||
status: "cancelled"
|
||||
});
|
||||
cancelled.poll_id = "poll-1";
|
||||
cancelled.public_participation_policy_enforcement_available = true;
|
||||
cancelled.participant_invitation_delivery_available = true;
|
||||
cancelled.cancellation_notice_until = "2026-07-20T11:00:00Z";
|
||||
cancelled.participants[0].revision = "b".repeat(64);
|
||||
cancelled.participants[0].poll_invitation_id = "invitation-1";
|
||||
|
||||
assert.deepEqual(schedulingInvitationActionBlocks(cancelled, cancelled.participants[0], now), {
|
||||
copy: null,
|
||||
send: null,
|
||||
revoke: null
|
||||
});
|
||||
|
||||
cancelled.cancellation_notice_until = "2026-07-20T09:00:00Z";
|
||||
assert.deepEqual(schedulingInvitationActionBlocks(cancelled, cancelled.participants[0], now), {
|
||||
copy: "cancellation_notice_expired",
|
||||
send: "cancellation_notice_expired",
|
||||
revoke: null
|
||||
});
|
||||
});
|
||||
|
||||
test("accepts only same-origin Scheduling public invitation URLs", () => {
|
||||
assert.equal(
|
||||
schedulingPublicInvitationUrl(
|
||||
"/scheduling/public/request-1/token-1",
|
||||
"https://govoplan.example"
|
||||
),
|
||||
"https://govoplan.example/scheduling/public/request-1/token-1"
|
||||
);
|
||||
assert.equal(
|
||||
schedulingPublicInvitationUrl(
|
||||
"https://attacker.example/scheduling/public/request-1/token-1",
|
||||
"https://govoplan.example"
|
||||
),
|
||||
null
|
||||
);
|
||||
assert.equal(
|
||||
schedulingPublicInvitationUrl(
|
||||
"/scheduling/publicity/request-1/token-1",
|
||||
"https://govoplan.example"
|
||||
),
|
||||
null
|
||||
);
|
||||
});
|
||||
|
||||
test("single-choice availability keeps one positive choice while preserving explicit no answers", () => {
|
||||
const next = applySchedulingAvailabilityChoice(
|
||||
["slot-a", "slot-b", "slot-c"],
|
||||
{ "slot-a": "available", "slot-b": "maybe", "slot-c": "unavailable" },
|
||||
"slot-b",
|
||||
"available",
|
||||
true
|
||||
);
|
||||
|
||||
assert.deepEqual(next, {
|
||||
"slot-a": "unavailable",
|
||||
"slot-b": "available",
|
||||
"slot-c": "unavailable"
|
||||
});
|
||||
});
|
||||
|
||||
test("multi-choice availability changes only the selected slot", () => {
|
||||
const next = applySchedulingAvailabilityChoice(
|
||||
["slot-a", "slot-b"],
|
||||
{ "slot-a": "available" },
|
||||
"slot-b",
|
||||
"maybe",
|
||||
false
|
||||
);
|
||||
|
||||
assert.deepEqual(next, { "slot-a": "available", "slot-b": "maybe" });
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["DOM", "DOM.Iterable", "ES2020"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"preserveSymlinks": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@govoplan/core-webui": ["../../govoplan-core/webui/src/index.ts"],
|
||||
"@govoplan/core-webui/*": ["../../govoplan-core/webui/src/*"],
|
||||
"lucide-react": ["../../govoplan-core/webui/node_modules/lucide-react/dist/lucide-react.d.ts"],
|
||||
"react": ["../../govoplan-core/webui/node_modules/@types/react/index.d.ts"],
|
||||
"react/jsx-runtime": ["../../govoplan-core/webui/node_modules/@types/react/jsx-runtime.d.ts"]
|
||||
}
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user