Finish Schoolhouse programming submission flow

This commit is contained in:
Fizzlepoof
2026-05-16 19:13:10 +00:00
parent 1aa4b16eef
commit 754e98c6a5
15 changed files with 753 additions and 74 deletions

View File

@@ -1,21 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -lt 2 ]; then
echo "usage: $0 <file> <class_name> [assignment_name]" >&2
echo "usage: $0 <file> [more_files ...] <class_name> [assignment_name]" >&2
exit 1
fi
FILE="$1"
CLASS_NAME="$2"
ASSIGNMENT_NAME="${3:-Sample Assignment}"
ARGS=("$@")
COUNT=$#
if [ "$COUNT" -eq 2 ]; then
FILES=("${ARGS[0]}")
CLASS_NAME="${ARGS[1]}"
ASSIGNMENT_NAME="Sample Assignment"
elif [ "$COUNT" -eq 3 ]; then
FILES=("${ARGS[0]}")
CLASS_NAME="${ARGS[1]}"
ASSIGNMENT_NAME="${ARGS[2]}"
else
FILES=("${ARGS[@]:0:$COUNT-2}")
CLASS_NAME="${ARGS[$COUNT-2]}"
ASSIGNMENT_NAME="${ARGS[$COUNT-1]}"
fi
TARGET="${N8N_BASE_URL:-https://n8n.example.com}${SCHOOLHOUSE_N8N_ASSIGNMENT_WEBHOOK:-/webhook/school/intake/upload}"
cat <<MSG
Dry-run assignment handoff preview
Target: $TARGET
Command:
curl -X POST "$TARGET" \\
-F "document=@$FILE" \\
-F "class_name=$CLASS_NAME" \\
-F "assignment_name=$ASSIGNMENT_NAME" \\
-F "submission_kind=assignment_turn_in" \\
-F "source=doris-schoolhouse"
MSG
echo "Dry-run assignment handoff preview"
echo "Target: $TARGET"
echo "Command:"
echo "curl -X POST \"$TARGET\" \\"
for file in "${FILES[@]}"; do
echo " -F \"document=@$file\" \\"
done
echo " -F \"class_name=$CLASS_NAME\" \\"
echo " -F \"assignment_name=$ASSIGNMENT_NAME\" \\"
echo " -F \"submission_kind=assignment_turn_in\" \\"
echo " -F \"source=doris-schoolhouse\""