summaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/accounts/index.ts19
-rw-r--r--src/services/index.ts2
-rw-r--r--src/services/types.ts6
3 files changed, 27 insertions, 0 deletions
diff --git a/src/services/accounts/index.ts b/src/services/accounts/index.ts
new file mode 100644
index 0000000..fc3a830
--- /dev/null
+++ b/src/services/accounts/index.ts
@@ -0,0 +1,19 @@
+import { ServiceParams } from '../../lib/ServiceContext';
+import { Account } from '../types';
+
+const service: ServiceParams<Account> = {
+ route: 'accounts',
+ name: 'Счета',
+ nameSingular: 'Счёт',
+ tableFields: [
+ { key: 'name', label: 'Название' },
+ { key: 'balance', label: 'Баланс' },
+ ],
+ searchBy: ['name'],
+ default: {
+ name: '',
+ balance: 0,
+ },
+};
+
+export default service;
diff --git a/src/services/index.ts b/src/services/index.ts
index 2b0b17b..df2305c 100644
--- a/src/services/index.ts
+++ b/src/services/index.ts
@@ -1,3 +1,4 @@
+import accounts from './accounts';
import contractors from './contractors';
import waybills from './waybills';
import transfers from './transfers';
@@ -9,6 +10,7 @@ const services = [
products,
waybills,
transfers,
+ accounts,
];
services.forEach(service => registerServiceHooks(service.route));
diff --git a/src/services/types.ts b/src/services/types.ts
index e6e01db..6fa5f30 100644
--- a/src/services/types.ts
+++ b/src/services/types.ts
@@ -4,6 +4,12 @@ interface BaseModel {
updatedAt: string;
}
+export interface Account extends BaseModel {
+ name: string;
+ code: string;
+ balance: number;
+}
+
export interface Contractor extends BaseModel {
name: string;
vatId: string;