diff --git a/docs/core/guards-models.md b/docs/core/guards-models.md index ff920b665..a22875804 100644 --- a/docs/core/guards-models.md +++ b/docs/core/guards-models.md @@ -81,11 +81,11 @@ projectRepository.getOne(projectId).pipe( `projects/core/src/lib/models/` — **набор интерфейсов и enum'ов общего назначения**. -| Файл | Экспорт | Что | +| Файл | Экспорт | Что | | ------------------------ | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | --- | -| `error/error-code.ts` | `enum ErrorCode { NOT_FOUND = "404", SERVER_ERROR = "500" }` | Используется `ErrorService` для построения URL `/error/`. | -| `error/error-message.ts` | `enum ErrorMessage` | Все текстовые сообщения об ошибках на русском, сгруппированы по категориям: AUTH, VALIDATION, USER, рейтинг проектов. Полная таблица — ниже. | -| `http.model.ts` | `interface ApiError { detail: string }` | Типизация ошибок API: бэк отдаёт `{ detail: "..." }` для 4xx. | | +| `error/error-code.ts` | `enum ErrorCode { NOT_FOUND = "404", SERVER_ERROR = "500" }` | Используется `ErrorService` для построения URL `/error/`. | +| `error/error-message.ts` | `enum ErrorMessage` | Все текстовые сообщения об ошибках на русском, сгруппированы по категориям: AUTH, VALIDATION, USER, рейтинг проектов. Полная таблица — ниже. | +| `http.model.ts` | `interface ApiError { detail: string }` | Типизация ошибок API: бэк отдаёт `{ detail: "..." }` для 4xx. | | ### ErrorMessage — все значения diff --git a/docs/modules/auth.md b/docs/modules/auth.md index 60337c728..158464a07 100644 --- a/docs/modules/auth.md +++ b/docs/modules/auth.md @@ -126,7 +126,9 @@ type RegisterError = // results/password.result.ts type PasswordError = - { kind: "server_error" } | { kind: "invalid_token" } | { kind: "unknown"; cause?: unknown }; + | { kind: "server_error" } + | { kind: "invalid_token" } + | { kind: "unknown"; cause?: unknown }; ``` --- diff --git a/docs/social-platform/architecture.md b/docs/social-platform/architecture.md index e069943af..15d5ff503 100644 --- a/docs/social-platform/architecture.md +++ b/docs/social-platform/architecture.md @@ -315,7 +315,8 @@ type AsyncState = ```ts type Result = - { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: E }; + | { readonly ok: true; readonly value: T } + | { readonly ok: false; readonly error: E }; ``` Хелперы: `ok(value)`, `fail(error)`. diff --git a/docs/social-platform/shared.md b/docs/social-platform/shared.md index e27ee377c..1ccb78394 100644 --- a/docs/social-platform/shared.md +++ b/docs/social-platform/shared.md @@ -60,7 +60,8 @@ readonly loading = computed(() => isLoading(this.course$())); ```ts type Result = - { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: E }; + | { readonly ok: true; readonly value: T } + | { readonly ok: false; readonly error: E }; ``` `ok(value)` / `fail(error)` — фабрики. Use-case возвращает `Observable>` и **никогда не выбрасывает** — все ошибки представимы в `Result.fail`. diff --git a/projects/social_platform/src/app/api/profile/facades/edit/profile-form.service.ts b/projects/social_platform/src/app/api/profile/facades/edit/profile-form.service.ts index efff0c4be..fa357e61d 100644 --- a/projects/social_platform/src/app/api/profile/facades/edit/profile-form.service.ts +++ b/projects/social_platform/src/app/api/profile/facades/edit/profile-form.service.ts @@ -257,7 +257,8 @@ export class ProfileFormService { if ([2, 3, 4].includes(profile.personal.userType)) { this.typeSpecific?.addControl("preferredIndustries", this.fb.array([])); const role = profile.roles[this.userTypeMap[profile.personal.userType]] as - { preferredIndustries?: string[] } | undefined; + | { preferredIndustries?: string[] } + | undefined; role?.preferredIndustries?.forEach((industry: string) => this.addPreferredIndustry(industry), ); diff --git a/projects/social_platform/src/app/api/program/facades/detail/program-analytics-drilldown.service.ts b/projects/social_platform/src/app/api/program/facades/detail/program-analytics-drilldown.service.ts index 45e099da1..3879019d6 100644 --- a/projects/social_platform/src/app/api/program/facades/detail/program-analytics-drilldown.service.ts +++ b/projects/social_platform/src/app/api/program/facades/detail/program-analytics-drilldown.service.ts @@ -40,7 +40,12 @@ export type AnalyticsAttentionView = | "projects-awaiting-evaluation" | "projects-not-submitted"; export type AnalyticsDrilldownView = - "case" | "assignments" | "scores" | "delayed" | "backlog" | AnalyticsAttentionView; + | "case" + | "assignments" + | "scores" + | "delayed" + | "backlog" + | AnalyticsAttentionView; /** Живёт вместе с одной analytics-модалкой, не сохраняет manager-данные между открытиями. */ @Injectable() diff --git a/projects/social_platform/src/app/domain/invite/results/invite.result.ts b/projects/social_platform/src/app/domain/invite/results/invite.result.ts index a4b2077fa..7a0c774a0 100644 --- a/projects/social_platform/src/app/domain/invite/results/invite.result.ts +++ b/projects/social_platform/src/app/domain/invite/results/invite.result.ts @@ -5,7 +5,8 @@ import { Invite } from "@domain/invite/invite.model"; /** Ошибки операций с инвайтами */ export type InviteError = - { kind: "unknown"; cause?: unknown } | { kind: "get_invites_error"; cause?: unknown }; + | { kind: "unknown"; cause?: unknown } + | { kind: "get_invites_error"; cause?: unknown }; /** Результат операций, которые не возвращают данные (accept, reject, revoke). */ export type InviteResult = Result; diff --git a/projects/social_platform/src/app/domain/other/notification.model.ts b/projects/social_platform/src/app/domain/other/notification.model.ts index f7daaf66f..3514959f7 100644 --- a/projects/social_platform/src/app/domain/other/notification.model.ts +++ b/projects/social_platform/src/app/domain/other/notification.model.ts @@ -5,7 +5,9 @@ export class Notification { id!: string; kind!: "expert_joined" | "registration_connection" | "program_attention"; category?: - "participants-without-visit" | "participants-without-team" | "projects-awaiting-evaluation"; + | "participants-without-visit" + | "participants-without-team" + | "projects-awaiting-evaluation"; text!: string; readAt!: string | null; programId!: number; diff --git a/projects/social_platform/src/app/domain/program/program-analytics.model.ts b/projects/social_platform/src/app/domain/program/program-analytics.model.ts index 17502ffd4..83ddbf0e9 100644 --- a/projects/social_platform/src/app/domain/program/program-analytics.model.ts +++ b/projects/social_platform/src/app/domain/program/program-analytics.model.ts @@ -105,7 +105,10 @@ export interface ProgramAnalyticsError { * pending/in_progress различаются наличием оценённых критериев, не длительностью ожидания. */ export type ProgramAnalyticsAssignmentStatus = - "not_ready" | "pending" | "in_progress" | "completed"; + | "not_ready" + | "pending" + | "in_progress" + | "completed"; /** pending включает все незавершённые назначения, в том числе not_ready. */ export type ProgramAnalyticsAssignmentScope = "all" | "completed" | "pending"; diff --git a/projects/social_platform/src/app/domain/program/program-attention-actions.model.ts b/projects/social_platform/src/app/domain/program/program-attention-actions.model.ts index f75026257..98128efe4 100644 --- a/projects/social_platform/src/app/domain/program/program-attention-actions.model.ts +++ b/projects/social_platform/src/app/domain/program/program-attention-actions.model.ts @@ -1,6 +1,8 @@ /** @format */ export type ProgramAttentionCategory = - "participants-without-visit" | "participants-without-team" | "projects-awaiting-evaluation"; + | "participants-without-visit" + | "participants-without-team" + | "projects-awaiting-evaluation"; export interface ProgramAttentionSelection { mode: "selected" | "all"; diff --git a/projects/social_platform/src/app/domain/program/program-management.model.ts b/projects/social_platform/src/app/domain/program/program-management.model.ts index 4da8fcc87..bff4d240d 100644 --- a/projects/social_platform/src/app/domain/program/program-management.model.ts +++ b/projects/social_platform/src/app/domain/program/program-management.model.ts @@ -14,7 +14,13 @@ export type ManagementSection = | "settings" | "evaluation"; export type SettingsSection = - "basic" | "dates" | "materials" | "project-form" | "criteria" | "organizers" | "registration"; + | "basic" + | "dates" + | "materials" + | "project-form" + | "criteria" + | "organizers" + | "registration"; export interface ManagementMaterial { id: number; title: string; @@ -61,7 +67,11 @@ export interface ManagementParticipant { registrationAnswers?: { label: string; value: string | string[] | number | null }[]; } export type ManagementEvaluationStatus = - "not_submitted" | "awaiting_evaluation" | "partially_evaluated" | "evaluated" | "not_applicable"; + | "not_submitted" + | "awaiting_evaluation" + | "partially_evaluated" + | "evaluated" + | "not_applicable"; export interface ManagementProject { id: number; projectId: number; diff --git a/projects/social_platform/src/app/domain/program/program-role-widget.model.ts b/projects/social_platform/src/app/domain/program/program-role-widget.model.ts index dbf3dff92..c59feb313 100644 --- a/projects/social_platform/src/app/domain/program/program-role-widget.model.ts +++ b/projects/social_platform/src/app/domain/program/program-role-widget.model.ts @@ -6,7 +6,12 @@ export type ProgramWidgetRole = "organizer" | "expert" | "participant"; export type ParticipantStage = - "none" | "not_submitted" | "submitted" | "review" | "evaluated" | "not_applicable"; + | "none" + | "not_submitted" + | "submitted" + | "review" + | "evaluated" + | "not_applicable"; export interface ParticipantWidget { participantProject: { id: number; name: string; programLinkId: number } | null; caseProvided: boolean; @@ -37,4 +42,8 @@ export type ProgramRoleWidget = WidgetContext & | { role: "expert"; expert: ExpertWidget } ); export type ProgramWidgetError = - "network" | "forbidden" | "unauthorized" | "not_found" | "integrity"; + | "network" + | "forbidden" + | "unauthorized" + | "not_found" + | "integrity"; diff --git a/projects/social_platform/src/app/domain/project/step.model.ts b/projects/social_platform/src/app/domain/project/step.model.ts index 09878d34b..52143d2d6 100644 --- a/projects/social_platform/src/app/domain/project/step.model.ts +++ b/projects/social_platform/src/app/domain/project/step.model.ts @@ -87,4 +87,8 @@ export interface WriteQuestion extends BaseStep { /** Объединенный тип всех возможных типов шагов */ export type StepType = - InfoSlide | ConnectQuestion | SingleQuestion | ExcludeQuestion | WriteQuestion; + | InfoSlide + | ConnectQuestion + | SingleQuestion + | ExcludeQuestion + | WriteQuestion; diff --git a/projects/social_platform/src/app/domain/shared/result.type.ts b/projects/social_platform/src/app/domain/shared/result.type.ts index 9d90cdc81..8fbad0db2 100644 --- a/projects/social_platform/src/app/domain/shared/result.type.ts +++ b/projects/social_platform/src/app/domain/shared/result.type.ts @@ -20,7 +20,8 @@ */ export type Result = - { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: E }; + | { readonly ok: true; readonly value: T } + | { readonly ok: false; readonly error: E }; /** Создаёт успешный Result */ export function ok(value: T): Result { diff --git a/projects/social_platform/src/app/domain/solution/solution-contract.model.ts b/projects/social_platform/src/app/domain/solution/solution-contract.model.ts index 1ce981309..946f7e56e 100644 --- a/projects/social_platform/src/app/domain/solution/solution-contract.model.ts +++ b/projects/social_platform/src/app/domain/solution/solution-contract.model.ts @@ -68,10 +68,23 @@ export type SolutionValidation = { }; export type SolutionFieldType = - "text" | "textarea" | "url" | "number" | "select" | "checkbox" | "file" | "radio"; + | "text" + | "textarea" + | "url" + | "number" + | "select" + | "checkbox" + | "file" + | "radio"; export type SolutionPurpose = - "other" | "case" | "presentation" | "repository" | "demo" | "video" | "run_instructions"; + | "other" + | "case" + | "presentation" + | "repository" + | "demo" + | "video" + | "run_instructions"; export type SolutionTemplateName = "case_championship" | "hackathon"; diff --git a/projects/social_platform/src/app/ui/widgets/detail/services/program/detail-program-info.service.ts b/projects/social_platform/src/app/ui/widgets/detail/services/program/detail-program-info.service.ts index 4d1970f56..472d7c496 100644 --- a/projects/social_platform/src/app/ui/widgets/detail/services/program/detail-program-info.service.ts +++ b/projects/social_platform/src/app/ui/widgets/detail/services/program/detail-program-info.service.ts @@ -128,7 +128,8 @@ export class DetailProgramInfoService { if (this.programDetailMainUIInfoService.program()?.id !== programId) return; if (!result.ok) { const error = result.error.cause as - { status?: number; error?: { detail?: string } } | undefined; + | { status?: number; error?: { detail?: string } } + | undefined; if (error?.status === 400) { this.isAssignProjectToProgramModalOpen.set(true); this.assignProjectToProgramModalMessage.set(error.error?.detail ?? null);