Files
sms-task-one/README.md
2026-06-04 18:09:06 +03:00

74 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SMS Task One
Тестовое задание SMS (Middle C#): REST/gRPC API сервера и консольное приложение с PostgreSQL.
## Требования
- [.NET 10 SDK](https://dotnet.microsoft.com/download)
- Docker (для PostgreSQL) или свой экземпляр Postgres 16+
## Структура
| Проект | Назначение |
|--------|------------|
| `Domain` | Доменные модели |
| `Contracts` | DTO, JSON, gRPC proto |
| `ApiServer` | ASP.NET Core: HTTP API + gRPC |
| `ApiClient` | HTTP и gRPC клиенты |
| `Console` | Консоль (часть 3 ТЗ): меню, заказ, БД |
## Сборка
```bash
dotnet build
```
## База данных
Запуск Postgres в Docker (сброс данных):
```bash
./scripts/restart-db.sh
```
Параметры: `localhost:5432`, БД `sms_task`, пользователь/поль `sms` / `sms`.
Подключение через `psql`:
```bash
psql -h localhost -p 5432 -U sms -d sms_task
```
Пароль: `sms`. Вариант с URI:
```bash
psql "postgresql://sms:sms@localhost:5432/sms_task"
```
## ApiServer
```bash
dotnet run --project src/ApiServer/ApiServer.csproj
```
| Сервис | URL |
|--------|-----|
| HTTP API | http://localhost:5053 |
| gRPC | http://localhost:5054 |
Basic Auth (HTTP): `user` / `password` (см. `src/ApiServer/appsettings.json`).
Примеры запросов: `src/ApiServer/ApiServer.http`.
## Console
Сначала запустите ApiServer и БД.
```bash
dotnet run --project src/Console/Console.csproj
```
При старте выбирается протокол: `1` — HTTP, `2` — gRPC. Настройки — в `src/Console/appsettings.json`. Лог пишется в файл `test-sms-console-app-*.log` в каталоге запуска; путь выводится в конце работы.
Формат ввода заказа: `Артикул:Количество;Артикул:Количество` (например `A1004292:1`).