Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/core/guards-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<code>`. |
| `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/<code>`. |
| `error/error-message.ts` | `enum ErrorMessage` | Все текстовые сообщения об ошибках на русском, сгруппированы по категориям: AUTH, VALIDATION, USER, рейтинг проектов. Полная таблица — ниже. |
| `http.model.ts` | `interface ApiError { detail: string }` | Типизация ошибок API: бэк отдаёт `{ detail: "..." }` для 4xx. | |

### ErrorMessage — все значения

Expand Down
4 changes: 3 additions & 1 deletion docs/modules/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
```

---
Expand Down
3 changes: 2 additions & 1 deletion docs/social-platform/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ type AsyncState<T, E = string> =

```ts
type Result<T, E = string> =
{ 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)`.
Expand Down
3 changes: 2 additions & 1 deletion docs/social-platform/shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ readonly loading = computed(() => isLoading(this.course$()));

```ts
type Result<T, E = string> =
{ 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<T, E>>` и **никогда не выбрасывает** — все ошибки представимы в `Result.fail`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void, InviteError>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,8 @@ export interface WriteQuestion extends BaseStep {

/** Объединенный тип всех возможных типов шагов */
export type StepType =
InfoSlide | ConnectQuestion | SingleQuestion | ExcludeQuestion | WriteQuestion;
| InfoSlide
| ConnectQuestion
| SingleQuestion
| ExcludeQuestion
| WriteQuestion;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
*/

export type Result<T, E = string> =
{ 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<T>(value: T): Result<T, never> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down