Skip to main content

Practice ยท 3 of 4

Milestone 3 โ€” The Authorized Service Layer

CHALLENGE
Difficulty: intermediate+25 XP

The engine's gates, in one service. Given provided user/project registries (test seeds them through Solution.Register/Solution.AddProject), implement: ``csharp public static class Solution { public static void Register(int id, string name, Role role); public static void AddProject(int id, string name, int ownerId); public static int CreateTask(int callerId, int projectId, string title, Priority priority); public static void Assign(int callerId, int taskId, int assigneeId); public static TaskItem? FindTask(int taskId); } ` Both types nest inside Solution. Gates, in order: 1. **valid input** โ€” title via DomainGuard.ValidTitle, priority defined; bad โ†’ System.ArgumentException, 2. **allowed** โ€” CreateTask requires the caller to be the project's owner or an Admin; Assign requires the caller to be the task's project owner or an Admin. Not allowed โ†’ System.InvalidOperationException, 3. **possible** โ€” unknown project/task/assignee/user โ†’ System.Collections.Generic.KeyNotFoundException, 4. success โ€” CreateTask stores a Todo task (via your own repo logic or a plain list โ€” your choice, IDs 1,2,3โ€ฆ) and returns its id; Assign sets the assignee; FindTask returns the item or null`.

Back to lesson: Practice: Capstone Milestones: Domain to Engine