hahaton

0
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
6 месяцев назад
README.md

API Endpoints — Dashboard.Backend

Базовый URL

  • Адреса:
    https://45.130.214.139:5051
    или
    http://45.130.214.139:5050
    .
  • Все пути начинаются с префикса
    /api/
    .

Общие правила

  • Content-Type:
    application/json
    для POST/PUT.
  • Ответы:
    • 200 OK — успешный GET.
    • 201 Created — успешный POST; возвращает созданный ресурс (DTO) и заголовок Location.
    • 204 No Content — успешный PUT/DELETE (нет содержимого в ответе).
    • 404 Not Found — ресурс не найден.
  • Аутентификация/авторизация: не настроена в проекте

DTO (кратко)

  • ProductDto

    • ProductId: int
    • ProductName: string?
    • Category: string?
    • Price: decimal?
    • SupplierId: int?
  • SupplierDto

    • SupplierId: int
    • SupplierName: string?
    • Region: string?
    • Rating: decimal?
  • SaleDto

    • TransactionId: int
    • CustomerId: int?
    • ProductId: int?
    • Quantity: int?
    • PaymentMethod: string?
    • TransactionDate: DateTime?
  • UserSegmentDto

    • CustomerId: int
    • Segment: string?
    • Region: string?
    • RegistrationDate: DateTime?
  • ProductReturnDto

    • ReturnId: int
    • TransactionId: int?
    • CustomerId: int?
    • ProductId: int?
    • Reason: string?
  • InventoryDto

    • ProductId: int?
    • WarehouseId: int?
    • StockQuantity: int?
    • LastUpdated: DateTime?
  • AdRevenueDto

    • AdId: int
    • CampaignName: string?
    • ProductId: int?
    • Spend: decimal?
    • Revenue: decimal?
    • Impressions: int?
    • Clicks: int?
    • Date: DateTime?
  • TrafficDto

    • TrafficId: int
    • CustomerId: int?
    • Channel: string?
    • SessionStart: DateTime?
    • Device: string?
  • CustomerSupportDto

    • TicketId: int
    • CustomerId: int?
    • IssueType: string?
    • ResolutionTimeMinutes: int?
    • Resolved: bool?
    • SupportDate: DateTime?

Контроллер: ProductsController

  • GET /api/products

    • Описание: вернуть все продукты.
    • Ответ: 200 OK, массив ProductDto
  • GET /api/products/{id}

    • Описание: вернуть продукт по ProductId
    • Ответы: 200 OK (ProductDto) или 404 Not Found
  • POST /api/products

    • Тело (ProductDto без ProductId): { "productName": "Widget", "category": "Gadgets", "price": 9.99, "supplierId": 1 }
    • Ответ: 201 Created, тело — созданный ProductDto
  • PUT /api/products/{id}

    • Тело: ProductDto (обновлённые поля)
    • Ответы: 204 No Content или 404 Not Found
  • DELETE /api/products/{id}

    • Ответы: 204 No Content или 404 Not Found

Контроллер: SuppliersController

  • GET /api/suppliers — все поставщики
  • GET /api/suppliers/{id} — поставщик по id
  • POST /api/suppliers
    • Тело: { "supplierName": "Acme", "region": "EU", "rating": 4.5 }
  • PUT /api/suppliers/{id}
  • DELETE /api/suppliers/{id}

Контроллер: SalesController

  • GET /api/sales — все продажи
  • GET /api/sales/{id} — продажа по TransactionId
  • POST /api/sales
    • Тело: { "customerId": 10, "productId": 5, "quantity": 2, "paymentMethod": "card", "transactionDate": "2025-10-06T12:00:00Z" }
  • PUT /api/sales/{id}
  • DELETE /api/sales/{id}

Контроллер: UserSegmentsController

  • GET /api/usersegments — все сегменты
  • GET /api/usersegments/{id}
  • POST /api/usersegments
    • Тело: { "segment": "VIP", "region": "US", "registrationDate": "2024-01-01T00:00:00Z" }
  • PUT /api/usersegments/{id}
  • DELETE /api/usersegments/{id}

Контроллер: ProductReturnsController

  • GET /api/productreturns — все возвраты
  • GET /api/productreturns/{id}
  • POST /api/productreturns
    • Тело: { "transactionId": 123, "customerId": 10, "productId": 5, "reason": "Damaged" }
  • PUT /api/productreturns/{id}
  • DELETE /api/productreturns/{id}

Контроллер: InventoriesController

  • GET /api/inventories — все записи склада
  • GET /api/inventories/{productId} — запись по productId
  • POST /api/inventories
    • Тело: { "productId": 5, "warehouseId": 1, "stockQuantity": 100, "lastUpdated": "2025-10-06T12:00:00Z" }
  • PUT /api/inventories/{productId}
  • DELETE /api/inventories/{productId}

Контроллер: AdRevenuesController

  • GET /api/adrevenues — все рекламные кампании / доходы
  • GET /api/adrevenues/{id}
  • POST /api/adrevenues
    • Тело: { "campaignName": "Fall Sale", "productId": 5, "spend": 1000.50, "revenue": 2500.00, "impressions": 100000, "clicks": 500, "date": "2025-10-01T00:00:00Z" }
  • PUT /api/adrevenues/{id}
  • DELETE /api/adrevenues/{id}

Контроллер: TrafficsController

  • GET /api/traffics — все трафик-записи
  • GET /api/traffics/{id}
  • POST /api/traffics
    • Тело: { "customerId": 10, "channel": "organic", "sessionStart": "2025-10-06T11:00:00Z", "device": "mobile" }
  • PUT /api/traffics/{id}
  • DELETE /api/traffics/{id}

Контроллер: CustomerSupportsController

  • GET /api/customersupports — все тикеты поддержки
  • GET /api/customersupports/{id}
  • POST /api/customersupports
    • Тело: { "customerId": 10, "issueType": "payment", "resolutionTimeMinutes": 30, "resolved": true, "supportDate": "2025-10-06T10:00:00Z" }
  • PUT /api/customersupports/{id}
  • DELETE /api/customersupports/{id}