feat: MCP tools for events (list/get/create/update/delete/done/ack); EventRules shared by /api and manual

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
This commit is contained in:
nikita.hohlov
2026-09-05 06:10:41 -03:00
parent 450c165fce
commit ed45a1d516
18 changed files with 711 additions and 56 deletions

View File

@@ -27,6 +27,16 @@ class User extends Model
return $this->events()->with('source')->whereKey($id)->firstOrFail();
}
/**
* Живые события в этих состояниях, по сроку.
*
* @param list<string> $states
*/
public function liveEvents(array $states): HasMany
{
return $this->events()->with('source')->whereIn('state', $states)->orderBy('due_date')->orderBy('due_instant');
}
/** Закрытые события для архива: done и expired, свежие первыми, не больше 100. */
public function archive(): HasMany
{