diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..b14fedf --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: hardingadonis +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: hardingadonis +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..272c2ce --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,27 @@ +name: 'Build with Maven' + +on: [push, pull_request] + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + name: 'Build on ${{ matrix.os }}' + runs-on: ${{ matrix.os }} + + steps: + - name: 'Checkout repository' + uses: actions/checkout@v4 + + - name: 'Set up JDK 8' + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + architecture: 'x64' + + - name: 'Build project with Maven' + run: mvn verify \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..28cb133 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: 'Release Sale Dock' + +on: + workflow_run: + workflows: [Build with Maven] + types: + - completed + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release: + name: 'Release Sale Dock' + runs-on: ubuntu-latest + + if: ${{ github.event.workflow_run.conclusion == 'success' }} + + steps: + - name: 'Checkout repository' + uses: actions/checkout@v4 + + - name: 'Get version' + id: get_version + run: | + chmod +x get_version.sh + echo "version=$(./get_version.sh)" >> $GITHUB_OUTPUT + + - name: 'Release Sale Dock' + uses: softprops/action-gh-release@v0.1.15 + with: + name: 'Sale Dock - v${{ steps.get_version.outputs.version }}' + tag_name: ${{ steps.get_version.outputs.version }} + generate_release_notes: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 524f096..eeee1b0 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,11 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* replay_pid* + +# Maven +target/ + +# NetBeans +nbproject/ +nb-configuration.xml +server/*.war \ No newline at end of file diff --git a/.imgbotconfig b/.imgbotconfig new file mode 100644 index 0000000..7f9fa34 --- /dev/null +++ b/.imgbotconfig @@ -0,0 +1,7 @@ +{ + "schedule": "daily", + "ignoredFiles": [ + ], + "compressWiki": "false", + "minKBReduced": 0 +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 261eeb9..6fb0cbe 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2024 Minh Vương Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/database/database.svg b/database/database.svg new file mode 100644 index 0000000..140871c --- /dev/null +++ b/database/database.svg @@ -0,0 +1,12 @@ +1*1**11**1customeridintcodevarchar(255)namevarchar(255)emailvarchar(255)addressvarchar(255)created_atTIMESTAMPupdated_atTIMESTAMPproductidintcodevarchar(255)namevarchar(255)descriptionTEXTpriceREALcategory_idvarchar(255)image_urlLONGTEXTcreated_atTIMESTAMPupdated_atTIMESTAMPcategoryidintnamevarchar(255)employeeidintcodevarchar(255)passwordvarchar(255)namevarchar(255)created_atTIMESTAMPupdated_atTIMESTAMPorderidintcodevarchar(255)employee_idintcustomer_idintstatusorder_statustotalREALnoteTEXTcreated_atTIMESTAMPupdated_atTIMESTAMPorder_detailorder_idintproduct_idintquantityint \ No newline at end of file diff --git a/database/setup.sql b/database/setup.sql new file mode 100644 index 0000000..f729917 --- /dev/null +++ b/database/setup.sql @@ -0,0 +1,64 @@ +CREATE TABLE `customer` ( + `id` int PRIMARY KEY AUTO_INCREMENT COMMENT 'ID dùng để quản lý, tự động tăng', + `code` varchar(255) UNIQUE COMMENT 'Mã khách hàng, sẽ hiện trên giao diện, ID thì không hiện', + `name` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `address` varchar(255) NOT NULL, + `created_at` TIMESTAMP DEFAULT null, + `updated_at` TIMESTAMP DEFAULT null +); + +CREATE TABLE `product` ( + `id` int PRIMARY KEY AUTO_INCREMENT COMMENT 'ID dùng để quản lý, tự động tăng', + `code` varchar(255) UNIQUE COMMENT 'Mã sản phẩm, sẽ hiện trên giao diện, ID thì không hiện', + `name` varchar(255) NOT NULL, + `description` TEXT, + `price` REAL NOT NULL, + `category_id` varchar(255) NOT NULL, + `image_url` LONGTEXT, + `created_at` TIMESTAMP DEFAULT null, + `updated_at` TIMESTAMP DEFAULT null +); + +CREATE TABLE `category` ( + `id` int PRIMARY KEY AUTO_INCREMENT COMMENT 'ID dùng để quản lý, tự động tăng', + `name` varchar(255) NOT NULL +); + +CREATE TABLE `employee` ( + `id` int PRIMARY KEY AUTO_INCREMENT COMMENT 'ID dùng để quản lý, tự động tăng', + `code` varchar(255) UNIQUE COMMENT 'Mã nhân viên, sẽ hiện trên giao diện, dùng để đăng nhập, vd QE170001', + `password` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `created_at` TIMESTAMP DEFAULT null, + `updated_at` TIMESTAMP DEFAULT null +); + +CREATE TABLE `order` ( + `id` int PRIMARY KEY AUTO_INCREMENT COMMENT 'ID dùng để quản lý, tự động tăng', + `code` varchar(255) UNIQUE, + `employee_id` int NOT NULL, + `customer_id` int NOT NULL, + `status` ENUM ('pending', 'shipping', 'done', 'canceled') NOT NULL, + `total` REAL NOT NULL, + `note` TEXT DEFAULT null, + `created_at` TIMESTAMP DEFAULT null, + `updated_at` TIMESTAMP DEFAULT null +); + +CREATE TABLE `order_detail` ( + `order_id` int, + `product_id` int, + `quantity` int NOT NULL, + PRIMARY KEY (`order_id`, `product_id`) +); + +ALTER TABLE `order` ADD FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`); + +ALTER TABLE `order_detail` ADD FOREIGN KEY (`order_id`) REFERENCES `order` (`id`); + +ALTER TABLE `product` ADD FOREIGN KEY (`category_id`) REFERENCES `category` (`id`); + +ALTER TABLE `order_detail` ADD FOREIGN KEY (`product_id`) REFERENCES `product` (`id`); + +ALTER TABLE `order` ADD FOREIGN KEY (`employee_id`) REFERENCES `employee` (`id`); diff --git a/get_version.sh b/get_version.sh new file mode 100644 index 0000000..13ca69b --- /dev/null +++ b/get_version.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +major_version=0 +minor_version=0 +path_version=1 + +echo "$major_version.$minor_version.$path_version" diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..969acf1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + + io.hardingadonis + saledock + 0.0.1 + war + + Sale Dock + + + UTF-8 + + + + + javax + javaee-web-api + 7.0 + provided + + + com.mysql + mysql-connector-j + 8.0.33 + + + org.hibernate + hibernate-core + 5.6.15.Final + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + false + ${project.basedir}/server/ + + + + + diff --git a/src/main/java/io/hardingadonis/saledock/controller/Controller.java b/src/main/java/io/hardingadonis/saledock/controller/Controller.java new file mode 100644 index 0000000..fe669e6 --- /dev/null +++ b/src/main/java/io/hardingadonis/saledock/controller/Controller.java @@ -0,0 +1,5 @@ +package io.hardingadonis.saledock.controller; + +public class Controller { + +} diff --git a/src/main/java/io/hardingadonis/saledock/model/Model.java b/src/main/java/io/hardingadonis/saledock/model/Model.java new file mode 100644 index 0000000..2b1984f --- /dev/null +++ b/src/main/java/io/hardingadonis/saledock/model/Model.java @@ -0,0 +1,5 @@ +package io.hardingadonis.saledock.model; + +public class Model { + +} diff --git a/src/main/java/io/hardingadonis/saledock/utils/Utils.java b/src/main/java/io/hardingadonis/saledock/utils/Utils.java new file mode 100644 index 0000000..03d5a07 --- /dev/null +++ b/src/main/java/io/hardingadonis/saledock/utils/Utils.java @@ -0,0 +1,5 @@ +package io.hardingadonis.saledock.utils; + +public class Utils { + +} diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml new file mode 100644 index 0000000..e69de29 diff --git a/src/main/webapp/META-INF/context.xml b/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..6a70a28 --- /dev/null +++ b/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + +