9c0bf76a05
Playwright Tests / test (push) Has been cancelled
Added detailed instruction files for configuration, controller structure, C# standards, OCORE library usage, ImageSharp licensing, and testing. These documents define rules for settings, DI, file layout, package management, and test practices to ensure consistency and compliance during the .NET 10 migration.
2.7 KiB
2.7 KiB
applyTo
| applyTo |
|---|
| Fuchs/Controllers/**,Fuchs/code/** |
IntranetController Instructions
Overview
The Fuchs intranet is the entire website, served from /. There is a single MVC controller, IntranetController, split into partial files by domain. There are no areas.
Routing
| Route | Action | Purpose |
|---|---|---|
/{fn?}/{id?}/{code?} |
Index |
Returns the SPA shell view intranet. [AllowAnonymous]. |
/do/{fn?}/{id?}/{code?} |
Do |
Central API dispatcher (GET + POST). [AllowAnonymous], gated internally. |
Partial File Layout
Each partial lives in Fuchs/Controllers/ and maps to a VB original under Fuchs/code/:
| Partial | Domain | Dispatch entry |
|---|---|---|
IntranetController.cs |
Core: routing, auth, login/logout, account, MFR | Do(...) switch |
IntranetController.Invoices.cs / .Invoices2.cs |
Invoices | Do_Process_Invoices |
IntranetController.Reminder.cs |
Reminders | Do_Process_Reminder |
IntranetController.Requests.cs |
Requests | Do_Process_Requests |
IntranetController.Reports.cs |
Reports | Do_Process_Reports |
IntranetController.Banking.cs |
Banking (MT940) | Do_Process_Bankings |
Dispatcher Pattern
Do(...)normalizesfn/id/code(lowercasefn, null-coalesce others) then routes via aswitchexpression toDo_Process_*helpers or inlineHandle*methods.- Each domain handler is itself a
switchonid(the sub-function) returning anIActionResult. - Wrap the whole dispatch in a single
try/catch; log via_intranet.debug_log(...)and returnServerError()on unhandled exceptions. Do not add per-case try/catch unless a case needs special recovery.
Authentication Gate
- The unauthenticated allow-list logic in
Do(...)must keep its braces: unauthenticated users are rejected withUnauthorized401()only when the function is not in_allowedNonAuth, notlogin/logout, and not in_allowedGet(checked as bothfnandfn|id). - Add new anonymous endpoints by extending
_allowedNonAuth(full-anonymous) or_allowedGet(read-only GET links), never by removing the gate.
Conventions
- Use the
StdParamlist(...)helpers to buildSqlParameterlists; they pre-populate@authuserfromUserAccountID. - Use
SqlOpt(fn, id, code)to passFIS_SQLOptionsto OCORE SQL helpers. - Use
DbSec(_intranet.GetDbSecurity(UserAccountID)) for theSecurity:argument on SQL calls. - Return JSON via the OCORE
JSONAsync(...)helper, notJson(...). - Use the status helpers
Unauthorized401(),BadRequest400(),ServerError(...)rather than rawStatusCode(...). - All controller actions that perform I/O must be
async Task<IActionResult>.