Skip to content

Commit

Permalink
Merge pull request #4150 from CAFECA-IO/release/v0.9.0
Browse files Browse the repository at this point in the history
Release/v0.9.0
  • Loading branch information
arealclimber authored Jan 23, 2025
2 parents 5860342 + 02849a0 commit e17a34f
Show file tree
Hide file tree
Showing 1,080 changed files with 122,002 additions and 24,343 deletions.
24 changes: 21 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mail api settings we use Gmail as an example
MAIL_CLIENT_ID =
MAIL_CLIENT_PASSWORD =
MAIL_SERVICE =
MAIL_SERVICE =

# Google API
GOOGLE_PROJECT_ID =
Expand All @@ -23,6 +23,8 @@ I_SUN_FA_PHONE_NUMBER = +886-2-2700-1979

# Social Media Links
REACT_APP_GITHUB_LINK = https://github.com/CAFECA-IO
REACT_APP_FACEBOOK_LINK = https://www.facebook.com/profile.php?id=61555435381112
REACT_APP_YOUTUBE_LINK = https://www.youtube.com/@isunfa

# AICH
AICH_URI =
Expand All @@ -36,17 +38,33 @@ BASE_STORAGE_PATH =
# Payment service settings we use OEN as an example
PAYMENT_TOKEN =
PAYMENT_ID =
PAYMENT_SERVICE =
PAYMENT_SERVICE =

# OAuth 2.0 for apple login and google login
GOOGLE_CLIENT_ID = google-client-id
GOOGLE_CLIENT_SECRET = google-client-secret

APPLE_CLIENT_ID = com.company.app
APPLE_CLIENT_SECRET = apple-client-secret
APPLE_KEY_ID = apple-key-id
APPLE_TEAM_ID = apple-team-id
APPLE_PRIVATE_KEY = apple-private-key
APPLE_TOKEN_EXPIRY = 3600
APPLE_REDIRECT_URI =

NEXT_PUBLIC_APPLE_CLIENT_ID =
NEXT_PUBLIC_APPLE_REDIRECT_URI =

NEXTAUTH_URL = https://isunfa.com/
NEXTAUTH_SECRET = generated-random-secret

NEXT_PUBLIC_PUSHER_KEY =
NEXT_PUBLIC_PUSHER_HOST =
NEXT_PUBLIC_PUSHER_PORT =
NEXT_PUBLIC_PUSHER_CLUSTER =
NEXT_PUBLIC_PUSHER_USE_TLS =

PUSHER_APP_ID =
PUSHER_SECRET =
PUSHER_USE_TLS =

NEXT_PUBLIC_DOMAIN =
23 changes: 13 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 2020, // 支援 ECMAScript2020
sourceType: 'module', // 使用 ECMAScript ****module
ecmaVersion: 2020, // Info: (20240112 - Shirley) 支援 ECMAScript2020
sourceType: 'module', // Info: (20240112 - Shirley) 使用 ECMAScript ****module
ecmaFeatures: {
jsx: true, // 支援 JSX
jsx: true, // Info: (20240112 - Shirley) 支援 JSX
experimentalObjectRestSpread: true,
},
project: './tsconfig.eslint.json',
},
// 加上 ts 相關規則
// Info: (20240112 - Shirley) 加上 ts 相關規則
overrides: [
{
files: ['*.ts', '*.tsx', '**/*.ts', '**/*.tsx'],
Expand Down Expand Up @@ -54,7 +54,7 @@ module.exports = {
'react/jsx-curly-brace-presence': 'off',
'import/prefer-default-export': 'off',
'@typescript-eslint/quotes': 'off',
// 關閉 Airbnb 排版相關的規則
// Info: (20240403 - Shirley) 關閉 Airbnb 排版相關的規則
'react/jsx-closing-bracket-location': 'off',
'react/jsx-closing-tag-location': 'off',
'react/jsx-curly-spacing': 'off',
Expand Down Expand Up @@ -82,6 +82,7 @@ module.exports = {
],
'implicit-arrow-linebreak': 'off',
'react/no-is-mounted': 'off',
'function-paren-newline': 'off',
},
},
],
Expand Down Expand Up @@ -124,7 +125,7 @@ module.exports = {
'react/jsx-curly-brace-presence': 'off',
'import/prefer-default-export': 'off',
'@typescript-eslint/quotes': 'off',
// 關閉 Airbnb 排版相關的規則
// Info: (20240403 - Shirley) 關閉 Airbnb 排版相關的規則
'react/jsx-closing-bracket-location': 'off',
'react/jsx-closing-tag-location': 'off',
'react/jsx-curly-spacing': 'off',
Expand All @@ -140,13 +141,15 @@ module.exports = {
'no-eval': 'error',
'no-new-func': 'error',
'react/no-is-mounted': 'off',
// 'react-hooks/rules-of-hooks': 'error', // Info: (20241117 - Liz) 檢查 Hooks 使用規則, 請不要刪除, 開發的時候我們可以打開使用, 等到 build 的時候再註解掉
// 'react-hooks/exhaustive-deps': 'warn', // Info: (20241117 - Liz) 檢查 effect 的依賴, 請不要刪除, 開發的時候我們可以打開使用, 等到 build 的時候再註解掉
},

// 整合 prettier 和解決 prettier 衝突問題
plugins: ['tailwindcss', '@babel', 'prettier', 'react'],
// Info: (20240112 - Shirley) 整合 prettier 和解決 prettier 衝突問題
plugins: ['tailwindcss', '@babel', 'prettier', 'react', 'react-hooks'],
settings: {
tailwindcss: {
// These are the default values but feel free to customize
// Info: (20240112 - Shirley) These are the default values but feel free to customize
callees: ['classnames', 'clsx', 'ctl'],
config: 'tailwind.config.ts',
cssFiles: ['**/*.css', '!**/node_modules', '!**/.*', '!**/dist', '!**/build'],
Expand All @@ -166,6 +169,6 @@ module.exports = {
},
},
},
// 讓 eslint 知道我們在使用 jest ,這樣在跑 test.js 時 eslint 就不會報 jest 關鍵字的錯誤了
// Info: (20240112 - Shirley) 讓 eslint 知道我們在使用 jest ,這樣在跑 test.js 時 eslint 就不會報 jest 關鍵字的錯誤了
env: { browser: true, node: true, es6: true, jest: true },
};
2 changes: 2 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const nextConfig = {
I_SUN_FA_ADDRESS_ON_GOOGLE_MAP: process.env.I_SUN_FA_ADDRESS_ON_GOOGLE_MAP,
I_SUN_FA_PHONE_NUMBER: process.env.I_SUN_FA_PHONE_NUMBER,
GITHUB_LINK: process.env.REACT_APP_GITHUB_LINK,
FACEBOOK_LINK: process.env.REACT_APP_FACEBOOK_LINK,
YOUTUBE_LINK: process.env.REACT_APP_YOUTUBE_LINK,
NEXT_PUBLIC_GA_ID: process.env.NEXT_PUBLIC_GA_ID,
},
images: {
Expand Down
20 changes: 15 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iSunFA",
"version": "0.8.5",
"version": "0.9.0",
"private": false,
"scripts": {
"dev": "next dev",
Expand All @@ -14,24 +14,28 @@
"validate": "prettier --ignore-path .gitignore --write \"**/*.+(js|jsx|ts|tsx|json|css)\" && next lint && eslint --fix --ext .js,.jsx,.ts,.tsx . && npm run test",
"production": "next start -p 80",
"update-version": "ts-node -r tsconfig-paths/register --compiler-options '{\"module\":\"CommonJS\"}' scripts/update_version.ts && git add package.json",
"prepare": "husky"
"prepare": "husky",
"analyze-certificate": "ts-node -r tsconfig-paths/register --compiler-options '{\"module\":\"CommonJS\"}' scripts/analyze_certificate.ts",
"retrieve-certificate": "ts-node -r tsconfig-paths/register --compiler-options '{\"module\":\"CommonJS\"}' scripts/retrieve_certificate.ts"
},
"dependencies": {
"@google-cloud/storage": "^7.11.1",
"@next/third-parties": "^14.2.5",
"@prisma/client": "^5.14.0",
"@types/formidable": "^3.4.5",
"apexcharts": "^3.48.0",
"apexcharts": "^4.0.0",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"chart.js": "^4.4.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cookie": "^0.6.0",
"date-fns": "^3.6.0",
"dayjs": "^1.11.13",
"dotenv": "^16.4.5",
"formidable": "^3.5.1",
"html2canvas": "^1.4.1",
"html2pdf.js": "^0.10.2",
"i18next": "^23.11.5",
"jest-mock-extended": "^3.0.7",
"jsonwebtoken": "^9.0.2",
Expand All @@ -50,14 +54,20 @@
"pusher": "^5.2.0",
"pusher-js": "^8.4.0-rc2",
"react": "^18.3.1",
"react-apexcharts": "^1.4.1",
"react-apexcharts": "^1.6.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1",
"react-hotkeys-hook": "^4.6.1",
"react-i18next": "^15.0.1",
"react-icons": "^5.0.1",
"react-markdown": "^9.0.1",
"react-pdf": "^9.1.0",
"react-to-pdf": "^1.0.1",
"react-to-print": "^3.0.2",
"react-toastify": "^10.0.5",
"react-usestateref": "^1.0.8",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
"rotating-file-stream": "^3.2.3",
"sharp": "^0.33.3",
"tailwind-merge": "^2.2.2",
Expand All @@ -83,7 +93,7 @@
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-next": "^14.2.5",
Expand Down
2 changes: 1 addition & 1 deletion prisma/migrations/2_beta_migrate/migration.sql
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ WHERE NOT EXISTS (SELECT 1 FROM certificate WHERE id = 555);

-- Insert a default counter_party for cases where counter_party_id is NULL
INSERT INTO counterparty (id, company_id, name, tax_id, type, note, created_at, updated_at)
SELECT 555 AS id, 555 AS company_id, 'N/A' AS name, 'N/A' AS tax_id, 'N/A' AS type, 'N/A' AS note, 0 AS created_at, 0 AS updated_at
SELECT 555 AS id, 555 AS company_id, 'N/A' AS name, 'N/A' AS tax_id, 'BOTH' AS type, 'N/A' AS note, 0 AS created_at, 0 AS updated_at
WHERE NOT EXISTS (SELECT 1 FROM counterparty WHERE id = 555);

ALTER TABLE "invoice"
Expand Down
134 changes: 134 additions & 0 deletions prisma/migrations/3_beta_modify/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
Warnings:
- You are about to drop the column `tag` on the `company` table. All the data in the column will be lost.
- The `monthsOfYear` column on the `event` table would be dropped and recreated. This will lead to data loss if there is data in the column.
- You are about to drop the column `last_login_at` on the `role` table. All the data in the column will be lost.
- Added the required column `image_id` to the `news` table without a default value. This is not possible if the table is not empty.
- Made the column `language` on table `user_setting` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "accounting_setting" ADD COLUMN "created_at" INTEGER NOT NULL DEFAULT 0,
ADD COLUMN "deleted_at" INTEGER,
ADD COLUMN "updated_at" INTEGER NOT NULL DEFAULT 0;

-- AlterTable
ALTER TABLE "admin" ADD COLUMN "order" INTEGER NOT NULL DEFAULT 1,
ADD COLUMN "tag" TEXT NOT NULL DEFAULT 'all';

-- Insert user 555 if not exists
INSERT INTO "user" (id, name, email, "image_File_id", created_at, updated_at )
SELECT 555, 'Default User', '[email protected]', 555, 1, 1
WHERE NOT EXISTS (SELECT 1 FROM "user" WHERE id = 555);

-- AlterTable
ALTER TABLE "certificate" ADD COLUMN "ai_result_id" TEXT NOT NULL DEFAULT '0',
ADD COLUMN "uploader_id" INTEGER NOT NULL DEFAULT 555;

ALTER TABLE "certificate"
ALTER COLUMN "uploader_id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "company" DROP COLUMN "tag";

-- AlterTable
ALTER TABLE "event" DROP COLUMN "monthsOfYear",
ADD COLUMN "monthsOfYear" INTEGER[];

-- AlterTable
ALTER TABLE "invoice" ADD COLUMN "name" TEXT NOT NULL DEFAULT 'Invoice 001';

-- AlterTable
ALTER TABLE "news" ADD COLUMN "image_id" INTEGER NOT NULL;

-- AlterTable
ALTER TABLE "role" DROP COLUMN "last_login_at",
ADD COLUMN "type" TEXT NOT NULL DEFAULT 'system';

-- AlterTable
ALTER TABLE "user_action_log" ADD COLUMN "created_at" INTEGER NOT NULL DEFAULT 0,
ADD COLUMN "deleted_at" INTEGER DEFAULT 0,
ADD COLUMN "updated_at" INTEGER NOT NULL DEFAULT 0;

-- AlterTable
ALTER TABLE "user_role" ADD COLUMN "last_login_at" INTEGER NOT NULL DEFAULT 0;

-- AlterTable
ALTER TABLE "user_setting" ALTER COLUMN "language" SET NOT NULL;

-- AlterTable
ALTER TABLE "voucher" ADD COLUMN "ai_result_id" TEXT NOT NULL DEFAULT '0';

-- CreateTable
CREATE TABLE "associate_line_item" (
"id" SERIAL NOT NULL,
"accociate_voucher_id" INTEGER NOT NULL,
"original_line_item_id" INTEGER NOT NULL,
"result_line_item_id" INTEGER NOT NULL,
"debit" BOOLEAN NOT NULL,
"amount" INTEGER NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"deleted_at" INTEGER,

CONSTRAINT "associate_line_item_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "todo" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"deadline" INTEGER NOT NULL,
"note" TEXT,
"status" BOOLEAN NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"deleted_at" INTEGER,

CONSTRAINT "todo_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "user_todo_company" (
"id" SERIAL NOT NULL,
"user_id" INTEGER NOT NULL,
"company_id" INTEGER NOT NULL,
"todo_id" INTEGER NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"deleted_at" INTEGER,

CONSTRAINT "user_todo_company_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "associate_line_item" ADD CONSTRAINT "associate_line_item_accociate_voucher_id_fkey" FOREIGN KEY ("accociate_voucher_id") REFERENCES "associate_voucher"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "associate_line_item" ADD CONSTRAINT "associate_line_item_original_line_item_id_fkey" FOREIGN KEY ("original_line_item_id") REFERENCES "line_item"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "associate_line_item" ADD CONSTRAINT "associate_line_item_result_line_item_id_fkey" FOREIGN KEY ("result_line_item_id") REFERENCES "line_item"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "certificate" ADD CONSTRAINT "certificate_uploader_id_fkey" FOREIGN KEY ("uploader_id") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "news" ADD CONSTRAINT "news_image_id_fkey" FOREIGN KEY ("image_id") REFERENCES "file"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "user_action_log" ADD CONSTRAINT "user_action_log_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "user_todo_company" ADD CONSTRAINT "user_todo_company_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "user_todo_company" ADD CONSTRAINT "user_todo_company_company_id_fkey" FOREIGN KEY ("company_id") REFERENCES "company"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "user_todo_company" ADD CONSTRAINT "user_todo_company_todo_id_fkey" FOREIGN KEY ("todo_id") REFERENCES "todo"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

ALTER SEQUENCE "associate_line_item_id_seq" RESTART WITH 10000000;
ALTER SEQUENCE "todo_id_seq" RESTART WITH 10000000;
ALTER SEQUENCE "user_todo_company_id_seq" RESTART WITH 10000000;
Loading

0 comments on commit e17a34f

Please sign in to comment.