Skip to content

upekshaip/sa-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Documentation

Overview

This API provides endpoints for managing auctions, bids, payments, users, notifications, and dashboard data. The API follows the OpenAPI 3.0.1 specification.

ER Diagram

ER Diagram

This diagram provides a visual representation of the database structure, showing the relationships between different entities within the system.

Menu

Setup

Follow these steps to set up and run the project.

1. Clone the repository

git clone https://github.com/upekshaip/sa-backend.git

2. Navigate to the project directory

cd sa-backend

3. Restore the dependencies

dotnet restore

4. Install Entity Framework Core tools (if not already installed)

dotnet tool install --global dotnet-ef --version 8.*

5. Configure the connection string

Open the appsettings.json file and update the DefaultConnection string according to your MySQL server port and credentials.

Example configuration:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Port=3306;Database=auction_system;User=root;Password=;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

6. Navigate to the API directory

cd api

7. Add the initial migration

dotnet ef migrations add InitialDB

8. Update the database

dotnet ef database update

9. Run the project

dotnet watch run

Additional Notes

  • Ensure MySQL is running on the specified port in the connection string.
  • You can modify the database connection details in appsettings.json as needed.

Endpoints

Auctions

  • GET /api/auctions

    • Tags: Auctions
    • Responses:
      • 200: Success
  • POST /api/auctions/my

    • Tags: Auctions
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: GetMyAuctionsDto
      • Example:
        {
          "id": 1
        }
    • Responses:
      • 200: Success
  • POST /api/auctions/mybids

    • Tags: Auctions
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: GetMyAuctionsDto
      • Example:
        {
          "id": 1
        }
    • Responses:
      • 200: Success
  • POST /api/auctions/statusUpdate

    • Tags: Auctions
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: StatusUpdateDto
      • Example:
        {
          "id": 1,
          "auctionId": 1,
          "isLive": "true"
        }
    • Responses:
      • 200: Success
  • GET /api/auctions/{id}

    • Tags: Auctions
    • Parameters:
      • id (path, required, integer, int32)
    • Responses:
      • 200: Success
  • POST /api/auctions/create

    • Tags: Auctions
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: CreateAuctionDto
      • Example:
        {
          "title": "Auction Title",
          "description": "Auction Description",
          "auctionImage": "image_url",
          "auctionCategory": "Category",
          "sellerId": 1,
          "startTime": "2023-10-01T00:00:00Z",
          "endTime": "2023-10-10T00:00:00Z",
          "startingBid": 100.0
        }
    • Responses:
      • 200: Success
  • POST /api/auctions/additem

    • Tags: Auctions
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: CreateAuctionItemDto
      • Example:
        {
          "auctionId": 1,
          "itemName": "Item Name",
          "itemDescription": "Item Description",
          "itemImage": "image_url",
          "itemCategory": "Category"
        }
    • Responses:
      • 200: Success
  • POST /api/auctions/upload-image

    • Tags: Auctions
    • Request Body:
      • Content Types: multipart/form-data
      • Schema: Object with property file (string, binary)
      • Example:
        {
          "file": "binary_data"
        }
    • Responses:
      • 200: Success

Bids

  • GET /api/bids

    • Tags: Bids
    • Responses:
      • 200: Success
  • GET /api/bids/{id}

    • Tags: Bids
    • Parameters:
      • id (path, required, integer, int32)
    • Responses:
      • 200: Success
  • POST /api/bids/create

    • Tags: Bids
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: CreateBidDto
      • Example:
        {
          "auctionId": 1,
          "bidderId": 1,
          "status": "active",
          "bidAmount": 150.0
        }
    • Responses:
      • 200: Success

Dashboard

  • POST /api/dashboard/all
    • Tags: Dashboard
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: GetDashboardDto
      • Example:
        {
          "userId": 1
        }
    • Responses:
      • 200: Success

Notifications

  • GET /api/notifications/{id}

    • Tags: Notifications
    • Parameters:
      • id (path, required, integer, int32)
    • Responses:
      • 200: Success
  • POST /api/notifications/check

    • Tags: Notifications
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: CheckNotificationsDto
      • Example:
        {
          "userId": 1
        }
    • Responses:
      • 200: Success
  • POST /api/notifications/read

    • Tags: Notifications
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: ReadNotifications
      • Example:
        {
          "id": 1,
          "userId": 1
        }
    • Responses:
      • 200: Success

Payments

  • GET /api/payments/{id}

    • Tags: Payment
    • Parameters:
      • id (path, required, integer, int32)
    • Responses:
      • 200: Success
  • POST /api/payments/create

    • Tags: Payment
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: CreatePaymentDto
      • Example:
        {
          "userId": 1,
          "auctionId": 1,
          "amount": 200.0,
          "type": "credit"
        }
    • Responses:
      • 200: Success
  • POST /api/payments/info

    • Tags: Payment
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: GetInfoDto
      • Example:
        {
          "userId": 1,
          "auctionId": 1,
          "type": "credit"
        }
    • Responses:
      • 200: Success
  • POST /api/payments/check

    • Tags: Payment
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: CreatePaymentDto
      • Example:
        {
          "userId": 1,
          "auctionId": 1,
          "amount": 200.0,
          "type": "credit"
        }
    • Responses:
      • 200: Success
  • POST /api/payments/my

    • Tags: Payment
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: GetMyPaymentsDto
      • Example:
        {
          "userId": 1
        }
    • Responses:
      • 200: Success

Users

  • GET /api/users

    • Tags: Users
    • Responses:
      • 200: Success
  • GET /api/users/{id}

    • Tags: Users
    • Parameters:
      • id (path, required, integer, int32)
    • Responses:
      • 200: Success
  • POST /api/users/signup

    • Tags: Users
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: CreateUserDto
      • Example:
        {
          "firstName": "John",
          "lastName": "Doe",
          "email": "john.doe@example.com",
          "username": "johndoe",
          "gender": "male",
          "mobile": 1234567890,
          "password": "password123",
          "address": "123 Main St"
        }
    • Responses:
      • 200: Success
  • PUT /api/users/edit

    • Tags: Users
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: UpdateUserDto
      • Example:
        {
          "id": 1,
          "firstName": "John",
          "lastName": "Doe",
          "email": "john.doe@example.com",
          "username": "johndoe",
          "gender": "male",
          "mobile": 1234567890,
          "address": "123 Main St"
        }
    • Responses:
      • 200: Success
  • POST /api/users/resetPassword

    • Tags: Users
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: ResetUserPasswordDto
      • Example:
        {
          "id": 1,
          "newPassword": "newpassword123",
          "oldPassword": "oldpassword123"
        }
    • Responses:
      • 200: Success
  • POST /api/users/login

    • Tags: Users
    • Request Body:
      • Content Types: application/json, text/json, application/*+json
      • Schema: UserLoginDto
      • Example:
        {
          "username": "johndoe",
          "password": "password123"
        }
    • Responses:
      • 200: Success

Schemas

CheckNotificationsDto

  • Type: object
  • Properties:
    • userId (integer, int32)
  • Additional Properties: false

CreateAuctionDto

  • Type: object
  • Properties:
    • title (string, nullable)
    • description (string, nullable)
    • auctionImage (string, nullable)
    • auctionCategory (string, nullable)
    • sellerId (integer, int32)
    • startTime (string, date-time)
    • endTime (string, date-time)
    • startingBid (number, double)
  • Additional Properties: false

CreateAuctionItemDto

  • Type: object
  • Properties:
    • auctionId (integer, int32)
    • itemName (string, nullable)
    • itemDescription (string, nullable)
    • itemImage (string, nullable)
    • itemCategory (string, nullable)
  • Additional Properties: false

CreateBidDto

  • Type: object
  • Properties:
    • auctionId (integer, int32)
    • bidderId (integer, int32)
    • status (string, nullable)
    • bidAmount (number, double)
  • Additional Properties: false

CreatePaymentDto

  • Type: object
  • Properties:
    • userId (integer, int32)
    • auctionId (integer, int32)
    • amount (number, double)
    • type (string, nullable)
  • Additional Properties: false

CreateUserDto

  • Type: object
  • Properties:
    • firstName (string, nullable)
    • lastName (string, nullable)
    • email (string, nullable)
    • username (string, nullable)
    • gender (string, nullable)
    • mobile (integer, int32)
    • password (string, nullable)
    • address (string, nullable)
  • Additional Properties: false

GetDashboardDto

  • Type: object
  • Properties:
    • userId (integer, int32)
  • Additional Properties: false

GetInfoDto

  • Type: object
  • Properties:
    • userId (integer, int32)
    • auctionId (integer, int32)
    • type (string, nullable)
  • Additional Properties: false

GetMyAuctionsDto

  • Type: object
  • Properties:
    • id (integer, int32)
  • Additional Properties: false

GetMyPaymentsDto

  • Type: object
  • Properties:
    • userId (integer, int32)
  • Additional Properties: false

ReadNotifications

  • Type: object
  • Properties:
    • id (integer, int32)
    • userId (integer, int32)
  • Additional Properties: false

ResetUserPasswordDto

  • Type: object
  • Properties:
    • id (integer, int32)
    • newPassword (string, nullable)
    • oldPassword (string, nullable)
  • Additional Properties: false

StatusUpdateDto

  • Type: object
  • Properties:
    • id (integer, int32)
    • auctionId (integer, int32)
    • isLive (string, nullable)
  • Additional Properties: false

UpdateUserDto

  • Type: object
  • Properties:
    • id (integer, int32)
    • firstName (string, nullable)
    • lastName (string, nullable)
    • email (string, nullable)
    • username (string, nullable)
    • gender (string, nullable)
    • mobile (integer, int32)
    • address (string, nullable)
  • Additional Properties: false

UserLoginDto

  • Type: object
  • Properties:
    • username (string, nullable)
    • password (string, nullable)
  • Additional Properties: false

About

C# backend project (ASP .net) - Web api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages