This document describes the simplified frontend/backend contract for the examination form.
The goals are:
- keep the frontend structure hardcoded
- keep the backend as the source of truth for values, visibility, status, and finalization
| import { type paths } from "@/types/api-types"; | |
| import { queryClient } from "@/api/api"; | |
| import { toast } from "sonner"; | |
| type OperationState<TData> = { | |
| previousData: TData; | |
| timestamp: number; | |
| }; | |
| // Constants for stack management |
| # All command are inside a /src directory and excluding node_modules and files starting with a dot. | |
| # Get amount of characters | |
| (Get-ChildItem -Path ./src -Recurse -File | Where-Object { $_.FullName -notmatch '\\node_modules\\' -and $_.Name -notmatch '^\.' -and $_.Directory.Name -notmatch '^\.' } | ForEach-Object { (Get-Content $_.FullName -Raw).Length } | Measure-Object -Sum).Sum | |
| # Get amount of OpenAI tokens (based on 1 token ≈ 4.325 characters, which I confirmed to be roughly accurate) | |
| [math]::Round(((Get-ChildItem -Path ./src -Recurse -File | Where-Object { $_.FullName -notmatch '\\node_modules\\' -and $_.Name -notmatch '^\.' -and $_.Directory.Name -notmatch '^\.' } | ForEach-Object { (Get-Content $_.FullName -Raw).Length } | Measure-Object -Sum).Sum * 0.23129), 0) | |
| # Ge amount of lines | |
| (Get-ChildItem -Path ./src -Recurse -File | Where-Object { $_.FullName -notmatch '\\node_modules\\' -and $_.Name -notmatch '^\.' -and $_.Directory.Name -notmatch '^\.' } | ForEach-Object { (Get-Content $_.FullName | Where |
| import { Injectable, OnModuleInit, Optional, Logger } from "@nestjs/common"; | |
| import { ThrottleMetrics } from "./throttle.metrics"; | |
| import { | |
| ThrottleConfig, | |
| ThrottleRecord, | |
| ThrottleCheckResult, | |
| ThrottleRule, | |
| } from "./throttle.types"; | |
| import { ThrottleException } from "./throttle.exception"; |
| type EventMap = { | |
| loadMore: { lastMessage: sting }; | |
| }; | |
| class TypedEventTarget<T extends Record<string, any>> { | |
| private listeners: Partial<{ [K in keyof T]: ((event: T[K]) => void)[] }> = {}; | |
| addEventListener<K extends keyof T>(type: K, listener: (event: T[K]) => void) { | |
| if (!this.listeners[type]) { | |
| this.listeners[type] = []; |
| import * as React from "react"; | |
| import { Platform } from "react-native"; | |
| import DateTimePicker, { | |
| AndroidNativeProps, | |
| type IOSNativeProps, | |
| } from "@react-native-community/datetimepicker"; | |
| import { DateTimePickerModal } from "@/components/DateTimePickerModal"; | |
| type CustomProps = { | |
| iosModalLabel: React.ReactNode; |
| import { z } from "zod"; | |
| type NullableKeys<T, K extends keyof T> = Omit<T, K> & { [P in K]: T[P] | null }; | |
| export function makeFieldsNullable<T extends z.ZodTypeAny, K extends keyof z.infer<T>>( | |
| schema: T, | |
| keys: K[], | |
| ): z.ZodType<NullableKeys<z.infer<T>, K>> { | |
| return schema.transform((data) => { | |
| const result = { ...data }; |
| import * as fs from "fs/promises"; | |
| import * as path from "path"; | |
| import fetch from "node-fetch"; | |
| import PQueue from "p-queue"; | |
| interface PackageJson { | |
| dependencies?: Record<string, string>; | |
| devDependencies?: Record<string, string>; | |
| } |
| import type { | |
| FetchError, | |
| ResponseType, | |
| MutationVariablesType, | |
| PathsWithDefinedMethods, | |
| } from "@/types/api-mutators"; | |
| import { client } from "@/api/common"; | |
| import { createApiMutation } from "@/helpers/create-api-mutation.helper"; | |
| // NOTE: WILL NOT WORK WITH "PATH" arguments (if the target API endpoint is e.g. "/user/:id"). |
| import os | |
| def list_files(startpath, output_file, list_files=True): | |
| ignored_directories = {"node_modules", "out", "ios", "public", "locales", "uploads", "volumes", "prisma", ".husky", ".turbo", "android", ".next", ".github", ".git", ".idea", ".vscode", ".vscode-counter"} | |
| with open(output_file, 'w') as f_out: | |
| for root, dirs, files in os.walk(startpath, topdown=True): | |
| # Update dirs in-place to skip ignored directories | |
| dirs[:] = [d for d in dirs if all(not root.replace(startpath, "").startswith(ignored) and d != ignored for ignored in ignored_directories)] | |
| # Skip files at the root directory |