feat(approval): /my-drafts maker self-tracking view + /api/v1/drafts/me
Approval Workflow v2 Phase 4 — UX: Backend: - DraftController.myDrafts: GET /api/v1/drafts/me?page&size — все статусы (PENDING/APPROVED/REJECTED/WITHDRAWN) текущего authenticated user, sorted submitted_at DESC. Resolve maker_id из JWT subject (fallback "anonymous" если auth off). - Reuses existing DraftService.listByMaker (Phase 1 method, был не exposed). Frontend: - routes/my-drafts.tsx: новый маршрут с табличным view. Колонки: businessKey / operation / status / submittedAt / reviewedAt / reviewerId / comment / actions. Status badge tinted (warning/success/ error/neutral). PENDING строки имеют Withdraw кнопку (calls existing useWithdrawDraft с confirm). - api/queries.ts: useMyDrafts (refetch 30s — maker увидит когда reviewer decide). - api/mutations.ts: useWithdrawDraft теперь invalidate'ит ['drafts'] — /me + by-dict обе видят изменение. - routes/__root.tsx: nav link "Мои черновики" / "My drafts" (после Reviews). - i18n RU/EN: 18 keys (nav.myDrafts, myDrafts.* col/action/status). Pluralization для total через i18next plurals. Why это нужно: - До этого maker submit'нул draft и пропадал — единственный feedback был badge "На review" в records list (только для текущего dict). Здесь — все его submissions с history + withdraw для PENDING. - Reviewer pool (D3=A) маленький, /reviews queue только для них. Maker без role'а не видит queue, но должен tracking своих submissions. Tests: ordinis-rest-api unit 119/119, ordinis-app e2e 28/28, vitest 89/89.
This commit is contained in:
@@ -13,6 +13,7 @@ import { Route as WebhooksRouteImport } from './routes/webhooks'
|
||||
import { Route as SearchRouteImport } from './routes/search'
|
||||
import { Route as ReviewsRouteImport } from './routes/reviews'
|
||||
import { Route as OutboxRouteImport } from './routes/outbox'
|
||||
import { Route as MyDraftsRouteImport } from './routes/my-drafts'
|
||||
import { Route as DictionariesRouteImport } from './routes/dictionaries'
|
||||
import { Route as AuditRouteImport } from './routes/audit'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
@@ -41,6 +42,11 @@ const OutboxRoute = OutboxRouteImport.update({
|
||||
path: '/outbox',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const MyDraftsRoute = MyDraftsRouteImport.update({
|
||||
id: '/my-drafts',
|
||||
path: '/my-drafts',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const DictionariesRoute = DictionariesRouteImport.update({
|
||||
id: '/dictionaries',
|
||||
path: '/dictionaries',
|
||||
@@ -81,6 +87,7 @@ export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/audit': typeof AuditRoute
|
||||
'/dictionaries': typeof DictionariesRouteWithChildren
|
||||
'/my-drafts': typeof MyDraftsRoute
|
||||
'/outbox': typeof OutboxRoute
|
||||
'/reviews': typeof ReviewsRoute
|
||||
'/search': typeof SearchRoute
|
||||
@@ -93,6 +100,7 @@ export interface FileRoutesByFullPath {
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/audit': typeof AuditRoute
|
||||
'/my-drafts': typeof MyDraftsRoute
|
||||
'/outbox': typeof OutboxRoute
|
||||
'/reviews': typeof ReviewsRoute
|
||||
'/search': typeof SearchRoute
|
||||
@@ -106,6 +114,7 @@ export interface FileRoutesById {
|
||||
'/': typeof IndexRoute
|
||||
'/audit': typeof AuditRoute
|
||||
'/dictionaries': typeof DictionariesRouteWithChildren
|
||||
'/my-drafts': typeof MyDraftsRoute
|
||||
'/outbox': typeof OutboxRoute
|
||||
'/reviews': typeof ReviewsRoute
|
||||
'/search': typeof SearchRoute
|
||||
@@ -121,6 +130,7 @@ export interface FileRouteTypes {
|
||||
| '/'
|
||||
| '/audit'
|
||||
| '/dictionaries'
|
||||
| '/my-drafts'
|
||||
| '/outbox'
|
||||
| '/reviews'
|
||||
| '/search'
|
||||
@@ -133,6 +143,7 @@ export interface FileRouteTypes {
|
||||
to:
|
||||
| '/'
|
||||
| '/audit'
|
||||
| '/my-drafts'
|
||||
| '/outbox'
|
||||
| '/reviews'
|
||||
| '/search'
|
||||
@@ -145,6 +156,7 @@ export interface FileRouteTypes {
|
||||
| '/'
|
||||
| '/audit'
|
||||
| '/dictionaries'
|
||||
| '/my-drafts'
|
||||
| '/outbox'
|
||||
| '/reviews'
|
||||
| '/search'
|
||||
@@ -159,6 +171,7 @@ export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
AuditRoute: typeof AuditRoute
|
||||
DictionariesRoute: typeof DictionariesRouteWithChildren
|
||||
MyDraftsRoute: typeof MyDraftsRoute
|
||||
OutboxRoute: typeof OutboxRoute
|
||||
ReviewsRoute: typeof ReviewsRoute
|
||||
SearchRoute: typeof SearchRoute
|
||||
@@ -195,6 +208,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof OutboxRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/my-drafts': {
|
||||
id: '/my-drafts'
|
||||
path: '/my-drafts'
|
||||
fullPath: '/my-drafts'
|
||||
preLoaderRoute: typeof MyDraftsRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/dictionaries': {
|
||||
id: '/dictionaries'
|
||||
path: '/dictionaries'
|
||||
@@ -279,6 +299,7 @@ const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
AuditRoute: AuditRoute,
|
||||
DictionariesRoute: DictionariesRouteWithChildren,
|
||||
MyDraftsRoute: MyDraftsRoute,
|
||||
OutboxRoute: OutboxRoute,
|
||||
ReviewsRoute: ReviewsRoute,
|
||||
SearchRoute: SearchRoute,
|
||||
|
||||
Reference in New Issue
Block a user