From beb36a4db426b23bfa9d2edc21b3239e6b8732e5 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Apr 2023 18:42:27 +0400 Subject: [PATCH] added models --- .../subd/Controllers/DriverController.java | 4 +- .../subd/Controllers/OrderController.java | 4 +- .../java/com/subd/subd/Dtos/OrderDto.java | 7 +- .../java/com/subd/subd/Models/Driver.java | 17 +-- .../main/java/com/subd/subd/Models/Order.java | 14 ++- .../com/subd/subd/Services/DriverService.java | 11 +- .../com/subd/subd/Services/OrderService.java | 9 +- SUBD-front/main.js | 30 ++++++ SUBD-front/src/App.vue | 8 +- .../src/components/CatalogDisciplines.vue | 44 ++++++++ SUBD-front/src/components/CatalogGroups.vue | 44 ++++++++ SUBD-front/src/components/CatalogStudents.vue | 82 +++++++++++++++ SUBD-front/src/components/Catalogs.vue | 23 ++++ SUBD-front/src/components/DataTable.vue | 67 ++++++++++++ SUBD-front/src/components/Header.vue | 64 +++++------ SUBD-front/src/components/Modal.vue | 63 +++++++++++ .../src/components/ReportGroupDisciplines.vue | 60 +++++++++++ .../src/components/ReportGroupStudents.vue | 64 +++++++++++ SUBD-front/src/components/Reports.vue | 21 ++++ SUBD-front/src/components/ToolBar.vue | 46 ++++++++ SUBD-front/src/images/hamburger.png | Bin 7699 -> 0 bytes SUBD-front/src/main.js | 25 ----- SUBD-front/src/mixins/CatalogMixins.js | 99 ++++++++++++++++++ SUBD-front/src/models/Car.js | 47 +++++++++ SUBD-front/src/models/Client.js | 45 ++++++++ SUBD-front/src/models/Driver.js | 54 ++++++++++ SUBD-front/src/models/Order.js | 86 +++++++++++++++ SUBD-front/src/models/PickUpPoint.js | 21 ++++ SUBD-front/src/services/DataService.js | 8 +- SUBD-front/style.css | 0 30 files changed, 977 insertions(+), 90 deletions(-) create mode 100644 SUBD-front/main.js create mode 100644 SUBD-front/src/components/CatalogDisciplines.vue create mode 100644 SUBD-front/src/components/CatalogGroups.vue create mode 100644 SUBD-front/src/components/CatalogStudents.vue create mode 100644 SUBD-front/src/components/Catalogs.vue create mode 100644 SUBD-front/src/components/DataTable.vue create mode 100644 SUBD-front/src/components/Modal.vue create mode 100644 SUBD-front/src/components/ReportGroupDisciplines.vue create mode 100644 SUBD-front/src/components/ReportGroupStudents.vue create mode 100644 SUBD-front/src/components/Reports.vue create mode 100644 SUBD-front/src/components/ToolBar.vue delete mode 100644 SUBD-front/src/images/hamburger.png delete mode 100644 SUBD-front/src/main.js create mode 100644 SUBD-front/src/mixins/CatalogMixins.js create mode 100644 SUBD-front/src/models/Car.js create mode 100644 SUBD-front/src/models/Client.js create mode 100644 SUBD-front/src/models/Driver.js create mode 100644 SUBD-front/src/models/Order.js create mode 100644 SUBD-front/src/models/PickUpPoint.js create mode 100644 SUBD-front/style.css diff --git a/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java b/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java index 945fa8c..63a6d19 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java +++ b/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java @@ -22,11 +22,11 @@ public class DriverController { } @PostMapping("/driver") public Driver createDriver(@RequestBody Driver driver) { - return DriverService.addDriver(driver.getName(), driver.getAge(), driver.getPhone(), driver.getEmail()); + return DriverService.addDriver(driver.getName(), driver.getBirthday(), driver.getPhone(), driver.getEmail()); } @PutMapping("/driver/{id}") public Driver updateDriver(@PathVariable Long id, @RequestBody Driver driver) { - return DriverService.updateDriver(id, driver.getName(), driver.getAge(), driver.getPhone(), driver.getEmail()); + return DriverService.updateDriver(id, driver.getName(), driver.getBirthday(), driver.getPhone(), driver.getEmail()); } @DeleteMapping("/driver/{id}") public Driver deleteDriver(@PathVariable Long id) { diff --git a/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java b/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java index 5586956..ae044eb 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java +++ b/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java @@ -23,11 +23,11 @@ public class OrderController { } @PostMapping("/order") public Order createOrder(@RequestBody OrderDto orderDto) { - return OrderService.addOrder(orderDto.getValue(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); + return OrderService.addOrder(orderDto.getValue(), orderDto.getStatus(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); } @PutMapping("/order/{id}") public Order updateOrder(@PathVariable Long id, @RequestBody OrderDto orderDto) { - return OrderService.updateOrder(id, orderDto.getValue(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); + return OrderService.updateOrder(id, orderDto.getValue(), orderDto.getStatus(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); } @DeleteMapping("/order/{id}") public Order deleteOrder(@PathVariable Long id) { diff --git a/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java b/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java index f84bae5..ebccfd3 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java +++ b/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java @@ -2,13 +2,15 @@ package com.subd.subd.Dtos; public class OrderDto { private Double value; + private String status; private Long clientId; private Long sourcePickUpPointId; private Long destPickUpPointId; private Long carId; public OrderDto() {} - public OrderDto(Double value, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { + public OrderDto(Double value, String status, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { this.value = value; + this.status = status; this.clientId = clientId; this.sourcePickUpPointId = sourcePickUpPointId; this.destPickUpPointId = destPickUpPointId; @@ -17,6 +19,9 @@ public class OrderDto { public Double getValue() { return this.value; } + public String getStatus() { + return this.status; + } public Long getClientId() { return this.clientId; } diff --git a/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java b/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java index 6d56399..6090a15 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java +++ b/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java @@ -5,6 +5,7 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.Table; +import java.util.Date; import java.util.Objects; @Entity @@ -14,13 +15,13 @@ public class Driver { @GeneratedValue private Long id; private String name; - private Integer age; + private Date birthday; private String phone; private String email; Driver() {} - public Driver(String name, Integer age, String phone, String email) { + public Driver(String name, Date birthday, String phone, String email) { this.name = name; - this.age = age; + this.birthday = birthday; this.phone = phone; this.email = email; } @@ -28,8 +29,8 @@ public class Driver { public void setId(Long id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } - public Integer getAge() { return this.age; } - public void setAge(Integer age) { this.age = age; } + public Date getBirthday() { return this.birthday; } + public void setBirthday(Date birthday) { this.birthday = birthday; } public String getPhone() { return this.phone; } public void setPhone(String phone) { this.phone = phone; } public String getEmail() { return this.email; } @@ -43,19 +44,19 @@ public class Driver { Driver driver = (Driver) o; return Objects.equals(this.id, driver.id) && Objects.equals(this.name, driver.name) && - Objects.equals(this.age, driver.age) && + Objects.equals(this.birthday, driver.birthday) && Objects.equals(this.phone, driver.phone) && Objects.equals(this.email, driver.email); } @Override public int hashCode() { - return Objects.hash(this.id, this.name, this.age, this.phone, this.email); + return Objects.hash(this.id, this.name, this.birthday, this.phone, this.email); } @Override public String toString() { return "Client{" + "id=" + this.id + ", name='" + this.name + '\'' + - ", age='" + this.age + '\'' + + ", birthday='" + this.birthday + '\'' + ", phone='" + this.phone + '\'' + ", email='" + this.email + '\'' + '}'; diff --git a/SUBD-back/src/main/java/com/subd/subd/Models/Order.java b/SUBD-back/src/main/java/com/subd/subd/Models/Order.java index 9aa34eb..65abd22 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Models/Order.java +++ b/SUBD-back/src/main/java/com/subd/subd/Models/Order.java @@ -11,6 +11,7 @@ public class Order { @GeneratedValue private Long id; private Double value; + private String status; @ManyToOne( cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER) @JoinColumn(name = "Client_id", nullable = true) private Client client; @@ -24,8 +25,9 @@ public class Order { @JoinColumn(name = "Car_id", referencedColumnName = "id") private Car car; Order() {} - public Order(Double value, Client client, PickUpPoint sourcePickUpPoint, PickUpPoint destPickUpPoint, Car car) { + public Order(Double value, String status, Client client, PickUpPoint sourcePickUpPoint, PickUpPoint destPickUpPoint, Car car) { this.value = value; + this.status = status; this.client = client; this.sourcePickUpPoint = sourcePickUpPoint; this.destPickUpPoint = destPickUpPoint; @@ -43,6 +45,12 @@ public class Order { public void setValue(Double value) { this.value = value; } + public String getStatus() { + return this.status; + } + public void setStatus(String status) { + this.status = status; + } public Client getClient() { return client; } @@ -81,6 +89,7 @@ public class Order { Order order = (Order) o; return Objects.equals(this.id, order.id) && Objects.equals(this.value, order.value) && + Objects.equals(this.status, order.status) && Objects.equals(this.client, order.client) && Objects.equals(this.sourcePickUpPoint, order.sourcePickUpPoint) && Objects.equals(this.destPickUpPoint, order.destPickUpPoint) && @@ -88,12 +97,13 @@ public class Order { } @Override public int hashCode() { - return Objects.hash(this.id, this.value, this.client, this.sourcePickUpPoint, destPickUpPoint, car); + return Objects.hash(this.id, this.value, this.status, this.client, this.sourcePickUpPoint, destPickUpPoint, car); } @Override public String toString() { return "Client{" + "id=" + this.id + ", value='" + this.value + '\'' + + ", status='" + this.status + '\'' + ", client='" + this.client + '\'' + ", sourcePickUpPoint='" + this.sourcePickUpPoint + '\'' + ", destPickUpPoint='" + this.destPickUpPoint + '\'' + diff --git a/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java b/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java index eb6933f..0cfbf8d 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java +++ b/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java @@ -6,6 +6,7 @@ import com.subd.subd.Repositories.DriverRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Date; import java.util.List; import java.util.Optional; @@ -16,8 +17,8 @@ public class DriverService { this.driverRepository = driverRepository; } @Transactional - public Driver addDriver(String name, Integer age, String phone, String email) { - final Driver driver = new Driver(name, age, phone, email); + public Driver addDriver(String name, Date birthday, String phone, String email) { + final Driver driver = new Driver(name, birthday, phone, email); return driverRepository.save(driver); } @Transactional(readOnly = true) @@ -30,13 +31,13 @@ public class DriverService { return driverRepository.findAll(); } @Transactional - public Driver updateDriver(Long id, String name, Integer age, String phone, String email) { + public Driver updateDriver(Long id, String name, Date birthday, String phone, String email) { final Driver currentDriver = findDriver(id); if (name != null) { currentDriver.setName(name); } - if (age != null) { - currentDriver.setAge(age); + if (birthday != null) { + currentDriver.setBirthday(birthday); } if (phone != null) { currentDriver.setPhone(phone); diff --git a/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java b/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java index cef05bd..633c670 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java +++ b/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java @@ -31,7 +31,7 @@ public class OrderService { this.carRepository = carRepository; } @Transactional - public Order addOrder(Double value, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { + public Order addOrder(Double value, String status, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { final Client client = clientRepository.findById(clientId) .orElseThrow(() -> new ClientNotFoundException(clientId)); final PickUpPoint sourcePickUpPoint = pickUpPointRepository.findById(sourcePickUpPointId) @@ -40,7 +40,7 @@ public class OrderService { .orElseThrow(() -> new PickUpPointNotFoundException(destPickUpPointId)); final Car car = carRepository.findById(carId) .orElseThrow(() -> new CarNotFoundException(carId)); - final Order order = new Order(value, client, sourcePickUpPoint, destPickUpPoint, car); + final Order order = new Order(value, status, client, sourcePickUpPoint, destPickUpPoint, car); return orderRepository.save(order); } @Transactional(readOnly = true) @@ -53,11 +53,14 @@ public class OrderService { return orderRepository.findAll(); } @Transactional - public Order updateOrder(Long id, Double value, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { + public Order updateOrder(Long id, Double value, String status, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { final Order currentOrder = findOrder(id); if (value != null) { currentOrder.setValue(value); } + if (status != null) { + currentOrder.setStatus(status); + } if (clientId != null) { final Client client = clientRepository.findById(clientId) .orElseThrow(() -> new ClientNotFoundException(clientId)); diff --git a/SUBD-front/main.js b/SUBD-front/main.js new file mode 100644 index 0000000..7baf981 --- /dev/null +++ b/SUBD-front/main.js @@ -0,0 +1,30 @@ +import { createApp } from 'vue' +import { createRouter, createWebHistory } from 'vue-router' +import './style.css' +import App from './App.vue' +import Catalogs from './components/Catalogs.vue' +import CatalogStudents from './components/CatalogStudents.vue' +import CatalogGroups from './components/CatalogGroups.vue' +import CatalogDisciplines from './components/CatalogDisciplines.vue' +import Reports from './components/Reports.vue' +import ReportGroupStudents from './components/ReportGroupStudents.vue' +import ReportGroupDisciplines from './components/ReportGroupDisciplines.vue' + +const routes = [ + { path: '/', redirect: '/catalogs/students' }, + { path: '/catalogs', component: Catalogs, meta: { label: 'Справочники' } }, + { path: '/catalogs/students', component: CatalogStudents }, + { path: '/catalogs/groups', component: CatalogGroups }, + { path: '/catalogs/disciplines', component: CatalogDisciplines }, + { path: '/reports', component: Reports, meta: { label: 'Отчеты' } }, + { path: '/reports/group-students', component: ReportGroupStudents }, + { path: '/reports/group-disciplines', component: ReportGroupDisciplines } +] + +const router = createRouter({ + history: createWebHistory(), + linkActiveClass: 'active', + routes +}) + +createApp(App).use(router).mount('#app') \ No newline at end of file diff --git a/SUBD-front/src/App.vue b/SUBD-front/src/App.vue index 7cb90de..406f563 100644 --- a/SUBD-front/src/App.vue +++ b/SUBD-front/src/App.vue @@ -1,5 +1,6 @@ + + \ No newline at end of file diff --git a/SUBD-front/src/components/CatalogGroups.vue b/SUBD-front/src/components/CatalogGroups.vue new file mode 100644 index 0000000..b7ac5ac --- /dev/null +++ b/SUBD-front/src/components/CatalogGroups.vue @@ -0,0 +1,44 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/CatalogStudents.vue b/SUBD-front/src/components/CatalogStudents.vue new file mode 100644 index 0000000..2a8aad0 --- /dev/null +++ b/SUBD-front/src/components/CatalogStudents.vue @@ -0,0 +1,82 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Catalogs.vue b/SUBD-front/src/components/Catalogs.vue new file mode 100644 index 0000000..8480eb4 --- /dev/null +++ b/SUBD-front/src/components/Catalogs.vue @@ -0,0 +1,23 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/DataTable.vue b/SUBD-front/src/components/DataTable.vue new file mode 100644 index 0000000..f24eb88 --- /dev/null +++ b/SUBD-front/src/components/DataTable.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Header.vue b/SUBD-front/src/components/Header.vue index 0067085..162c8d6 100644 --- a/SUBD-front/src/components/Header.vue +++ b/SUBD-front/src/components/Header.vue @@ -1,45 +1,35 @@ + + \ No newline at end of file + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Modal.vue b/SUBD-front/src/components/Modal.vue new file mode 100644 index 0000000..f12c004 --- /dev/null +++ b/SUBD-front/src/components/Modal.vue @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/SUBD-front/src/components/ReportGroupDisciplines.vue b/SUBD-front/src/components/ReportGroupDisciplines.vue new file mode 100644 index 0000000..2d87fe6 --- /dev/null +++ b/SUBD-front/src/components/ReportGroupDisciplines.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/ReportGroupStudents.vue b/SUBD-front/src/components/ReportGroupStudents.vue new file mode 100644 index 0000000..82ebd6c --- /dev/null +++ b/SUBD-front/src/components/ReportGroupStudents.vue @@ -0,0 +1,64 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Reports.vue b/SUBD-front/src/components/Reports.vue new file mode 100644 index 0000000..56cfe60 --- /dev/null +++ b/SUBD-front/src/components/Reports.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/ToolBar.vue b/SUBD-front/src/components/ToolBar.vue new file mode 100644 index 0000000..0a21290 --- /dev/null +++ b/SUBD-front/src/components/ToolBar.vue @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/SUBD-front/src/images/hamburger.png b/SUBD-front/src/images/hamburger.png deleted file mode 100644 index c847f227bc4f305ecfa1a593927dbf77eb0a3cb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7699 zcmeHKc{tQ<_a9r9k|mX;GDehTHv5bv`fm~Nyd^wWiMn)q>_CPDJ7I8 zBui4+QbeJw@%y5ur{{X#-}QT+>-xR_J#$@if6w>6&-vWve9pP=>w6;2O!PQ81UWz; z5T}8@wgm{pzz4{6Y&(FlM&H~71lqY4U}ZzKz|g>6-edyN0}rP9d*Q)&KOzAH@*8YV zCB}~ybDrOr=R+~lVw>OFCJBu#Eraju5A?`WO*hO{t;EGa9xbYaIt9ztzjcz;he6w)o%~%beQpCJ_Yu{zzz9JztR*$q? zGE`)_dqX*4UF;sVv^WL00z%gDcYxy?iy)T!F zdpM;sU1%N^?sq0K3MPwS?{|-_`JeTBQ@xO!#I!<|ZT3!IemzA((QK&~9z0mgzze$* z_Cg6+9evqqSN+nuie%55IPAKGm#W*N)$;Xj9mi=^uk*wUpX(y>J03st?K18g@|{xJ zt%yLb;8pDXXD@IyH!;$Bx%w$y&Cf}21WGGp?97WpVH@R52YalQ+mLpciI0{&?)e3%zdsd8o!ssa%5b_<%IXQ z{L)kHo*Z-tnzL81Ka%`Nn*+r*RNM!adK$i=FTG@DB+`^2q$C!OpQ84nCfxl~s3*URLk4SX8d+ls|m zblkFh>V$xO=TyrOtmo? zcJuT^V#%?U@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V&9b%B?Q#S)?FmP`_m|4INix$v)%qe_$JdzXCP zITs`~H70d5o3ZWblUAk!v^g7zhtud~0X__au4Xq!)NRn4 { + this.items = data; + }); + }, + showAddModal() { + this.isEdit = false; + this.data = this.transformer(); + this.modal.header = 'Добавление элемента'; + this.modal.confirm = 'Добавить'; + this.modalShow = true; + }, + showEditModal() { + if (this.selectedItems.length === 0) { + return; + } + this.showEditModalDblClick(this.selectedItems[0]); + }, + showEditModalDblClick(editId) { + DataService.read(this.dataUrl + editId, this.transformer) + .then(data => { + this.data = data; + this.isEdit = true; + this.modal.header = 'Редактирование элемента'; + this.modal.confirm = 'Сохранить'; + this.modalShow = true; + }); + }, + saveItem() { + if (!this.isEdit) { + DataService.create(this.dataUrl, this.data) + .then(() => { + this.getItems(); + }); + } else { + DataService.update(this.dataUrl + this.data.id, this.data) + .then(() => { + this.getItems(); + }); + } + }, + removeSelectedItems() { + if (this.selectedItems.length === 0) { + return; + } + if (confirm('Удалить выбранные элементы?')) { + const promises = []; + const self = this; + this.selectedItems.forEach(item => { + promises.push(DataService.delete(this.dataUrl + item)); + }); + Promise.all(promises).then((results) => { + results.forEach(function (id) { + const index = self.selectedItems.indexOf(id); + if (index === - 1) { + return; + } + self.selectedItems.splice(index, 1); + }); + this.getItems(); + }); + } + } + } +} + +export default CatalogMixin; \ No newline at end of file diff --git a/SUBD-front/src/models/Car.js b/SUBD-front/src/models/Car.js new file mode 100644 index 0000000..dc56858 --- /dev/null +++ b/SUBD-front/src/models/Car.js @@ -0,0 +1,47 @@ +export default class Car { + constructor(data) { + this._id = data?.id; + this._gosNumber = data?.gosNumber; + this._vin = data?.vin; + this._driver = data?.driver; + this._driverId = data?.driverId; + } + + get id() { + return this._id; + } + + get gosNumber() { + return this._gosNumber; + } + + set gosNumber(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New gosNumber value ' + value + ' is not a string or empty'; + } + this._gosNumber = value; + } + + get vin() { + return this._vin; + } + + set vin(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New vin value ' + value + ' is not a string or empty'; + } + this._vin = value; + } + + get driverId() { + return this._groupId; + } + + set driverId(value) { + this._groupId = value; + } + + get driverName() { + return this.driver?.name; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/Client.js b/SUBD-front/src/models/Client.js new file mode 100644 index 0000000..86f54b9 --- /dev/null +++ b/SUBD-front/src/models/Client.js @@ -0,0 +1,45 @@ +export default class Student { + constructor(data) { + this._id = data?.id; + this._name = data?.name; + this._phone = data?.phone; + this._email = data?.email; + } + + get id() { + return this._id; + } + + get name() { + return this._name; + } + + set name(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New name value ' + value + ' is not a string or empty'; + } + this._name = value; + } + + get phone() { + return this._phone; + } + + set phone(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New phone value ' + value + ' is not a string or empty'; + } + this._phone = value; + } + + get email() { + return this._email; + } + + set email(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New email value ' + value + ' is not a string or empty'; + } + this._email = value; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/Driver.js b/SUBD-front/src/models/Driver.js new file mode 100644 index 0000000..43727d1 --- /dev/null +++ b/SUBD-front/src/models/Driver.js @@ -0,0 +1,54 @@ +export default class Driver { + constructor(data) { + this._id = data?.id; + this._name = data?.name; + this._birthday = data?.birthday; + this._phone = data?.phone; + this._email = data?.email; + } + + get id() { + return this._id; + } + + get name() { + return this._name; + } + + set name(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New name value ' + value + ' is not a string or empty'; + } + this._name = value; + } + + get birthday() { + return this._age; + } + + set birthday(value) { + this._birthday = value; + } + + get phone() { + return this._phone; + } + + set phone(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New phone value ' + value + ' is not a string or empty'; + } + this._phone = value; + } + + get email() { + return this._email; + } + + set email(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New email value ' + value + ' is not a string or empty'; + } + this._email = value; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/Order.js b/SUBD-front/src/models/Order.js new file mode 100644 index 0000000..ca906a9 --- /dev/null +++ b/SUBD-front/src/models/Order.js @@ -0,0 +1,86 @@ +export default class Order { + constructor(data) { + this._id = data?.id; + this._value = data?.value; + this._status = data?.status; + this._client = data?.client; + this._clientId = data?.clientId; + this._sourcePickUpPoint = data?.sourcePickUpPoint; + this._sourcePickUpPointId = data?.sourcePickUpPointId; + this._destPickUpPoint = data?.destPickUpPoint; + this._destPickUpPointId = data?.destPickUpPointId; + this._car = data?.car; + this._carId = data?.carId; + } + + get id() { + return this._id; + } + + get value() { + return this._value; + } + + set value(data) { + this._value = data; + } + + get status() { + return this._status; + } + + set status(data) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New status value ' + value + ' is not a string or empty'; + } + this._status = data; + } + + get clientId() { + return this._firstName; + } + + set clientId(value) { + this._clientId = value; + } + + get clientName() { + return this._client?.name; + } + + get sourcePickUpPointId() { + return this._sourcePickUpPointId; + } + + set sourcePickUpPointId(value) { + this._sourcePickUpPointId = value; + } + + get sourcePickUpPointAddress() { + return this._sourcePickUpPoint?.address; + } + + get destPickUpPointId() { + return this._destPickUpPointId; + } + + set destPickUpPointId(value) { + this._destPickUpPointId = value; + } + + get destPickUpPointAddress() { + return this._destPickUpPoint?.address; + } + + get carId() { + return this._carId; + } + + set carId(value) { + this._carId = value; + } + + get carNumber() { + return this.car?.gosNumber; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/PickUpPoint.js b/SUBD-front/src/models/PickUpPoint.js new file mode 100644 index 0000000..652ddeb --- /dev/null +++ b/SUBD-front/src/models/PickUpPoint.js @@ -0,0 +1,21 @@ +export default class PickUpPoint { + constructor(data) { + this._id = data?.id; + this._address = data?.address; + } + + get id() { + return this._id; + } + + get address() { + return this._address; + } + + set address(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New address value ' + value + ' is not a string or empty'; + } + this._address = value; + } +} \ No newline at end of file diff --git a/SUBD-front/src/services/DataService.js b/SUBD-front/src/services/DataService.js index a06314a..54810c9 100644 --- a/SUBD-front/src/services/DataService.js +++ b/SUBD-front/src/services/DataService.js @@ -7,22 +7,22 @@ function toJSON(data) { if (data[field] === undefined) { continue; } - jsonObj[field.substring(0)] = data[field]; + jsonObj[field.substring(1)] = data[field]; } return jsonObj; } export default class DataService { - static dataUrlPrefix = 'http://127.0.0.1:8080/'; + static dataUrlPrefix = 'http://localhost:8080/'; static async readAll(url, transformer) { const response = await axios.get(this.dataUrlPrefix + url); return response.data.map(item => transformer(item)); } - static async read(url) { + static async read(url, transformer) { const response = await axios.get(this.dataUrlPrefix + url); - return response.data; + return transformer(response.data); } static async create(url, data) { diff --git a/SUBD-front/style.css b/SUBD-front/style.css new file mode 100644 index 0000000..e69de29