Skip to content

Commit

Permalink
Create frontend functionalities for Provider entity
Browse files Browse the repository at this point in the history
  • Loading branch information
tuongtran23 authored and ElviraMjeshtri committed Sep 1, 2023
1 parent 9e85268 commit fec2cc7
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ResponseEntity<ProviderDto> getProvider(@PathVariable Integer id) {
@GetMapping
public ResponseEntity<PageProviderDto> getProviders(
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "3") int size
@RequestParam(defaultValue = "6") int size
) {
Pageable pageable = PageRequest.of(page, size);
PageProviderDto pageProviders = pageProviderDtoMapper.toPageDto(providerService.findAll(pageable));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ResponseEntity<UserDto> getUser(@PathVariable Integer id) {
@GetMapping
public ResponseEntity<PageUserDto> getUsers(
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "7") int size
@RequestParam(defaultValue = "6") int size
) {
Pageable pageable = PageRequest.of(page, size);
PageUserDto pageUsers = pageUserDtoMapper.toPageDto(userService.findAll(pageable));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Provider save(Provider providerToSave) {
}
@Transactional
public void updateTransaction(Provider provider) {
providerService.update(provider, authenticationFacade.getLoggedInUserId());
providerService.update(provider);
}
public void update(Provider providerToUpdate) {
updateTransaction(providerToUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ public Provider save(Provider provider, Integer userId) {
return providerRepository.save(provider);
}

public void update(Provider provider, Integer userId) {
ZonedDateTime createdAt = ZonedDateTime.now(clock);
provider.setCreatedAt(createdAt);
provider.setCreatedBy(userId);
public void update(Provider provider) {
providerRepository.update(provider);
}

Expand Down
2 changes: 1 addition & 1 deletion hla-product-ordering/frontend/src/User.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Wrap, WrapItem, Spinner, Text} from '@chakra-ui/react';
import SidebarWithHeader from "./components/shared/sidebar.jsx";
import {useEffect, useState} from "react";
import {getUsers} from "./services/user.js";
import CardWithImage from "./components/user/card.jsx";
import CardWithImage from "./components/user/userCard.jsx";
import CreateUserDrawer from "./components/user/CreateUserDrawer.jsx";
import {errorNotification} from "./services/notification.js";

Expand Down
13 changes: 2 additions & 11 deletions hla-product-ordering/frontend/src/services/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export const getProviders = async () => {
export const saveProvider = async (provider) => {
try {
return await axios.post(`${import.meta.env.VITE_API_BASE_URL}/api/v1/providers`,
provider)
provider,
getAuthConfig())
} catch (e) {
throw e;
}
Expand All @@ -44,14 +45,4 @@ export const deleteProvider = async (id) => {
} catch (e) {
throw e;
}
}

export const login = async (providernameAndPassword) => {
try {
return await axios.post(`${import.meta.env.VITE_API_BASE_URL}/api/v1/auth/login`,
providernameAndPassword
)
} catch (e) {
throw e;
}
}

0 comments on commit fec2cc7

Please sign in to comment.