Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
2808eef
docs: Phase 8 — share links, website editor, scheduled checks, hold t…
AndreyBegma Oct 26, 2026
51bc541
Merge pull request #366 from AndreyBegma/docs/phase-8-share-edit-check
AndreyBegma Oct 26, 2026
c55e12d
fix(cli): default demoflow login to production instead of staging
AndreyBegma Oct 26, 2026
eeab078
fix(web): serve apps/web/public from the Docker image
AndreyBegma Oct 26, 2026
854ccfe
fix(cli): drop unused import and format auth spec
AndreyBegma Oct 26, 2026
11cd466
Merge pull request #381 from AndreyBegma/fix/370-fix-web-the-docker-i…
AndreyBegma Oct 26, 2026
21b2a00
docs: Glass UI redesign and adding a project from the website
AndreyBegma Oct 26, 2026
465d7c8
feat(core): render.endHoldMs, a hold on any step and holdMs on the ti…
AndreyBegma Oct 26, 2026
097dc7e
feat(api): add the Share table, the share protocol and a file sink in…
AndreyBegma Oct 26, 2026
db01474
feat(engine): record a step's hold and the end hold of a successful run
AndreyBegma Oct 26, 2026
2376238
Merge pull request #372 from AndreyBegma/fix/371-fix-cli-demoflow-log…
AndreyBegma Oct 26, 2026
d85763a
chore(cli): bump demoflow to 0.7.1
AndreyBegma Oct 26, 2026
3acc7b1
Merge pull request #382 from AndreyBegma/docs/glass-ui-and-add-project
AndreyBegma Oct 26, 2026
be2cfa7
feat(engine): run a scenario without recording it (record: false)
AndreyBegma Oct 26, 2026
61db429
feat(api): store whether a reported run was a check (Run.kind)
AndreyBegma Oct 26, 2026
ec3a6ec
feat(api): share a run's video through /shares and /runner/shares
AndreyBegma Oct 26, 2026
3a80d44
chore(deploy): mount a shares volume for the API on staging and produ…
AndreyBegma Oct 26, 2026
fcbaeed
feat(cli): demoflow run --check runs and verifies without recording o…
AndreyBegma Oct 26, 2026
caa2270
feat(cli): the runner daemon runs a check pass the website starts
AndreyBegma Oct 26, 2026
d6486ca
feat(renderer): keep holds and the end hold at real speed, outline a …
AndreyBegma Oct 26, 2026
4e20261
docs: hold on a step and render.endHoldMs
AndreyBegma Oct 26, 2026
e213587
docs(cli): document demoflow run --check and --exclude
AndreyBegma Oct 26, 2026
ca32816
feat(cli): pass render.endHoldMs to the render plan
AndreyBegma Oct 26, 2026
4ef0fb9
feat(web): nav, crumbs, theme and overview stats for the app shell
AndreyBegma Oct 26, 2026
117ad1e
test(cli): stop the API-500 report test matching '500' inside the run id
AndreyBegma Oct 26, 2026
4628c0e
Merge pull request #385 from AndreyBegma/chore/bump-demoflow-0.7.1
AndreyBegma Oct 26, 2026
19e839c
feat(web): Glass UI app shell around every /app page
AndreyBegma Oct 26, 2026
c2e8c49
refactor(web): close the nav drawer with Glass UI's useBreakpoint
AndreyBegma Oct 26, 2026
99a1e61
Merge remote-tracking branch 'origin/develop' into card/c201-feat-web…
AndreyBegma Oct 26, 2026
559c53a
Merge pull request #384 from AndreyBegma/card/c190-feat-api-share-a-r…
AndreyBegma Oct 26, 2026
9b61ad4
fix(cli): list check-pass scenarios from the canonical project root
AndreyBegma Oct 26, 2026
013fcff
test(demo): record the Glass UI app shell walk-through
AndreyBegma Oct 26, 2026
c94c1bc
Merge branch 'develop' of https://github.com/AndreyBegma/DemoFlow int…
AndreyBegma Oct 26, 2026
5e47106
chore(deploy): daily backups of the production database
AndreyBegma Oct 26, 2026
56ae194
feat(api): serve public share pages, files and password unlocks
AndreyBegma Oct 26, 2026
9c81e42
chore(deploy): generate the share signing secret and route share file…
AndreyBegma Oct 26, 2026
698d27f
feat(cli): the runner inspects and initialises a project folder the w…
AndreyBegma Oct 26, 2026
a9b4a7a
fix(cli): check pass builds scenario paths from the given root so ids…
AndreyBegma Oct 26, 2026
f21c848
test(renderer): select sampled frames with between(n,a,b) ranges
AndreyBegma Oct 26, 2026
e434d62
Merge pull request #390 from AndreyBegma/fix/388-test-cli-keeps-the-o…
AndreyBegma Oct 26, 2026
dbe12b7
Merge pull request #392 from AndreyBegma/card/c172-chore-deploy-daily…
AndreyBegma Oct 26, 2026
3ddbc73
Merge pull request #389 from AndreyBegma/card/c201-feat-web-glass-ui-…
AndreyBegma Oct 26, 2026
66b50bb
feat(web): shared glass site header and polished landing and docs
AndreyBegma Oct 26, 2026
eddccf7
fix(web): keep table code on one line and align the hero button
AndreyBegma Oct 26, 2026
c637fa2
chore(web): restore next-env.d.ts the dev server rewrote
AndreyBegma Oct 26, 2026
6df62ea
feat(web): Glass UI for auth, device approval and account settings
AndreyBegma Oct 26, 2026
b340ba1
Merge pull request #393 from AndreyBegma/card/c187-feat-api-public-sh…
AndreyBegma Oct 26, 2026
13e9e31
fix(web): allow 127.0.0.1 as a dev origin so recorded pages hydrate
AndreyBegma Oct 26, 2026
fa7850c
docs(demo): add the Glass UI landing and docs demo scenario
AndreyBegma Oct 26, 2026
0065d88
feat(web): solid primary actions on auth and device pages
AndreyBegma Oct 26, 2026
ce5a74a
feat(web): Glass UI for projects, runs, the run page and machines
AndreyBegma Oct 26, 2026
6c104d1
Merge pull request #386 from AndreyBegma/card/c189-feat-engine-cli-de…
AndreyBegma Oct 26, 2026
bae270f
Merge remote-tracking branch 'origin/develop' into card/c200-feat-web…
AndreyBegma Oct 26, 2026
8ae21c6
Merge remote-tracking branch 'origin/develop' into card/c199-feat-web…
AndreyBegma Oct 26, 2026
7012a1d
feat(web): public share page /s/[token] with player, chapters, downlo…
AndreyBegma Oct 26, 2026
822f0da
test(demo): add the C-200 demo scenario for the Glass projects and ma…
AndreyBegma Oct 26, 2026
b61620c
test(demo): C-199 scenario for the glass auth, device and settings pages
AndreyBegma Oct 26, 2026
edf7d26
chore: card C-191 work in progress
AndreyBegma Oct 26, 2026
7b35c07
Merge remote-tracking branch 'origin/develop' into card/c197-feat-cli…
AndreyBegma Oct 26, 2026
258b577
Merge pull request #395 from AndreyBegma/card/c198-feat-web-glass-ui-…
AndreyBegma Oct 26, 2026
5423db1
feat(api): check schedules, check passes and per-scenario stale state
AndreyBegma Oct 26, 2026
5652a84
Merge pull request #398 from AndreyBegma/card/c182-feat-web-public-sh…
AndreyBegma Oct 26, 2026
a966edd
test(api): integration tests for check schedules, scheduler and stale…
AndreyBegma Oct 26, 2026
b39228a
Merge remote-tracking branch 'origin/develop' into card/c183-feat-api…
AndreyBegma Oct 26, 2026
d2b9bd8
Merge origin/develop into card/c199-feat-web-glass-ui-for-sign-in-sig…
AndreyBegma Oct 26, 2026
c2b0297
Merge pull request #383 from AndreyBegma/card/c191-feat-hold-the-resu…
AndreyBegma Oct 26, 2026
80cab11
feat(core): RunEditsSchema and checkRunEdits for a run's edits.json
AndreyBegma Oct 26, 2026
0dc2682
Merge remote-tracking branch 'origin/develop' into card/c200-feat-web…
AndreyBegma Oct 26, 2026
6e49bc3
Merge pull request #394 from AndreyBegma/card/c197-feat-cli-the-runne…
AndreyBegma Oct 26, 2026
23579f1
feat(core): schedule block in the project config and lastDueSlot (spe…
AndreyBegma Oct 26, 2026
6959fe0
feat(renderer): apply a run's edits.json at render
AndreyBegma Oct 26, 2026
c2795d1
feat(cli): the runner daemon runs check passes on a schedule (spec 361)
AndreyBegma Oct 26, 2026
591dd46
feat(api): store a project's GitHub link and how it was added
AndreyBegma Oct 26, 2026
2b2f9eb
feat(api): add a project from a folder on one of the user's machines
AndreyBegma Oct 26, 2026
1a1f08b
test(cli): scheduler, local mode, runner status schedules and run roo…
AndreyBegma Oct 26, 2026
2dc0762
docs(cli): scheduled checks and local mode in the README (spec 361)
AndreyBegma Oct 26, 2026
6e117f5
Merge origin/develop into card/c184
AndreyBegma Oct 26, 2026
6c9383d
Merge pull request #396 from AndreyBegma/card/c199-feat-web-glass-ui-…
AndreyBegma Oct 26, 2026
d8d23fe
Merge pull request #400 from AndreyBegma/card/c183-feat-api-check-sch…
AndreyBegma Oct 26, 2026
cf3aaf3
Merge pull request #397 from AndreyBegma/card/c200-feat-web-glass-ui-…
AndreyBegma Oct 26, 2026
5e9e2d4
Merge remote-tracking branch 'origin/develop' into card/c195-feat-web…
AndreyBegma Oct 26, 2026
d06c3b3
Merge pull request #401 from AndreyBegma/card/c188-feat-core-renderer…
AndreyBegma Oct 26, 2026
b5330dd
feat(core): chapters on renders and the share.allowMcp project config
AndreyBegma Oct 26, 2026
d09c1fa
feat(web): add project dialog — machine, path, inspection, create con…
AndreyBegma Oct 26, 2026
a65b6fe
feat(web): add share helpers and API client
AndreyBegma Oct 26, 2026
8ded0bb
feat(web): Share dialog on the run page and the /app/shares list
AndreyBegma Oct 26, 2026
a1fd702
feat(renderer): write a render's scene cards to result.json as chapters
AndreyBegma Oct 26, 2026
c323825
Merge remote-tracking branch 'origin/develop' into card/c195-feat-web…
AndreyBegma Oct 26, 2026
d186bac
test(demo): add the Shares page demo scenario for card C-185
AndreyBegma Oct 26, 2026
8cab4f0
Merge remote-tracking branch 'origin/develop' into card/c185-feat-web…
AndreyBegma Oct 26, 2026
93ec508
test(demo): add the C-195 demo scenario for the Add project dialog
AndreyBegma Oct 26, 2026
ea867c8
feat(cli): the runner prepares shares and serves their posters
AndreyBegma Oct 26, 2026
1e70ff2
feat(web): add the schedule, health and stale API calls and the sched…
AndreyBegma Oct 26, 2026
a54379d
feat(web): show the check schedule and the scenario health on the pro…
AndreyBegma Oct 26, 2026
66874b7
feat(web): mark stale projects, label check runs and list stale demos…
AndreyBegma Oct 26, 2026
6ec005b
Merge pull request #402 from AndreyBegma/card/c184-feat-core-cli-sche…
AndreyBegma Oct 26, 2026
90a81c0
chore(demo): add the C-179 check schedules demo scenario
AndreyBegma Oct 26, 2026
3d1b6b5
feat(cli): demoflow share creates a share link for a reported run
AndreyBegma Oct 26, 2026
c8ffd1c
feat(cli): the MCP share_demo tool, gated by share.allowMcp
AndreyBegma Oct 26, 2026
82c21a9
docs(cli): demoflow share, share_demo and share.allowMcp in the README
AndreyBegma Oct 26, 2026
62a5856
Merge remote-tracking branch 'origin/develop' into card/c196-feat-api…
AndreyBegma Oct 26, 2026
61148a4
style: format C-179 demo scenario
AndreyBegma Oct 26, 2026
c8d2e08
Merge pull request #403 from AndreyBegma/card/c196-feat-api-add-a-pro…
AndreyBegma Oct 27, 2026
29c5c45
Merge pull request #405 from AndreyBegma/card/c185-feat-web-share-dia…
AndreyBegma Oct 27, 2026
fe5a0c5
Merge remote-tracking branch 'origin/develop' into card/c195-feat-web…
AndreyBegma Oct 27, 2026
dd18951
merge origin/develop into card/c179
AndreyBegma Oct 27, 2026
07a4bb2
Merge origin/develop into card/c186-feat-cli-the-runner-uploads-a-ren…
AndreyBegma Oct 27, 2026
108b526
Merge pull request #407 from AndreyBegma/card/c179-feat-web-check-sch…
AndreyBegma Oct 27, 2026
4f78c0a
Merge origin/develop into card/c195
AndreyBegma Oct 27, 2026
c731812
Merge remote-tracking branch 'origin/develop' into card/c186-feat-cli…
AndreyBegma Oct 27, 2026
42fc75f
fix(cli): list share_demo in the package smoke's expected MCP tools
AndreyBegma Oct 27, 2026
56a2304
test(cli): resolve the share spec's temp dir with the native realpath
AndreyBegma Oct 27, 2026
be1df33
Merge pull request #404 from AndreyBegma/card/c195-feat-web-add-proje…
AndreyBegma Oct 27, 2026
aee6deb
docs(web): document adding a project from the website and allowed roots
AndreyBegma Oct 27, 2026
9acdaab
Merge pull request #409 from AndreyBegma/card/c194-docs-web-adding-a-…
AndreyBegma Oct 27, 2026
cffa0f5
Merge pull request #408 from AndreyBegma/card/c186-feat-cli-the-runne…
AndreyBegma Oct 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ Thumbs.db

# Prisma
prisma/generated/

# Shared videos stored by the API in development (SHARE_DIR)
apps/api/data/
14 changes: 14 additions & 0 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ MAIL_FROM=DemoFlow <no-reply@localhost>
# http://localhost:3670/api/auth/github/callback.
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

# Share links (spec #347): the directory that holds every shared video and
# poster, relative to the API's working directory unless absolute. Nothing
# else is written there; it is not backed up.
SHARE_DIR=./data/shares
# The largest render a share may hold (200 MB), and every account's total
# across its shares, posters included (2 GB).
SHARE_MAX_FILE_BYTES=209715200
SHARE_USER_QUOTA_BYTES=2147483648

# Signs the cookie a share password unlock sets (spec #348). At least 32
# characters. APP_ENV=production refuses to start without it; below production
# an empty value means a random one per boot, so unlocks end at restart.
SHARE_SIGNING_SECRET=
4 changes: 4 additions & 0 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ COPY --from=builder --chown=node:node /app/node_modules node_modules/
COPY --from=builder --chown=node:node /app/packages/shared packages/shared/
COPY --from=builder --chown=node:node /app/apps/api apps/api/

# The shares volume mounts here; a new named volume copies this directory's
# owner, so the API can write to it as `node` (spec #347).
RUN mkdir -p /data/shares && chown node:node /data/shares

USER node
WORKDIR /app/apps/api

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "RunKind" AS ENUM ('check');

-- AlterTable
ALTER TABLE "Run" ADD COLUMN "kind" "RunKind";
46 changes: 46 additions & 0 deletions apps/api/prisma/migrations/20261027090000_shares/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- CreateEnum
CREATE TYPE "ShareStatus" AS ENUM ('uploading', 'ready', 'failed', 'lost');

-- CreateTable
CREATE TABLE "Share" (
"id" TEXT NOT NULL,
"token" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"runId" TEXT NOT NULL,
"format" TEXT NOT NULL,
"status" "ShareStatus" NOT NULL DEFAULT 'uploading',
"title" TEXT NOT NULL,
"description" TEXT,
"chapters" JSONB NOT NULL DEFAULT '[]',
"sizeBytes" INTEGER NOT NULL DEFAULT 0,
"posterBytes" INTEGER NOT NULL DEFAULT 0,
"width" INTEGER,
"height" INTEGER,
"durationMs" INTEGER,
"passwordHash" TEXT,
"expiresAt" TIMESTAMP(3) NOT NULL,
"views" INTEGER NOT NULL DEFAULT 0,
"failure" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "Share_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Share_token_key" ON "Share"("token");

-- CreateIndex
CREATE INDEX "Share_userId_createdAt_idx" ON "Share"("userId", "createdAt" DESC);

-- CreateIndex
CREATE INDEX "Share_expiresAt_idx" ON "Share"("expiresAt");

-- CreateIndex
CREATE UNIQUE INDEX "Share_runId_format_key" ON "Share"("runId", "format");

-- AddForeignKey
ALTER TABLE "Share" ADD CONSTRAINT "Share_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Share" ADD CONSTRAINT "Share_runId_fkey" FOREIGN KEY ("runId") REFERENCES "Run"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- CreateEnum
CREATE TYPE "ProjectSource" AS ENUM ('reported', 'website');

-- AlterTable
ALTER TABLE "Project" ADD COLUMN "githubUrl" TEXT,
ADD COLUMN "source" "ProjectSource" NOT NULL DEFAULT 'reported';
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
-- CreateEnum
CREATE TYPE "ScheduleSource" AS ENUM ('site', 'config');

-- CreateEnum
CREATE TYPE "ScheduleCadence" AS ENUM ('daily', 'weekdays', 'weekly');

-- CreateTable
CREATE TABLE "CheckSchedule" (
"id" TEXT NOT NULL,
"projectId" TEXT NOT NULL,
"source" "ScheduleSource" NOT NULL,
"cadence" "ScheduleCadence" NOT NULL,
"weekday" TEXT,
"at" TEXT NOT NULL,
"timeZone" TEXT NOT NULL,
"exclude" TEXT[],
"pausedReason" TEXT,
"lastSlotAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "CheckSchedule_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "ScenarioHealth" (
"projectId" TEXT NOT NULL,
"scenarioPath" TEXT NOT NULL,
"state" "RunStatus" NOT NULL,
"since" TIMESTAMP(3) NOT NULL,
"lastRunId" TEXT NOT NULL,

CONSTRAINT "ScenarioHealth_pkey" PRIMARY KEY ("projectId","scenarioPath")
);

-- CreateIndex
CREATE UNIQUE INDEX "CheckSchedule_projectId_source_key" ON "CheckSchedule"("projectId", "source");

-- CreateIndex
CREATE INDEX "ScenarioHealth_projectId_state_idx" ON "ScenarioHealth"("projectId", "state");

-- AddForeignKey
ALTER TABLE "CheckSchedule" ADD CONSTRAINT "CheckSchedule_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ScenarioHealth" ADD CONSTRAINT "ScenarioHealth_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- Backfill: each scenario's state is its latest run's status, `since` the
-- start of the oldest run after the latest run with the other status.
INSERT INTO "ScenarioHealth" ("projectId", "scenarioPath", "state", "since", "lastRunId")
SELECT
latest."projectId",
latest."scenarioPath",
latest."status",
COALESCE((
SELECT MIN(r."startedAt")
FROM "Run" r
WHERE r."projectId" = latest."projectId"
AND r."scenarioPath" = latest."scenarioPath"
AND r."startedAt" > COALESCE(
(
SELECT MAX(o."startedAt")
FROM "Run" o
WHERE o."projectId" = latest."projectId"
AND o."scenarioPath" = latest."scenarioPath"
AND o."status" <> latest."status"
),
'-infinity'::timestamp
)
), latest."startedAt"),
latest."id"
FROM (
SELECT DISTINCT ON ("projectId", "scenarioPath")
"projectId", "scenarioPath", "status", "startedAt", "id"
FROM "Run"
ORDER BY "projectId", "scenarioPath", "startedAt" DESC, "id" DESC
) latest;
113 changes: 113 additions & 0 deletions apps/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ model User {
githubIdentity GithubIdentity?
runners Runner[]
projects Project[]
shares Share[]
}

// The GitHub account a user signs in with (spec #126). At most one per user,
Expand Down Expand Up @@ -110,19 +111,34 @@ model Project {
runner Runner? @relation(fields: [runnerId], references: [id], onDelete: SetNull)
// Absolute path of the project root on that machine, as the CLI sent it.
rootPath String?
// https://github.com/<owner>/<repo>; display only (ADR-0022 §5).
githubUrl String?
source ProjectSource @default(reported)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
runs Run[]
schedules CheckSchedule[]
health ScenarioHealth[]

@@unique([runnerId, rootPath])
@@index([userId])
}

// How a project was added (spec #378): by a CLI report, or from the website.
enum ProjectSource {
reported
website
}

enum RunStatus {
passed
failed
}

enum RunKind {
check
}

// The metadata of one `demoflow run`. Never a video, a frame or a step value:
// values can hold secrets, and videos stay on the machine (ADR-0008).
model Run {
Expand Down Expand Up @@ -150,11 +166,108 @@ model Run {
renders Json?
failureStage String?
failureMessage String?
// Spec 360: `check` for a run made with `demoflow run --check`; null otherwise.
kind RunKind?
createdAt DateTime @default(now())
shares Share[]

@@index([projectId, startedAt(sort: Desc), id(sort: Desc)])
}

enum ShareStatus {
uploading
ready
failed
lost
}

// One render of a run behind a public link (spec #347, ADR-0019). The files
// live under `SHARE_DIR/<id>/`, never in the database. One per run and format.
model Share {
id String @id @default(cuid())
// 32 random bytes, base64url (`generateToken`). Stored as is: the owner
// copies the link again (ADR-0019, Consequences).
token String @unique
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
runId String
run Run @relation(fields: [runId], references: [id], onDelete: Cascade)
format String
status ShareStatus @default(uploading)
// The scenario's name at share time, and what the daemon sent (#349).
title String
description String?
// `[{ title, atMs }]`, at most 100.
chapters Json @default("[]")
sizeBytes Int @default(0)
posterBytes Int @default(0)
width Int?
height Int?
durationMs Int?
// argon2id (`PasswordHasher`), null without a password.
passwordHash String?
expiresAt DateTime
views Int @default(0)
failure String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@unique([runId, format])
@@index([userId, createdAt(sort: Desc)])
@@index([expiresAt])
}

enum ScheduleSource {
site
config
}

enum ScheduleCadence {
daily
weekdays
weekly
}

// When a project's scenarios are checked (spec #362, ADR-0021). A `site` row
// is set on the website and run by the API; a `config` row is what the daemon
// reported from `demoflow.config.json`, stored only to be shown.
model CheckSchedule {
id String @id @default(uuid())
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
source ScheduleSource
cadence ScheduleCadence
// `mon`…`sun`; set only for `weekly`.
weekday String?
// `HH:MM`, 24-hour, in `timeZone`.
at String
timeZone String
exclude String[]
// `config-schedule`, `no-machine` or `cli-too-old`; null while it runs.
pausedReason String?
// The latest slot a pass was started for (site rows only).
lastSlotAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@unique([projectId, source])
}

// The state of a project's scenario after its latest reported run (spec #362,
// ADR-0021 §6). `failed` is "stale". `since` is the start of the run that made
// the last transition; `lastRunId` is a plain column: deleting a run keeps it.
model ScenarioHealth {
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
scenarioPath String
state RunStatus
since DateTime
lastRunId String

@@id([projectId, scenarioPath])
@@index([projectId, state])
}

// A pending `demoflow login` (RFC 8628). Only the SHA-256 hash of the polling
// secret is stored. `approvedById` is a plain column: the row lives at most
// ten minutes and is deleted once its token is issued.
Expand Down
4 changes: 4 additions & 0 deletions apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { AuthModule } from './auth/auth.module';
import { ChecksModule } from './checks/checks.module';
import { ClockModule } from './common/clock.module';
import { DatabaseModule } from './database/database.module';
import { HealthController } from './health.controller';
import { LaunchesModule } from './launches/launches.module';
import { MailModule } from './mail/mail.module';
import { ProjectsModule } from './projects/projects.module';
import { RunnerModule } from './runner/runner.module';
import { SharesModule } from './shares/shares.module';
import { VideosModule } from './videos/videos.module';

@Module({
Expand All @@ -24,6 +26,8 @@ import { VideosModule } from './videos/videos.module';
ProjectsModule,
VideosModule,
LaunchesModule,
SharesModule,
ChecksModule,
],
controllers: [HealthController],
})
Expand Down
Loading
Loading