Skip to content

Commit

Permalink
Add clients, services, and models.
Browse files Browse the repository at this point in the history
  • Loading branch information
muazhari committed Mar 17, 2023
1 parent bc9727f commit 7da1da4
Show file tree
Hide file tree
Showing 122 changed files with 2,430 additions and 540 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
APP_PORT=3000
APP_API_URL_BACKEND_1=http://pc-2:8000
NEXT_PUBLIC_API_URL_BACKEND_ONE=http://pc-3:8000/api/v1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/jpa-buddy.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/ventry-frontend.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

241 changes: 241 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ services:
- "${APP_PORT}:3000"
environment:
- CHOKIDAR_USEPOLLING=true
- APP_API_URL_BACKEND_1=${APP_API_URL_BACKEND_1}
- NEXT_PUBLIC_API_URL_BACKEND_ONE=${NEXT_PUBLIC_API_URL_BACKEND_ONE}
command:
- yarn dev -H 0.0.0.0 -p 3000
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
reactStrictMode: true
}

module.exports = nextConfig
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"axios": "^1.3.4",
"axios-case-converter": "^1.1.0",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"next": "13.2.4",
Expand Down
13 changes: 0 additions & 13 deletions src/apis/hello.ts

This file was deleted.

Empty file removed src/clients/BackendOneClient.ts
Empty file.
23 changes: 23 additions & 0 deletions src/clients/backend_one_client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import ClientSetting from "@/settings/client_setting";
import axios, {AxiosInstance} from "axios";
import applyCaseMiddleware from 'axios-case-converter';
import Client from "./client";

class BackendOneClient extends Client {
instance: AxiosInstance;

clientSetting: ClientSetting;


constructor() {
super();
this.clientSetting = new ClientSetting();
this.instance = axios.create({
baseURL: this.clientSetting.backendOneClientApiV1Url,
});
this.instance = applyCaseMiddleware(this.instance);
}

}

export default BackendOneClient;
13 changes: 13 additions & 0 deletions src/clients/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {AxiosInstance} from "axios";
import ClientSetting from "@/settings/client_setting";


abstract class Client {
abstract instance: AxiosInstance;

abstract clientSetting: ClientSetting;


}

export default Client;
26 changes: 26 additions & 0 deletions src/models/entities/account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Entity from "@/models/entities/entity";

class Account extends Entity {
id: string;
roleId: string;
name: string;
email: string;
password: string;
description: string;
createdAt: Date;
updatedAt: Date;

constructor(id: string, roleId: string, name: string, email: string, password: string, description: string, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.roleId = roleId;
this.name = name;
this.email = email;
this.password = password;
this.description = description;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default Account;
20 changes: 20 additions & 0 deletions src/models/entities/account_permission_map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Entity from "@/models/entities/entity";

class AccountPermissionMap extends Entity {
id: string;
accountId: string;
permissionId: string;
createdAt: Date;
updatedAt: Date;

constructor(id: string, accountId: string, permissionId: string, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.accountId = accountId;
this.permissionId = permissionId;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default AccountPermissionMap;
5 changes: 5 additions & 0 deletions src/models/entities/entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
abstract class Entity {

}

export default Entity;
24 changes: 24 additions & 0 deletions src/models/entities/file.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Entity from "@/models/entities/entity";

class File extends Entity {
id: string;
name: string;
description: string;
extension: string;
content: string;
createdAt: Date;
updatedAt: Date;

constructor(id: string, name: string, description: string, extension: string, content: string, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.name = name;
this.description = description;
this.extension = extension;
this.content = content;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default File;
26 changes: 26 additions & 0 deletions src/models/entities/inventory_control.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Entity from "@/models/entities/entity";

class InventoryControl extends Entity {
id: string;
accountId: string;
itemId: string;
quantityBefore: number;
quantityAfter: number;
timestamp: Date;
createdAt: Date;
updatedAt: Date;

constructor(id: string, accountId: string, itemId: string, quantityBefore: number, quantityAfter: number, timestamp: Date, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.accountId = accountId;
this.itemId = itemId;
this.quantityBefore = quantityBefore;
this.quantityAfter = quantityAfter;
this.timestamp = timestamp;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default InventoryControl;
37 changes: 37 additions & 0 deletions src/models/entities/item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Entity from "@/models/entities/entity";

class Item extends Entity {
id: string;
permissionId: string;
code: string;
name: string;
description: string;
combinationMaxQuantity: number;
combinationMinQuantity: number;
quantity: number;
unitName: string;
unitSellPrice: number;
unitCostPrice: number;
createdAt: Date;
updatedAt: Date;

constructor(id: string, permissionId: string, code: string, name: string, description: string, combinationMaxQuantity: number, combinationMinQuantity: number, quantity: number, unitName: string, unitSellPrice: number, unitCostPrice: number, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.permissionId = permissionId;
this.code = code;
this.name = name;
this.description = description;
this.combinationMaxQuantity = combinationMaxQuantity;
this.combinationMinQuantity = combinationMinQuantity;
this.quantity = quantity;
this.unitName = unitName;
this.unitSellPrice = unitSellPrice;
this.unitCostPrice = unitCostPrice;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}

}

export default Item;
20 changes: 20 additions & 0 deletions src/models/entities/item_combination_map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Entity from "@/models/entities/entity";

class ItemCombinationMap extends Entity {
id: string;
superItemId: string;
subItemId: string;
createdAt: Date;
updatedAt: Date;

constructor(id: string, superItemId: string, subItemId: string, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.superItemId = superItemId;
this.subItemId = subItemId;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default ItemCombinationMap;
20 changes: 20 additions & 0 deletions src/models/entities/item_file_map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Entity from "@/models/entities/entity";

class ItemFileMap extends Entity {
id: string;
itemId: string;
fileId: string;
createdAt: Date;
updatedAt: Date;

constructor(id: string, itemId: string, fileId: string, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.itemId = itemId;
this.fileId = fileId;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default ItemFileMap;
20 changes: 20 additions & 0 deletions src/models/entities/permission.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Entity from "@/models/entities/entity";

class Permission extends Entity {
id: string;
name: string;
description: string;
createdAt: Date;
updatedAt: Date;

constructor(id: string, name: string, description: string, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.name = name;
this.description = description;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default Permission;
20 changes: 20 additions & 0 deletions src/models/entities/role.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Entity from "@/models/entities/entity";

class Role extends Entity {
id: string;
name: string;
description: string;
createdAt: Date;
updatedAt: Date;

constructor(id: string, name: string, description: string, createdAt: Date, updatedAt: Date) {
super();
this.id = id;
this.name = name;
this.description = description;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

export default Role;
Loading

0 comments on commit 7da1da4

Please sign in to comment.