Giter VIP home page Giter VIP logo

acmecorporation's Introduction

Acme Corporation Prize Draw

Overview

Welcome to the Acme Corporation Prize Draw Web Application! This application allows users to enter a draw for a prize by submitting valid serial numbers from Acme Corporation's products. Users can enter the draw twice for each valid serial number, and they must be at least 18 years old.

Project Structure

The backend is structured into the following layers:

  • API Layer: Handles HTTP requests, interacting with the frontend and includes data validation with transfer model.
  • Service Layer: Implements business logic related to draw entry management, including validation and data retrieval.
  • Infrastructure Layer: Manages infrastructure concerns such as database connections and database access layer.
  • Tests: Includes unit tests for entry creation with test cases: success, fail due to data validation and fail due to max 2 entries per serial number.

The project utilizes dependency injection to manage dependencies between different components.

The frontend is developed using Angular + Tailwind CSS. It includes data validation using FormGroup and FormControls and it is structured into the following components:

Database

The application uses SQL Server as the database, running in a Docker container using this image: https://hub.docker.com/_/microsoft-mssql-server For enhanced security, the database connection string is retrieved from the "sqlconn" environment variable. Refer to Utilities.cs in the infrastructure folder for connection string details.

Database tables:

The database and table used in the application can be found in create_database.sql Tables are created in the default schema dbo.

Running SQL Server with Docker

Here are the instructions to run SQL Server with Docker:

  1. Download Docker and Create a Docker Hub Account:

  2. Find the SQL Server Image:

  3. Copy the Docker Run Command:

    • In the "How to use this image" section, copy the command for SQL Server 2022. Customize the password before running the command.

      docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourStrong(!)Password" -e "MSSQL_PID=Evaluation" -p 1433:1433 --name sqlpreview --hostname sqlpreview -d mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04
  4. Open Terminal/Command Line:

    • Open a terminal or command line on your machine.
  5. Login to Docker:

    • Run the following command to log in to Docker using your Docker Hub credentials:

      docker login
  6. Run Docker Command:

    • Execute the copied Docker run command, replacing the password and container name as needed. This command will download the SQL Server 2022 image and start the container.

      docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourNewPassword" -e "MSSQL_PID=Evaluation" -p 1433:1433 --name yourContainerName -d mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04
    • Replace yourNewPassword with your desired strong password.

    • Replace yourContainerName with a preferred name for your SQL Server container.

  7. Access SQL Server:

    • SQL Server should now be running in the Docker container. Connect to it using the specified port (default is 1433) and configured credentials.

Run the Project and Tests

- backend:

  • Navigate to the Api Directory:

    cd api
  • Run the .NET Application:

    dotnet run

- frontend:

- tests (backend):

  • To run tests for the backend, execute the following command:
    dotnet test

acmecorporation's People

Contributors

alicejasmine avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.