First version
parent
9a7c492a33
commit
6d4416ab9a
@ -0,0 +1 @@
|
|||||||
|
REACT_APP_DRC_API_HOST=https://drc-pkh.pkhtech.buzz
|
||||||
@ -0,0 +1 @@
|
|||||||
|
REACT_APP_DRC_API_HOST= #https://drc-planning-department-service
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
.eslintcache
|
||||||
|
src/template
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['react-app', 'react-app/jest', 'prettier'],
|
||||||
|
plugins: ['import', 'react', 'prettier'],
|
||||||
|
rules: {
|
||||||
|
curly: 1,
|
||||||
|
'eol-last': 1,
|
||||||
|
eqeqeq: 1,
|
||||||
|
'import/order': [
|
||||||
|
1,
|
||||||
|
{
|
||||||
|
alphabetize: {
|
||||||
|
caseInsensitive: true,
|
||||||
|
order: 'asc',
|
||||||
|
},
|
||||||
|
groups: ['builtin', 'external', 'index', 'sibling', 'parent', 'internal'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
indent: [1, 2, { SwitchCase: 1, offsetTernaryExpressions: true }],
|
||||||
|
'no-console': 1,
|
||||||
|
'no-dupe-keys': 0,
|
||||||
|
'no-else-return': 1,
|
||||||
|
'no-empty-function': 1,
|
||||||
|
'no-extra-semi': 2,
|
||||||
|
'no-unreachable': 1,
|
||||||
|
'no-unused-vars': 0,
|
||||||
|
'@typescript-eslint/no-unused-vars': 1,
|
||||||
|
'prettier/prettier': [
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
endOfLine: 'auto',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: 'detect',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
# ---> Node
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional stylelint cache
|
||||||
|
.stylelintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variable files
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# React build output
|
||||||
|
build
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# vuepress v2.x temp and cache directory
|
||||||
|
.temp
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# Docusaurus cache and generated files
|
||||||
|
.docusaurus
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
20.15.0
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
legacy-peer-deps=true
|
||||||
|
auto-install-peers=true
|
||||||
|
strict-peer-dependencies=false
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 120,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"bracketSameLine": true,
|
||||||
|
"htmlWhitespaceSensitivity": "ignore",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"trailingComma": "all"
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,26 @@
|
|||||||
|
import { defineConfig } from 'orval';
|
||||||
|
|
||||||
|
const apiDirPath = 'src/main/apis';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
drcApi: {
|
||||||
|
output: {
|
||||||
|
mode: 'tags-split',
|
||||||
|
target: `${apiDirPath}/drc/endpoints`,
|
||||||
|
schemas: `${apiDirPath}/drc/models`,
|
||||||
|
client: 'react-query',
|
||||||
|
clean: true,
|
||||||
|
mock: true,
|
||||||
|
prettier: true,
|
||||||
|
override: {
|
||||||
|
mutator: {
|
||||||
|
path: `${apiDirPath}/configs/mutator/drc-instance.ts`,
|
||||||
|
name: 'drcInstance',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
target: './drc-openapi.json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,138 @@
|
|||||||
|
{
|
||||||
|
"name": "drc-planning-department-app",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-free": "6.5.1",
|
||||||
|
"@fullcalendar/core": "6.1.10",
|
||||||
|
"@fullcalendar/daygrid": "6.1.10",
|
||||||
|
"@fullcalendar/interaction": "6.1.10",
|
||||||
|
"@reduxjs/toolkit": "^2.2.6",
|
||||||
|
"@tanstack/react-query": "^5.49.2",
|
||||||
|
"@testing-library/jest-dom": "^6.4.6",
|
||||||
|
"@testing-library/react": "^16.0.0",
|
||||||
|
"@testing-library/user-event": "^14.5.2",
|
||||||
|
"@types/jest": "^29.5.12",
|
||||||
|
"@types/node": "^20.14.9",
|
||||||
|
"@types/react": "^18.3.3",
|
||||||
|
"@types/react-dom": "^18.3.0",
|
||||||
|
"axios": "^1.7.2",
|
||||||
|
"bootstrap": "4.6.2",
|
||||||
|
"chart.js": "2.9.4",
|
||||||
|
"classnames": "2.3.2",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
|
"dropzone": "5.9.3",
|
||||||
|
"formik": "^2.4.6",
|
||||||
|
"husky": "^9.0.11",
|
||||||
|
"lint-staged": "^15.2.7",
|
||||||
|
"list.js": "2.3.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"moment": "2.29.4",
|
||||||
|
"nouislider": "15.4.0",
|
||||||
|
"prettier": "^3.3.2",
|
||||||
|
"prop-types": "15.8.1",
|
||||||
|
"quill": "1.3.7",
|
||||||
|
"react": "18.2.0",
|
||||||
|
"react-bootstrap-sweetalert": "^5.2.0",
|
||||||
|
"react-bootstrap-table-next": "4.0.3",
|
||||||
|
"react-bootstrap-table2-editor": "^1.4.0",
|
||||||
|
"react-bootstrap-table2-paginator": "2.1.2",
|
||||||
|
"react-bootstrap-table2-toolkit": "2.1.3",
|
||||||
|
"react-chartjs-2": "2.11.2",
|
||||||
|
"react-copy-to-clipboard": "5.1.0",
|
||||||
|
"react-datetime": "3.2.0",
|
||||||
|
"react-dom": "18.2.0",
|
||||||
|
"react-error-boundary": "^4.0.13",
|
||||||
|
"react-helmet-async": "^2.0.5",
|
||||||
|
"react-jvectormap": "0.0.16",
|
||||||
|
"react-notification-alert": "0.0.13",
|
||||||
|
"react-perfect-scrollbar": "1.5.8",
|
||||||
|
"react-quill": "2.0.0",
|
||||||
|
"react-redux": "^9.1.2",
|
||||||
|
"react-router-dom": "6.21.1",
|
||||||
|
"react-scripts": "5.0.1",
|
||||||
|
"react-select2-wrapper": "1.0.4-beta6",
|
||||||
|
"react-to-print": "2.14.15",
|
||||||
|
"reactstrap": "8.10.0",
|
||||||
|
"sass": "1.69.5",
|
||||||
|
"select2": "4.1.0-rc.0",
|
||||||
|
"styled-components": "^6.1.11",
|
||||||
|
"sweetalert2": "11.10.1",
|
||||||
|
"typescript": "^4.9.5",
|
||||||
|
"yup": "^1.4.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject",
|
||||||
|
"template": "cross-env REACT_APP_RUN_MODE=template react-scripts start",
|
||||||
|
"generate-api": "orval",
|
||||||
|
"lint": "eslint \"src/main/**/*.{ts,tsx}\"",
|
||||||
|
"lint:fix": "eslint \"src/main/**/*.{ts,tsx}\" --fix",
|
||||||
|
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
|
||||||
|
"compile:scss": "sass src/template/assets/scss/argon-dashboard-pro-react.scss src/template/assets/css/argon-dashboard-pro-react.css",
|
||||||
|
"minify:scss": "sass src/template/assets/scss/argon-dashboard-pro-react.scss src/template/assets/css/argon-dashboard-pro-react.min.css --style compressed",
|
||||||
|
"build:scss": "npm run compile:scss && npm run minify:scss && npm run map:scss"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": [
|
||||||
|
"react-app",
|
||||||
|
"react-app/jest",
|
||||||
|
"prettier"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"browserslist": {
|
||||||
|
"production": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"development": [
|
||||||
|
"last 1 chrome version",
|
||||||
|
"last 1 firefox version",
|
||||||
|
"last 1 safari version"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
|
||||||
|
"@faker-js/faker": "^8.4.1",
|
||||||
|
"@tanstack/react-query-devtools": "^5.0.0-alpha.91",
|
||||||
|
"@types/chart.js": "^2.9.41",
|
||||||
|
"@types/lodash": "^4.17.6",
|
||||||
|
"@types/react-bootstrap-table-next": "^4.0.26",
|
||||||
|
"@types/react-bootstrap-table2-paginator": "^2.1.6",
|
||||||
|
"@types/react-bootstrap-table2-toolkit": "^2.1.13",
|
||||||
|
"@types/styled-components": "^5.1.34",
|
||||||
|
"ajv": "^8.16.0",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-plugin-flowtype": "8.0.3",
|
||||||
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
|
"msw": "^2.3.1",
|
||||||
|
"orval": "^6.31.0"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"src/main/**/*.{ts,tsx}": [
|
||||||
|
"npm run lint:fix"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "lint-staged"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"svgo": "3.0.2",
|
||||||
|
"fsevents": "2.3.2",
|
||||||
|
"chokidar": "3.5.3",
|
||||||
|
"@babel/plugin-transform-private-property-in-object": "7.23.4"
|
||||||
|
},
|
||||||
|
"msw": {
|
||||||
|
"workerDirectory": [
|
||||||
|
"public"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"styled-components": "^5"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" class="perfect-scrollbar-off nav-open">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="Web site created using create-react-app"
|
||||||
|
/>
|
||||||
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
|
-->
|
||||||
|
<!-- Fonts -->
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"
|
||||||
|
/>
|
||||||
|
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE"></script>
|
||||||
|
<title>React App</title>
|
||||||
|
</head>
|
||||||
|
<body class="g-sidenav-show g-sidenav-pinned">
|
||||||
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo192.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "192x192"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo512.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
||||||
@ -0,0 +1,284 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
/* tslint:disable */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mock Service Worker.
|
||||||
|
* @see https://github.com/mswjs/msw
|
||||||
|
* - Please do NOT modify this file.
|
||||||
|
* - Please do NOT serve this file on production.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const PACKAGE_VERSION = '2.3.1'
|
||||||
|
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
|
||||||
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
||||||
|
const activeClientIds = new Set()
|
||||||
|
|
||||||
|
self.addEventListener('install', function () {
|
||||||
|
self.skipWaiting()
|
||||||
|
})
|
||||||
|
|
||||||
|
self.addEventListener('activate', function (event) {
|
||||||
|
event.waitUntil(self.clients.claim())
|
||||||
|
})
|
||||||
|
|
||||||
|
self.addEventListener('message', async function (event) {
|
||||||
|
const clientId = event.source.id
|
||||||
|
|
||||||
|
if (!clientId || !self.clients) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const client = await self.clients.get(clientId)
|
||||||
|
|
||||||
|
if (!client) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const allClients = await self.clients.matchAll({
|
||||||
|
type: 'window',
|
||||||
|
})
|
||||||
|
|
||||||
|
switch (event.data) {
|
||||||
|
case 'KEEPALIVE_REQUEST': {
|
||||||
|
sendToClient(client, {
|
||||||
|
type: 'KEEPALIVE_RESPONSE',
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'INTEGRITY_CHECK_REQUEST': {
|
||||||
|
sendToClient(client, {
|
||||||
|
type: 'INTEGRITY_CHECK_RESPONSE',
|
||||||
|
payload: {
|
||||||
|
packageVersion: PACKAGE_VERSION,
|
||||||
|
checksum: INTEGRITY_CHECKSUM,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'MOCK_ACTIVATE': {
|
||||||
|
activeClientIds.add(clientId)
|
||||||
|
|
||||||
|
sendToClient(client, {
|
||||||
|
type: 'MOCKING_ENABLED',
|
||||||
|
payload: true,
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'MOCK_DEACTIVATE': {
|
||||||
|
activeClientIds.delete(clientId)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'CLIENT_CLOSED': {
|
||||||
|
activeClientIds.delete(clientId)
|
||||||
|
|
||||||
|
const remainingClients = allClients.filter((client) => {
|
||||||
|
return client.id !== clientId
|
||||||
|
})
|
||||||
|
|
||||||
|
// Unregister itself when there are no more clients
|
||||||
|
if (remainingClients.length === 0) {
|
||||||
|
self.registration.unregister()
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
self.addEventListener('fetch', function (event) {
|
||||||
|
const { request } = event
|
||||||
|
|
||||||
|
// Bypass navigation requests.
|
||||||
|
if (request.mode === 'navigate') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opening the DevTools triggers the "only-if-cached" request
|
||||||
|
// that cannot be handled by the worker. Bypass such requests.
|
||||||
|
if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bypass all requests when there are no active clients.
|
||||||
|
// Prevents the self-unregistered worked from handling requests
|
||||||
|
// after it's been deleted (still remains active until the next reload).
|
||||||
|
if (activeClientIds.size === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate unique request ID.
|
||||||
|
const requestId = crypto.randomUUID()
|
||||||
|
event.respondWith(handleRequest(event, requestId))
|
||||||
|
})
|
||||||
|
|
||||||
|
async function handleRequest(event, requestId) {
|
||||||
|
const client = await resolveMainClient(event)
|
||||||
|
const response = await getResponse(event, client, requestId)
|
||||||
|
|
||||||
|
// Send back the response clone for the "response:*" life-cycle events.
|
||||||
|
// Ensure MSW is active and ready to handle the message, otherwise
|
||||||
|
// this message will pend indefinitely.
|
||||||
|
if (client && activeClientIds.has(client.id)) {
|
||||||
|
;(async function () {
|
||||||
|
const responseClone = response.clone()
|
||||||
|
|
||||||
|
sendToClient(
|
||||||
|
client,
|
||||||
|
{
|
||||||
|
type: 'RESPONSE',
|
||||||
|
payload: {
|
||||||
|
requestId,
|
||||||
|
isMockedResponse: IS_MOCKED_RESPONSE in response,
|
||||||
|
type: responseClone.type,
|
||||||
|
status: responseClone.status,
|
||||||
|
statusText: responseClone.statusText,
|
||||||
|
body: responseClone.body,
|
||||||
|
headers: Object.fromEntries(responseClone.headers.entries()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[responseClone.body],
|
||||||
|
)
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resolve the main client for the given event.
|
||||||
|
// Client that issues a request doesn't necessarily equal the client
|
||||||
|
// that registered the worker. It's with the latter the worker should
|
||||||
|
// communicate with during the response resolving phase.
|
||||||
|
async function resolveMainClient(event) {
|
||||||
|
const client = await self.clients.get(event.clientId)
|
||||||
|
|
||||||
|
if (client?.frameType === 'top-level') {
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
const allClients = await self.clients.matchAll({
|
||||||
|
type: 'window',
|
||||||
|
})
|
||||||
|
|
||||||
|
return allClients
|
||||||
|
.filter((client) => {
|
||||||
|
// Get only those clients that are currently visible.
|
||||||
|
return client.visibilityState === 'visible'
|
||||||
|
})
|
||||||
|
.find((client) => {
|
||||||
|
// Find the client ID that's recorded in the
|
||||||
|
// set of clients that have registered the worker.
|
||||||
|
return activeClientIds.has(client.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getResponse(event, client, requestId) {
|
||||||
|
const { request } = event
|
||||||
|
|
||||||
|
// Clone the request because it might've been already used
|
||||||
|
// (i.e. its body has been read and sent to the client).
|
||||||
|
const requestClone = request.clone()
|
||||||
|
|
||||||
|
function passthrough() {
|
||||||
|
const headers = Object.fromEntries(requestClone.headers.entries())
|
||||||
|
|
||||||
|
// Remove internal MSW request header so the passthrough request
|
||||||
|
// complies with any potential CORS preflight checks on the server.
|
||||||
|
// Some servers forbid unknown request headers.
|
||||||
|
delete headers['x-msw-intention']
|
||||||
|
|
||||||
|
return fetch(requestClone, { headers })
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bypass mocking when the client is not active.
|
||||||
|
if (!client) {
|
||||||
|
return passthrough()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bypass initial page load requests (i.e. static assets).
|
||||||
|
// The absence of the immediate/parent client in the map of the active clients
|
||||||
|
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
|
||||||
|
// and is not ready to handle requests.
|
||||||
|
if (!activeClientIds.has(client.id)) {
|
||||||
|
return passthrough()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify the client that a request has been intercepted.
|
||||||
|
const requestBuffer = await request.arrayBuffer()
|
||||||
|
const clientMessage = await sendToClient(
|
||||||
|
client,
|
||||||
|
{
|
||||||
|
type: 'REQUEST',
|
||||||
|
payload: {
|
||||||
|
id: requestId,
|
||||||
|
url: request.url,
|
||||||
|
mode: request.mode,
|
||||||
|
method: request.method,
|
||||||
|
headers: Object.fromEntries(request.headers.entries()),
|
||||||
|
cache: request.cache,
|
||||||
|
credentials: request.credentials,
|
||||||
|
destination: request.destination,
|
||||||
|
integrity: request.integrity,
|
||||||
|
redirect: request.redirect,
|
||||||
|
referrer: request.referrer,
|
||||||
|
referrerPolicy: request.referrerPolicy,
|
||||||
|
body: requestBuffer,
|
||||||
|
keepalive: request.keepalive,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[requestBuffer],
|
||||||
|
)
|
||||||
|
|
||||||
|
switch (clientMessage.type) {
|
||||||
|
case 'MOCK_RESPONSE': {
|
||||||
|
return respondWithMock(clientMessage.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'PASSTHROUGH': {
|
||||||
|
return passthrough()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return passthrough()
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendToClient(client, message, transferrables = []) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const channel = new MessageChannel()
|
||||||
|
|
||||||
|
channel.port1.onmessage = (event) => {
|
||||||
|
if (event.data && event.data.error) {
|
||||||
|
return reject(event.data.error)
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(event.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
client.postMessage(
|
||||||
|
message,
|
||||||
|
[channel.port2].concat(transferrables.filter(Boolean)),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function respondWithMock(response) {
|
||||||
|
// Setting response status code to 0 is a no-op.
|
||||||
|
// However, when responding with a "Response.error()", the produced Response
|
||||||
|
// instance will have status code set to 0. Since it's not possible to create
|
||||||
|
// a Response instance with status code 0, handle that use-case separately.
|
||||||
|
if (response.status === 0) {
|
||||||
|
return Response.error()
|
||||||
|
}
|
||||||
|
|
||||||
|
const mockedResponse = new Response(response.body, response)
|
||||||
|
|
||||||
|
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
|
||||||
|
value: true,
|
||||||
|
enumerable: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
return mockedResponse
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
if (process.env.REACT_APP_RUN_MODE === 'template') {
|
||||||
|
require('./template/index');
|
||||||
|
} else {
|
||||||
|
require('./main/index');
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
import { ErrorBoundary } from 'react-error-boundary';
|
||||||
|
import { Navigate, RouterProvider } from 'react-router-dom';
|
||||||
|
import { Page } from './constants';
|
||||||
|
import baseRouter from './routes/base-router';
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<ErrorBoundary fallback={<Navigate to={Page.SYSTEM_ERROR.PATH} replace />}>
|
||||||
|
<RouterProvider router={baseRouter} />
|
||||||
|
</ErrorBoundary>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
import Axios, { AxiosError, AxiosRequestConfig } from 'axios';
|
||||||
|
import { drcAxios } from 'main/configs/axios';
|
||||||
|
|
||||||
|
export const AXIOS_INSTANCE = drcAxios;
|
||||||
|
|
||||||
|
export const drcInstance = <T>(config: AxiosRequestConfig): Promise<T> => {
|
||||||
|
const source = Axios.CancelToken.source();
|
||||||
|
const promise = AXIOS_INSTANCE({ ...config, cancelToken: source.token }).then(({ data }) => data);
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
promise.cancel = () => {
|
||||||
|
source.cancel('Query was cancelled by Vue Query');
|
||||||
|
};
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default drcInstance;
|
||||||
|
|
||||||
|
export interface ErrorType<Error> extends AxiosError<Error> {}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Transformer function for orval.
|
||||||
|
*
|
||||||
|
* @param {OpenAPIObject} schema
|
||||||
|
* @return {OpenAPIObject}
|
||||||
|
*/
|
||||||
|
module.exports = (inputSchema) => ({
|
||||||
|
...inputSchema,
|
||||||
|
paths: Object.entries(inputSchema.paths).reduce(
|
||||||
|
(acc, [path, pathItem]) => ({
|
||||||
|
...acc,
|
||||||
|
[`v{version}${path}`]: Object.entries(pathItem).reduce(
|
||||||
|
(pathItemAcc, [verb, operation]) => ({
|
||||||
|
...pathItemAcc,
|
||||||
|
[verb]: {
|
||||||
|
...operation,
|
||||||
|
parameters: [
|
||||||
|
...(operation.parameters || []),
|
||||||
|
{
|
||||||
|
name: 'version',
|
||||||
|
in: 'path',
|
||||||
|
required: true,
|
||||||
|
schema: {
|
||||||
|
type: 'number',
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{},
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
{},
|
||||||
|
),
|
||||||
|
});
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import { drcAxios } from 'main/configs/axios';
|
||||||
|
import { ExtractFnReturnType, QueryConfig } from 'main/configs/react-query';
|
||||||
|
import { ApiUrl } from 'main/constants';
|
||||||
|
import { SuppliesCategory } from 'main/types';
|
||||||
|
|
||||||
|
type GetSuppliesCategoriesResponse = {
|
||||||
|
content: SuppliesCategory[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function getSuppliesCategories(): Promise<SuppliesCategory[]> {
|
||||||
|
return drcAxios.get(ApiUrl.DRC.GET_SUPPLIES_CATEGORIES).then((response) => {
|
||||||
|
const data = response.data as GetSuppliesCategoriesResponse;
|
||||||
|
return data.content;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryFnType = typeof getSuppliesCategories;
|
||||||
|
|
||||||
|
type QueryOptions = {
|
||||||
|
config?: QueryConfig<QueryFnType>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function useGetSuppliesCategories(queryOptions?: QueryOptions) {
|
||||||
|
const config = queryOptions?.config || {};
|
||||||
|
|
||||||
|
return useQuery<ExtractFnReturnType<QueryFnType>>({
|
||||||
|
...config,
|
||||||
|
queryKey: ['suppliesCategories'],
|
||||||
|
queryFn: getSuppliesCategories,
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import { drcAxios } from 'main/configs/axios';
|
||||||
|
import { ExtractFnReturnType, QueryConfig } from 'main/configs/react-query';
|
||||||
|
import { ApiUrl } from 'main/constants';
|
||||||
|
import { SuppliesCategory } from 'main/types';
|
||||||
|
|
||||||
|
type GetSuppliesCategoryByIdResponse = {
|
||||||
|
content: SuppliesCategory;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetSuppliesCategoryByIdParams = {
|
||||||
|
suppliesCategoryId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function getSuppliesCategoryById({
|
||||||
|
suppliesCategoryId,
|
||||||
|
}: GetSuppliesCategoryByIdParams): Promise<SuppliesCategory> {
|
||||||
|
return drcAxios
|
||||||
|
.get(ApiUrl.DRC.GET_SUPPLIES_CATEGORY_BY_ID, {
|
||||||
|
params: { suppliesCategoryId },
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
const data = response.data as GetSuppliesCategoryByIdResponse;
|
||||||
|
return data.content;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryFnType = typeof getSuppliesCategoryById;
|
||||||
|
|
||||||
|
type QueryOptions = {
|
||||||
|
params: GetSuppliesCategoryByIdParams;
|
||||||
|
config?: QueryConfig<QueryFnType>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function useGetSuppliesCategoryById({ params, config = {} }: QueryOptions) {
|
||||||
|
return useQuery<ExtractFnReturnType<QueryFnType>>({
|
||||||
|
...config,
|
||||||
|
queryKey: ['suppliesCategory', ...Object.values(params)],
|
||||||
|
queryFn: () => getSuppliesCategoryById(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
import { ApiUrl } from 'main/constants';
|
||||||
|
import { delay, http, HttpResponse } from 'msw';
|
||||||
|
|
||||||
|
export const getSuppliesCategoriesMockHandler = () => {
|
||||||
|
return http.get(ApiUrl.DRC.GET_SUPPLIES_CATEGORIES, async () => {
|
||||||
|
await delay(3000);
|
||||||
|
return HttpResponse.json({
|
||||||
|
returnCode: 100,
|
||||||
|
message: 'Success',
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
id: 'sc-001',
|
||||||
|
name: 'Loại vật tự 001',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'sc-002',
|
||||||
|
name: 'Loại vật tự 002',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'sc-003',
|
||||||
|
name: 'Loại vật tự 003',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getSuppliesCategoryByIdMockHandler = () => {
|
||||||
|
return http.get(ApiUrl.DRC.GET_SUPPLIES_CATEGORY_BY_ID, async ({ params }) => {
|
||||||
|
const { suppliesCategoryId } = params;
|
||||||
|
await delay(3000);
|
||||||
|
return HttpResponse.json({
|
||||||
|
returnCode: 100,
|
||||||
|
message: 'Success',
|
||||||
|
content: {
|
||||||
|
id: suppliesCategoryId,
|
||||||
|
name: `Loại vật tự ${suppliesCategoryId}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getSuppliesCategoryMock = () => [getSuppliesCategoriesMockHandler(), getSuppliesCategoryByIdMockHandler()];
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { AuthenticationControllerLogin200 } from '../../models';
|
||||||
|
|
||||||
|
export const getAuthenticationControllerLoginResponseMock = (
|
||||||
|
overrideResponse: Partial<AuthenticationControllerLogin200> = {},
|
||||||
|
): AuthenticationControllerLogin200 => ({
|
||||||
|
token: faker.helpers.arrayElement([faker.word.sample(), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getAuthenticationControllerLoginMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| AuthenticationControllerLogin200
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||||
|
) => Promise<AuthenticationControllerLogin200> | AuthenticationControllerLogin200),
|
||||||
|
) => {
|
||||||
|
return http.post('*/users/login', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getAuthenticationControllerLoginResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getAuthenticationControllerMock = () => [getAuthenticationControllerLoginMockHandler()];
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
import type { MutationFunction, UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { AuthenticationControllerLogin200, CredentialsWithRelations } from '../../models';
|
||||||
|
|
||||||
|
export const authenticationControllerLogin = (credentialsWithRelations: CredentialsWithRelations) => {
|
||||||
|
return drcInstance<AuthenticationControllerLogin200>({
|
||||||
|
url: `/users/login`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: credentialsWithRelations,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getAuthenticationControllerLoginMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof authenticationControllerLogin>>,
|
||||||
|
TError,
|
||||||
|
{ data: CredentialsWithRelations },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof authenticationControllerLogin>>,
|
||||||
|
TError,
|
||||||
|
{ data: CredentialsWithRelations },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof authenticationControllerLogin>>,
|
||||||
|
{ data: CredentialsWithRelations }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return authenticationControllerLogin(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AuthenticationControllerLoginMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof authenticationControllerLogin>>
|
||||||
|
>;
|
||||||
|
export type AuthenticationControllerLoginMutationBody = CredentialsWithRelations;
|
||||||
|
export type AuthenticationControllerLoginMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useAuthenticationControllerLogin = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof authenticationControllerLogin>>,
|
||||||
|
TError,
|
||||||
|
{ data: CredentialsWithRelations },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof authenticationControllerLogin>>,
|
||||||
|
TError,
|
||||||
|
{ data: CredentialsWithRelations },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getAuthenticationControllerLoginMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
@ -0,0 +1,181 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { KhovtMasterKho, KhovtMasterKhoWithRelations, LoopbackCount } from '../../models';
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerCountResponseMock = (
|
||||||
|
overrideResponse: Partial<LoopbackCount> = {},
|
||||||
|
): LoopbackCount => ({
|
||||||
|
count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterKhoWithRelations> = {},
|
||||||
|
): KhovtMasterKhoWithRelations => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.word.sample(),
|
||||||
|
tenKho: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerCreateResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterKho> = {},
|
||||||
|
): KhovtMasterKho => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.word.sample(),
|
||||||
|
tenKho: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindResponseMock = (): KhovtMasterKhoWithRelations[] =>
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.word.sample(),
|
||||||
|
tenKho: faker.word.sample(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerCountMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| LoopbackCount
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-khos/count', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterKhoControllerCountResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerUpdateByIdMockHandler = () => {
|
||||||
|
return http.patch('*/khovt-master-khos/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterKhoWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterKhoWithRelations> | KhovtMasterKhoWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-khos/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterKhoControllerFindByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerDeleteByIdMockHandler = () => {
|
||||||
|
return http.delete('*/khovt-master-khos/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerCreateMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterKho
|
||||||
|
| ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<KhovtMasterKho> | KhovtMasterKho),
|
||||||
|
) => {
|
||||||
|
return http.post('*/khovt-master-khos', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterKhoControllerCreateResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterKhoWithRelations[]
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterKhoWithRelations[]> | KhovtMasterKhoWithRelations[]),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-khos', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterKhoControllerFindResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getKhovtMasterKhoControllerMock = () => [
|
||||||
|
getKhovtMasterKhoControllerCountMockHandler(),
|
||||||
|
getKhovtMasterKhoControllerUpdateByIdMockHandler(),
|
||||||
|
getKhovtMasterKhoControllerFindByIdMockHandler(),
|
||||||
|
getKhovtMasterKhoControllerDeleteByIdMockHandler(),
|
||||||
|
getKhovtMasterKhoControllerCreateMockHandler(),
|
||||||
|
getKhovtMasterKhoControllerFindMockHandler(),
|
||||||
|
];
|
||||||
@ -0,0 +1,380 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import type {
|
||||||
|
MutationFunction,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type {
|
||||||
|
KhovtMasterKho,
|
||||||
|
KhovtMasterKhoControllerCountParams,
|
||||||
|
KhovtMasterKhoControllerFindByIdParams,
|
||||||
|
KhovtMasterKhoControllerFindParams,
|
||||||
|
KhovtMasterKhoPartial,
|
||||||
|
KhovtMasterKhoWithRelations,
|
||||||
|
LoopbackCount,
|
||||||
|
NewKhovtMasterKho,
|
||||||
|
} from '../../models';
|
||||||
|
|
||||||
|
export const khovtMasterKhoControllerCount = (params?: KhovtMasterKhoControllerCountParams, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<LoopbackCount>({ url: `/khovt-master-khos/count`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerCountQueryKey = (params?: KhovtMasterKhoControllerCountParams) => {
|
||||||
|
return [`/khovt-master-khos/count`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerCountQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterKhoControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterKhoControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterKhoControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterKhoControllerCountQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterKhoControllerCount>>> = ({ signal }) =>
|
||||||
|
khovtMasterKhoControllerCount(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCount>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerCountQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCount>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterKhoControllerCountQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterKhoControllerCount = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterKhoControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterKhoControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterKhoControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterKhoControllerCountQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtMasterKhoControllerUpdateById = (id: number, khovtMasterKhoPartial: KhovtMasterKhoPartial) => {
|
||||||
|
return drcInstance<unknown>({
|
||||||
|
url: `/khovt-master-khos/${id}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: khovtMasterKhoPartial,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerUpdateByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterKhoPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterKhoPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerUpdateById>>,
|
||||||
|
{ id: number; data: KhovtMasterKhoPartial }
|
||||||
|
> = (props) => {
|
||||||
|
const { id, data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterKhoControllerUpdateById(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerUpdateByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerUpdateById>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterKhoControllerUpdateByIdMutationBody = KhovtMasterKhoPartial;
|
||||||
|
export type KhovtMasterKhoControllerUpdateByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterKhoControllerUpdateById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterKhoPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterKhoPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterKhoControllerUpdateByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterKhoControllerFindById = (
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterKhoControllerFindByIdParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtMasterKhoWithRelations>({ url: `/khovt-master-khos/${id}`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindByIdQueryKey = (
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterKhoControllerFindByIdParams,
|
||||||
|
) => {
|
||||||
|
return [`/khovt-master-khos/${id}`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindByIdQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterKhoControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterKhoControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterKhoControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterKhoControllerFindByIdQueryKey(id, params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterKhoControllerFindById>>> = ({ signal }) =>
|
||||||
|
khovtMasterKhoControllerFindById(id, params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerFindById>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerFindByIdQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerFindById>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterKhoControllerFindByIdQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterKhoControllerFindById = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterKhoControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterKhoControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterKhoControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterKhoControllerFindByIdQueryOptions(id, params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtMasterKhoControllerDeleteById = (id: number) => {
|
||||||
|
return drcInstance<unknown>({ url: `/khovt-master-khos/${id}`, method: 'DELETE' });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerDeleteByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<Awaited<ReturnType<typeof khovtMasterKhoControllerDeleteById>>, { id: number }> = (
|
||||||
|
props,
|
||||||
|
) => {
|
||||||
|
const { id } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterKhoControllerDeleteById(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerDeleteByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerDeleteById>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerDeleteByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterKhoControllerDeleteById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterKhoControllerDeleteByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterKhoControllerCreate = (newKhovtMasterKho: NewKhovtMasterKho) => {
|
||||||
|
return drcInstance<KhovtMasterKho>({
|
||||||
|
url: `/khovt-master-khos`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: newKhovtMasterKho,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerCreateMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterKho },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterKho },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCreate>>,
|
||||||
|
{ data: NewKhovtMasterKho }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterKhoControllerCreate(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerCreateMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCreate>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterKhoControllerCreateMutationBody = NewKhovtMasterKho;
|
||||||
|
export type KhovtMasterKhoControllerCreateMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterKhoControllerCreate = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterKho },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterKho },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterKhoControllerCreateMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterKhoControllerFind = (params?: KhovtMasterKhoControllerFindParams, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<KhovtMasterKhoWithRelations[]>({ url: `/khovt-master-khos`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindQueryKey = (params?: KhovtMasterKhoControllerFindParams) => {
|
||||||
|
return [`/khovt-master-khos`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterKhoControllerFindQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterKhoControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterKhoControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterKhoControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterKhoControllerFindQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterKhoControllerFind>>> = ({ signal }) =>
|
||||||
|
khovtMasterKhoControllerFind(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerFind>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerFindQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterKhoControllerFind>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterKhoControllerFindQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterKhoControllerFind = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterKhoControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterKhoControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterKhoControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterKhoControllerFindQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { KhovtMasterNguonGoc, KhovtMasterNguonGocWithRelations, LoopbackCount } from '../../models';
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerCountResponseMock = (
|
||||||
|
overrideResponse: Partial<LoopbackCount> = {},
|
||||||
|
): LoopbackCount => ({
|
||||||
|
count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterNguonGocWithRelations> = {},
|
||||||
|
): KhovtMasterNguonGocWithRelations => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maNguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
nuocId: faker.word.sample(),
|
||||||
|
tenNhaSx: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerCreateResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterNguonGoc> = {},
|
||||||
|
): KhovtMasterNguonGoc => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maNguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
nuocId: faker.word.sample(),
|
||||||
|
tenNhaSx: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindResponseMock = (): KhovtMasterNguonGocWithRelations[] =>
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maNguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
nuocId: faker.word.sample(),
|
||||||
|
tenNhaSx: faker.word.sample(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerCountMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| LoopbackCount
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-nguon-gocs/count', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterNguonGocControllerCountResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerUpdateByIdMockHandler = () => {
|
||||||
|
return http.patch('*/khovt-master-nguon-gocs/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterNguonGocWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterNguonGocWithRelations> | KhovtMasterNguonGocWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-nguon-gocs/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterNguonGocControllerFindByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerDeleteByIdMockHandler = () => {
|
||||||
|
return http.delete('*/khovt-master-nguon-gocs/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerCreateMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterNguonGoc
|
||||||
|
| ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<KhovtMasterNguonGoc> | KhovtMasterNguonGoc),
|
||||||
|
) => {
|
||||||
|
return http.post('*/khovt-master-nguon-gocs', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterNguonGocControllerCreateResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterNguonGocWithRelations[]
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterNguonGocWithRelations[]> | KhovtMasterNguonGocWithRelations[]),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-nguon-gocs', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterNguonGocControllerFindResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getKhovtMasterNguonGocControllerMock = () => [
|
||||||
|
getKhovtMasterNguonGocControllerCountMockHandler(),
|
||||||
|
getKhovtMasterNguonGocControllerUpdateByIdMockHandler(),
|
||||||
|
getKhovtMasterNguonGocControllerFindByIdMockHandler(),
|
||||||
|
getKhovtMasterNguonGocControllerDeleteByIdMockHandler(),
|
||||||
|
getKhovtMasterNguonGocControllerCreateMockHandler(),
|
||||||
|
getKhovtMasterNguonGocControllerFindMockHandler(),
|
||||||
|
];
|
||||||
@ -0,0 +1,400 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import type {
|
||||||
|
MutationFunction,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type {
|
||||||
|
KhovtMasterNguonGoc,
|
||||||
|
KhovtMasterNguonGocControllerCountParams,
|
||||||
|
KhovtMasterNguonGocControllerFindByIdParams,
|
||||||
|
KhovtMasterNguonGocControllerFindParams,
|
||||||
|
KhovtMasterNguonGocPartial,
|
||||||
|
KhovtMasterNguonGocWithRelations,
|
||||||
|
LoopbackCount,
|
||||||
|
NewKhovtMasterNguonGoc,
|
||||||
|
} from '../../models';
|
||||||
|
|
||||||
|
export const khovtMasterNguonGocControllerCount = (
|
||||||
|
params?: KhovtMasterNguonGocControllerCountParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<LoopbackCount>({ url: `/khovt-master-nguon-gocs/count`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerCountQueryKey = (params?: KhovtMasterNguonGocControllerCountParams) => {
|
||||||
|
return [`/khovt-master-nguon-gocs/count`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerCountQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterNguonGocControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterNguonGocControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterNguonGocControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterNguonGocControllerCountQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterNguonGocControllerCount>>> = ({ signal }) =>
|
||||||
|
khovtMasterNguonGocControllerCount(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCount>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerCountQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCount>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterNguonGocControllerCountQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterNguonGocControllerCount = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterNguonGocControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterNguonGocControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterNguonGocControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterNguonGocControllerCountQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtMasterNguonGocControllerUpdateById = (
|
||||||
|
id: number,
|
||||||
|
khovtMasterNguonGocPartial: KhovtMasterNguonGocPartial,
|
||||||
|
) => {
|
||||||
|
return drcInstance<unknown>({
|
||||||
|
url: `/khovt-master-nguon-gocs/${id}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: khovtMasterNguonGocPartial,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerUpdateByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNguonGocPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNguonGocPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerUpdateById>>,
|
||||||
|
{ id: number; data: KhovtMasterNguonGocPartial }
|
||||||
|
> = (props) => {
|
||||||
|
const { id, data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterNguonGocControllerUpdateById(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerUpdateByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerUpdateById>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterNguonGocControllerUpdateByIdMutationBody = KhovtMasterNguonGocPartial;
|
||||||
|
export type KhovtMasterNguonGocControllerUpdateByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterNguonGocControllerUpdateById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNguonGocPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNguonGocPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterNguonGocControllerUpdateByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterNguonGocControllerFindById = (
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterNguonGocControllerFindByIdParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtMasterNguonGocWithRelations>({
|
||||||
|
url: `/khovt-master-nguon-gocs/${id}`,
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindByIdQueryKey = (
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterNguonGocControllerFindByIdParams,
|
||||||
|
) => {
|
||||||
|
return [`/khovt-master-nguon-gocs/${id}`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindByIdQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterNguonGocControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterNguonGocControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterNguonGocControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterNguonGocControllerFindByIdQueryKey(id, params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterNguonGocControllerFindById>>> = ({ signal }) =>
|
||||||
|
khovtMasterNguonGocControllerFindById(id, params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerFindById>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerFindByIdQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerFindById>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterNguonGocControllerFindByIdQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterNguonGocControllerFindById = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterNguonGocControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtMasterNguonGocControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterNguonGocControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterNguonGocControllerFindByIdQueryOptions(id, params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtMasterNguonGocControllerDeleteById = (id: number) => {
|
||||||
|
return drcInstance<unknown>({ url: `/khovt-master-nguon-gocs/${id}`, method: 'DELETE' });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerDeleteByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerDeleteById>>,
|
||||||
|
{ id: number }
|
||||||
|
> = (props) => {
|
||||||
|
const { id } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterNguonGocControllerDeleteById(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerDeleteByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerDeleteById>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerDeleteByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterNguonGocControllerDeleteById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterNguonGocControllerDeleteByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterNguonGocControllerCreate = (newKhovtMasterNguonGoc: NewKhovtMasterNguonGoc) => {
|
||||||
|
return drcInstance<KhovtMasterNguonGoc>({
|
||||||
|
url: `/khovt-master-nguon-gocs`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: newKhovtMasterNguonGoc,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerCreateMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNguonGoc },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNguonGoc },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCreate>>,
|
||||||
|
{ data: NewKhovtMasterNguonGoc }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterNguonGocControllerCreate(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerCreateMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCreate>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterNguonGocControllerCreateMutationBody = NewKhovtMasterNguonGoc;
|
||||||
|
export type KhovtMasterNguonGocControllerCreateMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterNguonGocControllerCreate = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNguonGoc },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNguonGoc },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterNguonGocControllerCreateMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterNguonGocControllerFind = (
|
||||||
|
params?: KhovtMasterNguonGocControllerFindParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtMasterNguonGocWithRelations[]>({
|
||||||
|
url: `/khovt-master-nguon-gocs`,
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindQueryKey = (params?: KhovtMasterNguonGocControllerFindParams) => {
|
||||||
|
return [`/khovt-master-nguon-gocs`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterNguonGocControllerFindQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterNguonGocControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterNguonGocControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterNguonGocControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterNguonGocControllerFindQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterNguonGocControllerFind>>> = ({ signal }) =>
|
||||||
|
khovtMasterNguonGocControllerFind(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerFind>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerFindQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterNguonGocControllerFind>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterNguonGocControllerFindQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterNguonGocControllerFind = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterNguonGocControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterNguonGocControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterNguonGocControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterNguonGocControllerFindQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { KhovtMasterVt, KhovtMasterVtWithRelations, LoopbackCount } from '../../models';
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerCountResponseMock = (
|
||||||
|
overrideResponse: Partial<LoopbackCount> = {},
|
||||||
|
): LoopbackCount => ({
|
||||||
|
count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterVtWithRelations> = {},
|
||||||
|
): KhovtMasterVtWithRelations => ({
|
||||||
|
dvt: faker.word.sample(),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maNhom: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maVt: faker.word.sample(),
|
||||||
|
tenVt: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerCreateResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterVt> = {},
|
||||||
|
): KhovtMasterVt => ({
|
||||||
|
dvt: faker.word.sample(),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maNhom: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maVt: faker.word.sample(),
|
||||||
|
tenVt: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindResponseMock = (): KhovtMasterVtWithRelations[] =>
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
dvt: faker.word.sample(),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maNhom: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maVt: faker.word.sample(),
|
||||||
|
tenVt: faker.word.sample(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerCountMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| LoopbackCount
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-vts/count', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterVtControllerCountResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerUpdateByIdMockHandler = () => {
|
||||||
|
return http.patch('*/khovt-master-vts/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterVtWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterVtWithRelations> | KhovtMasterVtWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-vts/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterVtControllerFindByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerDeleteByIdMockHandler = () => {
|
||||||
|
return http.delete('*/khovt-master-vts/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerCreateMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterVt
|
||||||
|
| ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<KhovtMasterVt> | KhovtMasterVt),
|
||||||
|
) => {
|
||||||
|
return http.post('*/khovt-master-vts', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterVtControllerCreateResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterVtWithRelations[]
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterVtWithRelations[]> | KhovtMasterVtWithRelations[]),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-vts', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtMasterVtControllerFindResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getKhovtMasterVtControllerMock = () => [
|
||||||
|
getKhovtMasterVtControllerCountMockHandler(),
|
||||||
|
getKhovtMasterVtControllerUpdateByIdMockHandler(),
|
||||||
|
getKhovtMasterVtControllerFindByIdMockHandler(),
|
||||||
|
getKhovtMasterVtControllerDeleteByIdMockHandler(),
|
||||||
|
getKhovtMasterVtControllerCreateMockHandler(),
|
||||||
|
getKhovtMasterVtControllerFindMockHandler(),
|
||||||
|
];
|
||||||
@ -0,0 +1,380 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import type {
|
||||||
|
MutationFunction,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type {
|
||||||
|
KhovtMasterVt,
|
||||||
|
KhovtMasterVtControllerCountParams,
|
||||||
|
KhovtMasterVtControllerFindByIdParams,
|
||||||
|
KhovtMasterVtControllerFindParams,
|
||||||
|
KhovtMasterVtPartial,
|
||||||
|
KhovtMasterVtWithRelations,
|
||||||
|
LoopbackCount,
|
||||||
|
NewKhovtMasterVt,
|
||||||
|
} from '../../models';
|
||||||
|
|
||||||
|
export const khovtMasterVtControllerCount = (params?: KhovtMasterVtControllerCountParams, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<LoopbackCount>({ url: `/khovt-master-vts/count`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerCountQueryKey = (params?: KhovtMasterVtControllerCountParams) => {
|
||||||
|
return [`/khovt-master-vts/count`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerCountQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterVtControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterVtControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterVtControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterVtControllerCountQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterVtControllerCount>>> = ({ signal }) =>
|
||||||
|
khovtMasterVtControllerCount(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCount>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterVtControllerCountQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCount>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterVtControllerCountQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterVtControllerCount = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterVtControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterVtControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterVtControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterVtControllerCountQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtMasterVtControllerUpdateById = (id: string, khovtMasterVtPartial: KhovtMasterVtPartial) => {
|
||||||
|
return drcInstance<unknown>({
|
||||||
|
url: `/khovt-master-vts/${id}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: khovtMasterVtPartial,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerUpdateByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string; data: KhovtMasterVtPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string; data: KhovtMasterVtPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerUpdateById>>,
|
||||||
|
{ id: string; data: KhovtMasterVtPartial }
|
||||||
|
> = (props) => {
|
||||||
|
const { id, data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterVtControllerUpdateById(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterVtControllerUpdateByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerUpdateById>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterVtControllerUpdateByIdMutationBody = KhovtMasterVtPartial;
|
||||||
|
export type KhovtMasterVtControllerUpdateByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterVtControllerUpdateById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string; data: KhovtMasterVtPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string; data: KhovtMasterVtPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterVtControllerUpdateByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterVtControllerFindById = (
|
||||||
|
id: string,
|
||||||
|
params?: KhovtMasterVtControllerFindByIdParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtMasterVtWithRelations>({ url: `/khovt-master-vts/${id}`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindByIdQueryKey = (
|
||||||
|
id: string,
|
||||||
|
params?: KhovtMasterVtControllerFindByIdParams,
|
||||||
|
) => {
|
||||||
|
return [`/khovt-master-vts/${id}`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindByIdQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterVtControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: string,
|
||||||
|
params?: KhovtMasterVtControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterVtControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterVtControllerFindByIdQueryKey(id, params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterVtControllerFindById>>> = ({ signal }) =>
|
||||||
|
khovtMasterVtControllerFindById(id, params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerFindById>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterVtControllerFindByIdQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerFindById>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterVtControllerFindByIdQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterVtControllerFindById = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterVtControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: string,
|
||||||
|
params?: KhovtMasterVtControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterVtControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterVtControllerFindByIdQueryOptions(id, params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtMasterVtControllerDeleteById = (id: string) => {
|
||||||
|
return drcInstance<unknown>({ url: `/khovt-master-vts/${id}`, method: 'DELETE' });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerDeleteByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<Awaited<ReturnType<typeof khovtMasterVtControllerDeleteById>>, { id: string }> = (
|
||||||
|
props,
|
||||||
|
) => {
|
||||||
|
const { id } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterVtControllerDeleteById(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterVtControllerDeleteByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerDeleteById>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type KhovtMasterVtControllerDeleteByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterVtControllerDeleteById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: string },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterVtControllerDeleteByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterVtControllerCreate = (newKhovtMasterVt: NewKhovtMasterVt) => {
|
||||||
|
return drcInstance<KhovtMasterVt>({
|
||||||
|
url: `/khovt-master-vts`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: newKhovtMasterVt,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerCreateMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterVt },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterVt },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCreate>>,
|
||||||
|
{ data: NewKhovtMasterVt }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtMasterVtControllerCreate(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterVtControllerCreateMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCreate>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterVtControllerCreateMutationBody = NewKhovtMasterVt;
|
||||||
|
export type KhovtMasterVtControllerCreateMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterVtControllerCreate = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterVt },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterVt },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtMasterVtControllerCreateMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtMasterVtControllerFind = (params?: KhovtMasterVtControllerFindParams, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<KhovtMasterVtWithRelations[]>({ url: `/khovt-master-vts`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindQueryKey = (params?: KhovtMasterVtControllerFindParams) => {
|
||||||
|
return [`/khovt-master-vts`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtMasterVtControllerFindQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterVtControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterVtControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterVtControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtMasterVtControllerFindQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtMasterVtControllerFind>>> = ({ signal }) =>
|
||||||
|
khovtMasterVtControllerFind(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerFind>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtMasterVtControllerFindQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtMasterVtControllerFind>>
|
||||||
|
>;
|
||||||
|
export type KhovtMasterVtControllerFindQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtMasterVtControllerFind = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtMasterVtControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtMasterVtControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtMasterVtControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtMasterVtControllerFindQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,181 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { KhovtMasterNhom, KhovtMasterNhomWithRelations, LoopbackCount } from '../../models';
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerCountResponseMock = (
|
||||||
|
overrideResponse: Partial<LoopbackCount> = {},
|
||||||
|
): LoopbackCount => ({
|
||||||
|
count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterNhomWithRelations> = {},
|
||||||
|
): KhovtMasterNhomWithRelations => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maNhom: faker.word.sample(),
|
||||||
|
tenNhom: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerCreateResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtMasterNhom> = {},
|
||||||
|
): KhovtMasterNhom => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maNhom: faker.word.sample(),
|
||||||
|
tenNhom: faker.word.sample(),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindResponseMock = (): KhovtMasterNhomWithRelations[] =>
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maNhom: faker.word.sample(),
|
||||||
|
tenNhom: faker.word.sample(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerCountMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| LoopbackCount
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-nhoms/count', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtNhomControllerCountResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerUpdateByIdMockHandler = () => {
|
||||||
|
return http.patch('*/khovt-master-nhoms/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterNhomWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterNhomWithRelations> | KhovtMasterNhomWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-nhoms/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtNhomControllerFindByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerDeleteByIdMockHandler = () => {
|
||||||
|
return http.delete('*/khovt-master-nhoms/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerCreateMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterNhom
|
||||||
|
| ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<KhovtMasterNhom> | KhovtMasterNhom),
|
||||||
|
) => {
|
||||||
|
return http.post('*/khovt-master-nhoms', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtNhomControllerCreateResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtMasterNhomWithRelations[]
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtMasterNhomWithRelations[]> | KhovtMasterNhomWithRelations[]),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-master-nhoms', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtNhomControllerFindResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getKhovtNhomControllerMock = () => [
|
||||||
|
getKhovtNhomControllerCountMockHandler(),
|
||||||
|
getKhovtNhomControllerUpdateByIdMockHandler(),
|
||||||
|
getKhovtNhomControllerFindByIdMockHandler(),
|
||||||
|
getKhovtNhomControllerDeleteByIdMockHandler(),
|
||||||
|
getKhovtNhomControllerCreateMockHandler(),
|
||||||
|
getKhovtNhomControllerFindMockHandler(),
|
||||||
|
];
|
||||||
@ -0,0 +1,352 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import type {
|
||||||
|
MutationFunction,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type {
|
||||||
|
KhovtMasterNhom,
|
||||||
|
KhovtMasterNhomPartial,
|
||||||
|
KhovtMasterNhomWithRelations,
|
||||||
|
KhovtNhomControllerCountParams,
|
||||||
|
KhovtNhomControllerFindByIdParams,
|
||||||
|
KhovtNhomControllerFindParams,
|
||||||
|
LoopbackCount,
|
||||||
|
NewKhovtMasterNhom,
|
||||||
|
} from '../../models';
|
||||||
|
|
||||||
|
export const khovtNhomControllerCount = (params?: KhovtNhomControllerCountParams, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<LoopbackCount>({ url: `/khovt-master-nhoms/count`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerCountQueryKey = (params?: KhovtNhomControllerCountParams) => {
|
||||||
|
return [`/khovt-master-nhoms/count`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerCountQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtNhomControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtNhomControllerCountParams,
|
||||||
|
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtNhomControllerCount>>, TError, TData>> },
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtNhomControllerCountQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtNhomControllerCount>>> = ({ signal }) =>
|
||||||
|
khovtNhomControllerCount(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerCount>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtNhomControllerCountQueryResult = NonNullable<Awaited<ReturnType<typeof khovtNhomControllerCount>>>;
|
||||||
|
export type KhovtNhomControllerCountQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtNhomControllerCount = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtNhomControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtNhomControllerCountParams,
|
||||||
|
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtNhomControllerCount>>, TError, TData>> },
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtNhomControllerCountQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtNhomControllerUpdateById = (id: number, khovtMasterNhomPartial: KhovtMasterNhomPartial) => {
|
||||||
|
return drcInstance<unknown>({
|
||||||
|
url: `/khovt-master-nhoms/${id}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: khovtMasterNhomPartial,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerUpdateByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNhomPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNhomPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerUpdateById>>,
|
||||||
|
{ id: number; data: KhovtMasterNhomPartial }
|
||||||
|
> = (props) => {
|
||||||
|
const { id, data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtNhomControllerUpdateById(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtNhomControllerUpdateByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerUpdateById>>
|
||||||
|
>;
|
||||||
|
export type KhovtNhomControllerUpdateByIdMutationBody = KhovtMasterNhomPartial;
|
||||||
|
export type KhovtNhomControllerUpdateByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtNhomControllerUpdateById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNhomPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtMasterNhomPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtNhomControllerUpdateByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtNhomControllerFindById = (
|
||||||
|
id: number,
|
||||||
|
params?: KhovtNhomControllerFindByIdParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtMasterNhomWithRelations>({ url: `/khovt-master-nhoms/${id}`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindByIdQueryKey = (id: number, params?: KhovtNhomControllerFindByIdParams) => {
|
||||||
|
return [`/khovt-master-nhoms/${id}`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindByIdQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtNhomControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtNhomControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtNhomControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtNhomControllerFindByIdQueryKey(id, params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtNhomControllerFindById>>> = ({ signal }) =>
|
||||||
|
khovtNhomControllerFindById(id, params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerFindById>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtNhomControllerFindByIdQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerFindById>>
|
||||||
|
>;
|
||||||
|
export type KhovtNhomControllerFindByIdQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtNhomControllerFindById = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtNhomControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtNhomControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtNhomControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtNhomControllerFindByIdQueryOptions(id, params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtNhomControllerDeleteById = (id: number) => {
|
||||||
|
return drcInstance<unknown>({ url: `/khovt-master-nhoms/${id}`, method: 'DELETE' });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerDeleteByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<Awaited<ReturnType<typeof khovtNhomControllerDeleteById>>, TError, { id: number }, TContext> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<Awaited<ReturnType<typeof khovtNhomControllerDeleteById>>, { id: number }> = (
|
||||||
|
props,
|
||||||
|
) => {
|
||||||
|
const { id } = props ?? {};
|
||||||
|
|
||||||
|
return khovtNhomControllerDeleteById(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtNhomControllerDeleteByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerDeleteById>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type KhovtNhomControllerDeleteByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtNhomControllerDeleteById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<Awaited<ReturnType<typeof khovtNhomControllerDeleteById>>, TError, { id: number }, TContext> => {
|
||||||
|
const mutationOptions = getKhovtNhomControllerDeleteByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtNhomControllerCreate = (newKhovtMasterNhom: NewKhovtMasterNhom) => {
|
||||||
|
return drcInstance<KhovtMasterNhom>({
|
||||||
|
url: `/khovt-master-nhoms`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: newKhovtMasterNhom,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerCreateMutationOptions = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNhom },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNhom },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerCreate>>,
|
||||||
|
{ data: NewKhovtMasterNhom }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtNhomControllerCreate(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtNhomControllerCreateMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerCreate>>
|
||||||
|
>;
|
||||||
|
export type KhovtNhomControllerCreateMutationBody = NewKhovtMasterNhom;
|
||||||
|
export type KhovtNhomControllerCreateMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtNhomControllerCreate = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNhom },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtMasterNhom },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtNhomControllerCreateMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtNhomControllerFind = (params?: KhovtNhomControllerFindParams, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<KhovtMasterNhomWithRelations[]>({ url: `/khovt-master-nhoms`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindQueryKey = (params?: KhovtNhomControllerFindParams) => {
|
||||||
|
return [`/khovt-master-nhoms`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtNhomControllerFindQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtNhomControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtNhomControllerFindParams,
|
||||||
|
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtNhomControllerFind>>, TError, TData>> },
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtNhomControllerFindQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtNhomControllerFind>>> = ({ signal }) =>
|
||||||
|
khovtNhomControllerFind(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtNhomControllerFind>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtNhomControllerFindQueryResult = NonNullable<Awaited<ReturnType<typeof khovtNhomControllerFind>>>;
|
||||||
|
export type KhovtNhomControllerFindQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtNhomControllerFind = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtNhomControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtNhomControllerFindParams,
|
||||||
|
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtNhomControllerFind>>, TError, TData>> },
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtNhomControllerFindQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,504 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { KhovtTransPhieuNhapWithRelations, LoopbackCount } from '../../models';
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerCountResponseMock = (
|
||||||
|
overrideResponse: Partial<LoopbackCount> = {},
|
||||||
|
): LoopbackCount => ({
|
||||||
|
count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerUpdateByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransPhieuNhapWithRelations> = {},
|
||||||
|
): KhovtTransPhieuNhapWithRelations => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
donviId: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maVt: faker.word.sample(),
|
||||||
|
ngayHetHan: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngaySx: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayThiNghiem: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuNhap: faker.helpers.arrayElement([
|
||||||
|
{
|
||||||
|
details: faker.helpers.arrayElement([[], undefined]),
|
||||||
|
donViNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayNhanKqtn: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soHoaDon: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieuNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
typeNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
viTriLuuKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
xeVanChuyen: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuNhapId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soLuong: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
donViNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayNhanKqtn: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soHoaDon: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieuNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
typeNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
viTriLuuKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
xeVanChuyen: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransPhieuNhapWithRelations> = {},
|
||||||
|
): KhovtTransPhieuNhapWithRelations => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
donviId: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maVt: faker.word.sample(),
|
||||||
|
ngayHetHan: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngaySx: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayThiNghiem: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuNhap: faker.helpers.arrayElement([
|
||||||
|
{
|
||||||
|
details: faker.helpers.arrayElement([[], undefined]),
|
||||||
|
donViNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayNhanKqtn: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soHoaDon: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieuNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
typeNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
viTriLuuKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
xeVanChuyen: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuNhapId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soLuong: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
donViNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayNhanKqtn: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soHoaDon: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieuNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
typeNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
viTriLuuKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
xeVanChuyen: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerCreateResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransPhieuNhapWithRelations> = {},
|
||||||
|
): KhovtTransPhieuNhapWithRelations => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
donviId: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maVt: faker.word.sample(),
|
||||||
|
ngayHetHan: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngaySx: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayThiNghiem: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuNhap: faker.helpers.arrayElement([
|
||||||
|
{
|
||||||
|
details: faker.helpers.arrayElement([[], undefined]),
|
||||||
|
donViNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayNhanKqtn: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soHoaDon: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieuNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
typeNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
viTriLuuKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
xeVanChuyen: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuNhapId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soLuong: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
donViNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayNhanKqtn: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soHoaDon: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieuNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
typeNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
viTriLuuKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
xeVanChuyen: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindResponseMock = (): KhovtTransPhieuNhapWithRelations[] =>
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
donviId: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maVt: faker.word.sample(),
|
||||||
|
ngayHetHan: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngaySx: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayThiNghiem: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuNhapId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soLuong: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
donViNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayNhanKqtn: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ngayNhap: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soHoaDon: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieuNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
typeNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
viTriLuuKho: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
xeVanChuyen: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerCountMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| LoopbackCount
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-phieu-nhaps/count', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuNhapControllerCountResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerUpdateByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuNhapWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.patch>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuNhapWithRelations> | KhovtTransPhieuNhapWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.patch('*/khovt-trans-phieu-nhaps/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuNhapControllerUpdateByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuNhapWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuNhapWithRelations> | KhovtTransPhieuNhapWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-phieu-nhaps/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuNhapControllerFindByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerDeleteByIdMockHandler = () => {
|
||||||
|
return http.delete('*/khovt-trans-phieu-nhaps/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerCreateMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuNhapWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuNhapWithRelations> | KhovtTransPhieuNhapWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.post('*/khovt-trans-phieu-nhaps', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuNhapControllerCreateResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuNhapWithRelations[]
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuNhapWithRelations[]> | KhovtTransPhieuNhapWithRelations[]),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-phieu-nhaps', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuNhapControllerFindResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getKhovtTransPhieuNhapControllerMock = () => [
|
||||||
|
getKhovtTransPhieuNhapControllerCountMockHandler(),
|
||||||
|
getKhovtTransPhieuNhapControllerUpdateByIdMockHandler(),
|
||||||
|
getKhovtTransPhieuNhapControllerFindByIdMockHandler(),
|
||||||
|
getKhovtTransPhieuNhapControllerDeleteByIdMockHandler(),
|
||||||
|
getKhovtTransPhieuNhapControllerCreateMockHandler(),
|
||||||
|
getKhovtTransPhieuNhapControllerFindMockHandler(),
|
||||||
|
];
|
||||||
@ -0,0 +1,388 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import type {
|
||||||
|
MutationFunction,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type {
|
||||||
|
CreatePhieuNhapRequest,
|
||||||
|
CreatePhieuNhapRequestPartial,
|
||||||
|
KhovtTransPhieuNhapControllerCountParams,
|
||||||
|
KhovtTransPhieuNhapControllerFindParams,
|
||||||
|
KhovtTransPhieuNhapWithRelations,
|
||||||
|
LoopbackCount,
|
||||||
|
} from '../../models';
|
||||||
|
|
||||||
|
export const khovtTransPhieuNhapControllerCount = (
|
||||||
|
params?: KhovtTransPhieuNhapControllerCountParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<LoopbackCount>({ url: `/khovt-trans-phieu-nhaps/count`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerCountQueryKey = (params?: KhovtTransPhieuNhapControllerCountParams) => {
|
||||||
|
return [`/khovt-trans-phieu-nhaps/count`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerCountQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuNhapControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransPhieuNhapControllerCountQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCount>>> = ({ signal }) =>
|
||||||
|
khovtTransPhieuNhapControllerCount(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCount>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuNhapControllerCountQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCount>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuNhapControllerCountQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuNhapControllerCount = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuNhapControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransPhieuNhapControllerCountQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtTransPhieuNhapControllerUpdateById = (
|
||||||
|
id: number,
|
||||||
|
createPhieuNhapRequestPartial: CreatePhieuNhapRequestPartial,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtTransPhieuNhapWithRelations>({
|
||||||
|
url: `/khovt-trans-phieu-nhaps/${id}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: createPhieuNhapRequestPartial,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerUpdateByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuNhapRequestPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuNhapRequestPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerUpdateById>>,
|
||||||
|
{ id: number; data: CreatePhieuNhapRequestPartial }
|
||||||
|
> = (props) => {
|
||||||
|
const { id, data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransPhieuNhapControllerUpdateById(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuNhapControllerUpdateByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerUpdateById>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuNhapControllerUpdateByIdMutationBody = CreatePhieuNhapRequestPartial;
|
||||||
|
export type KhovtTransPhieuNhapControllerUpdateByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuNhapControllerUpdateById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuNhapRequestPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuNhapRequestPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransPhieuNhapControllerUpdateByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransPhieuNhapControllerFindById = (id: number, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<KhovtTransPhieuNhapWithRelations>({
|
||||||
|
url: `/khovt-trans-phieu-nhaps/${id}`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindByIdQueryKey = (id: number) => {
|
||||||
|
return [`/khovt-trans-phieu-nhaps/${id}`] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindByIdQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransPhieuNhapControllerFindByIdQueryKey(id);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFindById>>> = ({ signal }) =>
|
||||||
|
khovtTransPhieuNhapControllerFindById(id, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFindById>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuNhapControllerFindByIdQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFindById>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuNhapControllerFindByIdQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuNhapControllerFindById = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransPhieuNhapControllerFindByIdQueryOptions(id, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtTransPhieuNhapControllerDeleteById = (id: number) => {
|
||||||
|
return drcInstance<unknown>({ url: `/khovt-trans-phieu-nhaps/${id}`, method: 'DELETE' });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerDeleteByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerDeleteById>>,
|
||||||
|
{ id: number }
|
||||||
|
> = (props) => {
|
||||||
|
const { id } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransPhieuNhapControllerDeleteById(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuNhapControllerDeleteByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerDeleteById>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type KhovtTransPhieuNhapControllerDeleteByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuNhapControllerDeleteById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransPhieuNhapControllerDeleteByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransPhieuNhapControllerCreate = (createPhieuNhapRequest: CreatePhieuNhapRequest) => {
|
||||||
|
return drcInstance<KhovtTransPhieuNhapWithRelations>({
|
||||||
|
url: `/khovt-trans-phieu-nhaps`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: createPhieuNhapRequest,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerCreateMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuNhapRequest },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuNhapRequest },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCreate>>,
|
||||||
|
{ data: CreatePhieuNhapRequest }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransPhieuNhapControllerCreate(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuNhapControllerCreateMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCreate>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuNhapControllerCreateMutationBody = CreatePhieuNhapRequest;
|
||||||
|
export type KhovtTransPhieuNhapControllerCreateMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuNhapControllerCreate = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuNhapRequest },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuNhapRequest },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransPhieuNhapControllerCreateMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransPhieuNhapControllerFind = (
|
||||||
|
params?: KhovtTransPhieuNhapControllerFindParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtTransPhieuNhapWithRelations[]>({
|
||||||
|
url: `/khovt-trans-phieu-nhaps`,
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindQueryKey = (params?: KhovtTransPhieuNhapControllerFindParams) => {
|
||||||
|
return [`/khovt-trans-phieu-nhaps`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuNhapControllerFindQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuNhapControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransPhieuNhapControllerFindQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFind>>> = ({ signal }) =>
|
||||||
|
khovtTransPhieuNhapControllerFind(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFind>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuNhapControllerFindQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFind>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuNhapControllerFindQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuNhapControllerFind = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuNhapControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuNhapControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransPhieuNhapControllerFindQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,415 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { KhovtTransPhieuXuatWithRelations, LoopbackCount } from '../../models';
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerCreateResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransPhieuXuatWithRelations> = {},
|
||||||
|
): KhovtTransPhieuXuatWithRelations => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
phieuXuat: faker.helpers.arrayElement([
|
||||||
|
{
|
||||||
|
details: faker.helpers.arrayElement([[], undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayXuat: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiTaoPhieu: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.word.sample(), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
thongTinCanhBao: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.word.sample(), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLuongThucTe: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
soLuongYeuCau: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayXuat: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerCountResponseMock = (
|
||||||
|
overrideResponse: Partial<LoopbackCount> = {},
|
||||||
|
): LoopbackCount => ({
|
||||||
|
count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerUpdateByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransPhieuXuatWithRelations> = {},
|
||||||
|
): KhovtTransPhieuXuatWithRelations => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
phieuXuat: faker.helpers.arrayElement([
|
||||||
|
{
|
||||||
|
details: faker.helpers.arrayElement([[], undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayXuat: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiTaoPhieu: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.word.sample(), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
thongTinCanhBao: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.word.sample(), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLuongThucTe: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
soLuongYeuCau: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayXuat: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransPhieuXuatWithRelations> = {},
|
||||||
|
): KhovtTransPhieuXuatWithRelations => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
phieuXuat: faker.helpers.arrayElement([
|
||||||
|
{
|
||||||
|
details: faker.helpers.arrayElement([[], undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayXuat: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiTaoPhieu: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.word.sample(), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
thongTinCanhBao: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.word.sample(), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLuongThucTe: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
soLuongYeuCau: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayXuat: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindResponseMock = (): KhovtTransPhieuXuatWithRelations[] =>
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
details: faker.helpers.arrayElement([
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
foreignKey: faker.helpers.arrayElement([{}, undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
maLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
nguonGoc: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
phieuXuatId: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
soLuongThucTe: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
soLuongYeuCau: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonKho: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
})),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
khoNhap: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
khoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
lyDoXuat: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ngayXuat: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([`${faker.date.past().toISOString().split('.')[0]}Z`, null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
nguoiTaoPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soPhieu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
status: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
thongTinCanhBao: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerCreateMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuXuatWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuXuatWithRelations> | KhovtTransPhieuXuatWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.post('*/khovt-trans-phieu-xuat', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuXuatControllerCreateResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerCountMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| LoopbackCount
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-phieu-xuats/count', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuXuatControllerCountResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerUpdateByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuXuatWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.patch>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuXuatWithRelations> | KhovtTransPhieuXuatWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.patch('*/khovt-trans-phieu-xuats/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuXuatControllerUpdateByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuXuatWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuXuatWithRelations> | KhovtTransPhieuXuatWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-phieu-xuats/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuXuatControllerFindByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerDeleteByIdMockHandler = () => {
|
||||||
|
return http.delete('*/khovt-trans-phieu-xuats/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransPhieuXuatWithRelations[]
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtTransPhieuXuatWithRelations[]> | KhovtTransPhieuXuatWithRelations[]),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-phieu-xuats', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransPhieuXuatControllerFindResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getKhovtTransPhieuXuatControllerMock = () => [
|
||||||
|
getKhovtTransPhieuXuatControllerCreateMockHandler(),
|
||||||
|
getKhovtTransPhieuXuatControllerCountMockHandler(),
|
||||||
|
getKhovtTransPhieuXuatControllerUpdateByIdMockHandler(),
|
||||||
|
getKhovtTransPhieuXuatControllerFindByIdMockHandler(),
|
||||||
|
getKhovtTransPhieuXuatControllerDeleteByIdMockHandler(),
|
||||||
|
getKhovtTransPhieuXuatControllerFindMockHandler(),
|
||||||
|
];
|
||||||
@ -0,0 +1,384 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import type {
|
||||||
|
MutationFunction,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type {
|
||||||
|
CreatePhieuXuatRequest,
|
||||||
|
KhovtTransPhieuXuatControllerCountParams,
|
||||||
|
KhovtTransPhieuXuatControllerFindParams,
|
||||||
|
KhovtTransPhieuXuatWithRelations,
|
||||||
|
LoopbackCount,
|
||||||
|
} from '../../models';
|
||||||
|
|
||||||
|
export const khovtTransPhieuXuatControllerCreate = (createPhieuXuatRequest: CreatePhieuXuatRequest) => {
|
||||||
|
return drcInstance<KhovtTransPhieuXuatWithRelations>({
|
||||||
|
url: `/khovt-trans-phieu-xuat`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: createPhieuXuatRequest,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerCreateMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCreate>>,
|
||||||
|
{ data: CreatePhieuXuatRequest }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransPhieuXuatControllerCreate(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuXuatControllerCreateMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCreate>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuXuatControllerCreateMutationBody = CreatePhieuXuatRequest;
|
||||||
|
export type KhovtTransPhieuXuatControllerCreateMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuXuatControllerCreate = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransPhieuXuatControllerCreateMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransPhieuXuatControllerCount = (
|
||||||
|
params?: KhovtTransPhieuXuatControllerCountParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<LoopbackCount>({ url: `/khovt-trans-phieu-xuats/count`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerCountQueryKey = (params?: KhovtTransPhieuXuatControllerCountParams) => {
|
||||||
|
return [`/khovt-trans-phieu-xuats/count`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerCountQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuXuatControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransPhieuXuatControllerCountQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCount>>> = ({ signal }) =>
|
||||||
|
khovtTransPhieuXuatControllerCount(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCount>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuXuatControllerCountQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCount>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuXuatControllerCountQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuXuatControllerCount = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuXuatControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransPhieuXuatControllerCountQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtTransPhieuXuatControllerUpdateById = (id: number, createPhieuXuatRequest: CreatePhieuXuatRequest) => {
|
||||||
|
return drcInstance<KhovtTransPhieuXuatWithRelations>({
|
||||||
|
url: `/khovt-trans-phieu-xuats/${id}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: createPhieuXuatRequest,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerUpdateByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerUpdateById>>,
|
||||||
|
{ id: number; data: CreatePhieuXuatRequest }
|
||||||
|
> = (props) => {
|
||||||
|
const { id, data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransPhieuXuatControllerUpdateById(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuXuatControllerUpdateByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerUpdateById>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuXuatControllerUpdateByIdMutationBody = CreatePhieuXuatRequest;
|
||||||
|
export type KhovtTransPhieuXuatControllerUpdateByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuXuatControllerUpdateById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: CreatePhieuXuatRequest },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransPhieuXuatControllerUpdateByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransPhieuXuatControllerFindById = (id: number, signal?: AbortSignal) => {
|
||||||
|
return drcInstance<KhovtTransPhieuXuatWithRelations>({
|
||||||
|
url: `/khovt-trans-phieu-xuats/${id}`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindByIdQueryKey = (id: number) => {
|
||||||
|
return [`/khovt-trans-phieu-xuats/${id}`] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindByIdQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransPhieuXuatControllerFindByIdQueryKey(id);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFindById>>> = ({ signal }) =>
|
||||||
|
khovtTransPhieuXuatControllerFindById(id, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFindById>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuXuatControllerFindByIdQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFindById>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuXuatControllerFindByIdQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuXuatControllerFindById = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransPhieuXuatControllerFindByIdQueryOptions(id, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtTransPhieuXuatControllerDeleteById = (id: number) => {
|
||||||
|
return drcInstance<unknown>({ url: `/khovt-trans-phieu-xuats/${id}`, method: 'DELETE' });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerDeleteByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerDeleteById>>,
|
||||||
|
{ id: number }
|
||||||
|
> = (props) => {
|
||||||
|
const { id } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransPhieuXuatControllerDeleteById(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuXuatControllerDeleteByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerDeleteById>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type KhovtTransPhieuXuatControllerDeleteByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuXuatControllerDeleteById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransPhieuXuatControllerDeleteByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransPhieuXuatControllerFind = (
|
||||||
|
params?: KhovtTransPhieuXuatControllerFindParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtTransPhieuXuatWithRelations[]>({
|
||||||
|
url: `/khovt-trans-phieu-xuats`,
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindQueryKey = (params?: KhovtTransPhieuXuatControllerFindParams) => {
|
||||||
|
return [`/khovt-trans-phieu-xuats`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransPhieuXuatControllerFindQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuXuatControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransPhieuXuatControllerFindQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFind>>> = ({ signal }) =>
|
||||||
|
khovtTransPhieuXuatControllerFind(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFind>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransPhieuXuatControllerFindQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFind>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransPhieuXuatControllerFindQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransPhieuXuatControllerFind = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransPhieuXuatControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransPhieuXuatControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransPhieuXuatControllerFindQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,226 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { KhovtTransThanhKhoan, KhovtTransThanhKhoanWithRelations, LoopbackCount } from '../../models';
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerCountResponseMock = (
|
||||||
|
overrideResponse: Partial<LoopbackCount> = {},
|
||||||
|
): LoopbackCount => ({
|
||||||
|
count: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindByIdResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransThanhKhoanWithRelations> = {},
|
||||||
|
): KhovtTransThanhKhoanWithRelations => ({
|
||||||
|
dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
kiemKe: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
kyThanhKhoan: faker.word.sample(),
|
||||||
|
maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonCuoiKy: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
tonDauKy: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerCreateResponseMock = (
|
||||||
|
overrideResponse: Partial<KhovtTransThanhKhoan> = {},
|
||||||
|
): KhovtTransThanhKhoan => ({
|
||||||
|
dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
kiemKe: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
kyThanhKhoan: faker.word.sample(),
|
||||||
|
maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonCuoiKy: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
tonDauKy: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindResponseMock = (): KhovtTransThanhKhoanWithRelations[] =>
|
||||||
|
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
||||||
|
dvt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
ghiChu: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
id: faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), undefined]),
|
||||||
|
kiemKe: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
kyThanhKhoan: faker.word.sample(),
|
||||||
|
maVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
soLo: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tenVt: faker.helpers.arrayElement([faker.helpers.arrayElement([faker.word.sample(), null]), undefined]),
|
||||||
|
tonCuoiKy: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
tonDauKy: faker.helpers.arrayElement([
|
||||||
|
faker.helpers.arrayElement([faker.number.int({ min: undefined, max: undefined }), null]),
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerCountMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| LoopbackCount
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<LoopbackCount> | LoopbackCount),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-thanh-khoans/count', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransThanhKhoanControllerCountResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerUpdateByIdMockHandler = () => {
|
||||||
|
return http.patch('*/khovt-trans-thanh-khoans/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindByIdMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransThanhKhoanWithRelations
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtTransThanhKhoanWithRelations> | KhovtTransThanhKhoanWithRelations),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-thanh-khoans/:id', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransThanhKhoanControllerFindByIdResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerDeleteByIdMockHandler = () => {
|
||||||
|
return http.delete('*/khovt-trans-thanh-khoans/:id', async () => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(null, {
|
||||||
|
status: 204,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerCreateMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransThanhKhoan
|
||||||
|
| ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<KhovtTransThanhKhoan> | KhovtTransThanhKhoan),
|
||||||
|
) => {
|
||||||
|
return http.post('*/khovt-trans-thanh-khoans', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransThanhKhoanControllerCreateResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| KhovtTransThanhKhoanWithRelations[]
|
||||||
|
| ((
|
||||||
|
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
||||||
|
) => Promise<KhovtTransThanhKhoanWithRelations[]> | KhovtTransThanhKhoanWithRelations[]),
|
||||||
|
) => {
|
||||||
|
return http.get('*/khovt-trans-thanh-khoans', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getKhovtTransThanhKhoanControllerFindResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getKhovtTransThanhKhoanControllerMock = () => [
|
||||||
|
getKhovtTransThanhKhoanControllerCountMockHandler(),
|
||||||
|
getKhovtTransThanhKhoanControllerUpdateByIdMockHandler(),
|
||||||
|
getKhovtTransThanhKhoanControllerFindByIdMockHandler(),
|
||||||
|
getKhovtTransThanhKhoanControllerDeleteByIdMockHandler(),
|
||||||
|
getKhovtTransThanhKhoanControllerCreateMockHandler(),
|
||||||
|
getKhovtTransThanhKhoanControllerFindMockHandler(),
|
||||||
|
];
|
||||||
@ -0,0 +1,400 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import type {
|
||||||
|
MutationFunction,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type {
|
||||||
|
KhovtTransThanhKhoan,
|
||||||
|
KhovtTransThanhKhoanControllerCountParams,
|
||||||
|
KhovtTransThanhKhoanControllerFindByIdParams,
|
||||||
|
KhovtTransThanhKhoanControllerFindParams,
|
||||||
|
KhovtTransThanhKhoanPartial,
|
||||||
|
KhovtTransThanhKhoanWithRelations,
|
||||||
|
LoopbackCount,
|
||||||
|
NewKhovtTransThanhKhoan,
|
||||||
|
} from '../../models';
|
||||||
|
|
||||||
|
export const khovtTransThanhKhoanControllerCount = (
|
||||||
|
params?: KhovtTransThanhKhoanControllerCountParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<LoopbackCount>({ url: `/khovt-trans-thanh-khoans/count`, method: 'GET', params, signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerCountQueryKey = (params?: KhovtTransThanhKhoanControllerCountParams) => {
|
||||||
|
return [`/khovt-trans-thanh-khoans/count`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerCountQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransThanhKhoanControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransThanhKhoanControllerCountQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCount>>> = ({ signal }) =>
|
||||||
|
khovtTransThanhKhoanControllerCount(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCount>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransThanhKhoanControllerCountQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCount>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransThanhKhoanControllerCountQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransThanhKhoanControllerCount = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCount>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransThanhKhoanControllerCountParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCount>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransThanhKhoanControllerCountQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtTransThanhKhoanControllerUpdateById = (
|
||||||
|
id: number,
|
||||||
|
khovtTransThanhKhoanPartial: KhovtTransThanhKhoanPartial,
|
||||||
|
) => {
|
||||||
|
return drcInstance<unknown>({
|
||||||
|
url: `/khovt-trans-thanh-khoans/${id}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: khovtTransThanhKhoanPartial,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerUpdateByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtTransThanhKhoanPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtTransThanhKhoanPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerUpdateById>>,
|
||||||
|
{ id: number; data: KhovtTransThanhKhoanPartial }
|
||||||
|
> = (props) => {
|
||||||
|
const { id, data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransThanhKhoanControllerUpdateById(id, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransThanhKhoanControllerUpdateByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerUpdateById>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransThanhKhoanControllerUpdateByIdMutationBody = KhovtTransThanhKhoanPartial;
|
||||||
|
export type KhovtTransThanhKhoanControllerUpdateByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransThanhKhoanControllerUpdateById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtTransThanhKhoanPartial },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerUpdateById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number; data: KhovtTransThanhKhoanPartial },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransThanhKhoanControllerUpdateByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransThanhKhoanControllerFindById = (
|
||||||
|
id: number,
|
||||||
|
params?: KhovtTransThanhKhoanControllerFindByIdParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtTransThanhKhoanWithRelations>({
|
||||||
|
url: `/khovt-trans-thanh-khoans/${id}`,
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindByIdQueryKey = (
|
||||||
|
id: number,
|
||||||
|
params?: KhovtTransThanhKhoanControllerFindByIdParams,
|
||||||
|
) => {
|
||||||
|
return [`/khovt-trans-thanh-khoans/${id}`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindByIdQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtTransThanhKhoanControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransThanhKhoanControllerFindByIdQueryKey(id, params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFindById>>> = ({ signal }) =>
|
||||||
|
khovtTransThanhKhoanControllerFindById(id, params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFindById>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransThanhKhoanControllerFindByIdQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFindById>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransThanhKhoanControllerFindByIdQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransThanhKhoanControllerFindById = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFindById>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
id: number,
|
||||||
|
params?: KhovtTransThanhKhoanControllerFindByIdParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFindById>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransThanhKhoanControllerFindByIdQueryOptions(id, params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const khovtTransThanhKhoanControllerDeleteById = (id: number) => {
|
||||||
|
return drcInstance<unknown>({ url: `/khovt-trans-thanh-khoans/${id}`, method: 'DELETE' });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerDeleteByIdMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerDeleteById>>,
|
||||||
|
{ id: number }
|
||||||
|
> = (props) => {
|
||||||
|
const { id } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransThanhKhoanControllerDeleteById(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransThanhKhoanControllerDeleteByIdMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerDeleteById>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type KhovtTransThanhKhoanControllerDeleteByIdMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransThanhKhoanControllerDeleteById = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerDeleteById>>,
|
||||||
|
TError,
|
||||||
|
{ id: number },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransThanhKhoanControllerDeleteByIdMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransThanhKhoanControllerCreate = (newKhovtTransThanhKhoan: NewKhovtTransThanhKhoan) => {
|
||||||
|
return drcInstance<KhovtTransThanhKhoan>({
|
||||||
|
url: `/khovt-trans-thanh-khoans`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: newKhovtTransThanhKhoan,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerCreateMutationOptions = <
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
TContext = unknown,
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtTransThanhKhoan },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtTransThanhKhoan },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const { mutation: mutationOptions } = options ?? {};
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCreate>>,
|
||||||
|
{ data: NewKhovtTransThanhKhoan }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return khovtTransThanhKhoanControllerCreate(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransThanhKhoanControllerCreateMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCreate>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransThanhKhoanControllerCreateMutationBody = NewKhovtTransThanhKhoan;
|
||||||
|
export type KhovtTransThanhKhoanControllerCreateMutationError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransThanhKhoanControllerCreate = <TError = ErrorType<unknown>, TContext = unknown>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtTransThanhKhoan },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerCreate>>,
|
||||||
|
TError,
|
||||||
|
{ data: NewKhovtTransThanhKhoan },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getKhovtTransThanhKhoanControllerCreateMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
export const khovtTransThanhKhoanControllerFind = (
|
||||||
|
params?: KhovtTransThanhKhoanControllerFindParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
return drcInstance<KhovtTransThanhKhoanWithRelations[]>({
|
||||||
|
url: `/khovt-trans-thanh-khoans`,
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindQueryKey = (params?: KhovtTransThanhKhoanControllerFindParams) => {
|
||||||
|
return [`/khovt-trans-thanh-khoans`, ...(params ? [params] : [])] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKhovtTransThanhKhoanControllerFindQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransThanhKhoanControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getKhovtTransThanhKhoanControllerFindQueryKey(params);
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFind>>> = ({ signal }) =>
|
||||||
|
khovtTransThanhKhoanControllerFind(params, signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFind>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KhovtTransThanhKhoanControllerFindQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFind>>
|
||||||
|
>;
|
||||||
|
export type KhovtTransThanhKhoanControllerFindQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const useKhovtTransThanhKhoanControllerFind = <
|
||||||
|
TData = Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFind>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(
|
||||||
|
params?: KhovtTransThanhKhoanControllerFindParams,
|
||||||
|
options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof khovtTransThanhKhoanControllerFind>>, TError, TData>>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getKhovtTransThanhKhoanControllerFindQueryOptions(params, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import { HttpResponse, delay, http } from 'msw';
|
||||||
|
import type { PingResponse } from '../../models';
|
||||||
|
|
||||||
|
export const getPingControllerPingResponseMock = (overrideResponse: Partial<PingResponse> = {}): PingResponse => ({
|
||||||
|
date: faker.helpers.arrayElement([faker.word.sample(), undefined]),
|
||||||
|
greeting: faker.helpers.arrayElement([faker.word.sample(), undefined]),
|
||||||
|
headers: faker.helpers.arrayElement([
|
||||||
|
{ 'Content-Type': faker.helpers.arrayElement([faker.word.sample(), undefined]) },
|
||||||
|
undefined,
|
||||||
|
]),
|
||||||
|
url: faker.helpers.arrayElement([faker.word.sample(), undefined]),
|
||||||
|
...overrideResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getPingControllerPingMockHandler = (
|
||||||
|
overrideResponse?:
|
||||||
|
| PingResponse
|
||||||
|
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<PingResponse> | PingResponse),
|
||||||
|
) => {
|
||||||
|
return http.get('*/ping', async (info) => {
|
||||||
|
await delay(1000);
|
||||||
|
return new HttpResponse(
|
||||||
|
JSON.stringify(
|
||||||
|
overrideResponse !== undefined
|
||||||
|
? typeof overrideResponse === 'function'
|
||||||
|
? await overrideResponse(info)
|
||||||
|
: overrideResponse
|
||||||
|
: getPingControllerPingResponseMock(),
|
||||||
|
),
|
||||||
|
{
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const getPingControllerMock = () => [getPingControllerPingMockHandler()];
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import type { QueryFunction, QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
||||||
|
import { drcInstance } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { ErrorType } from '../../../configs/mutator/drc-instance';
|
||||||
|
import type { PingResponse } from '../../models';
|
||||||
|
|
||||||
|
export const pingControllerPing = (signal?: AbortSignal) => {
|
||||||
|
return drcInstance<PingResponse>({ url: `/ping`, method: 'GET', signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getPingControllerPingQueryKey = () => {
|
||||||
|
return [`/ping`] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getPingControllerPingQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof pingControllerPing>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof pingControllerPing>>, TError, TData>>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getPingControllerPingQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof pingControllerPing>>> = ({ signal }) =>
|
||||||
|
pingControllerPing(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof pingControllerPing>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PingControllerPingQueryResult = NonNullable<Awaited<ReturnType<typeof pingControllerPing>>>;
|
||||||
|
export type PingControllerPingQueryError = ErrorType<unknown>;
|
||||||
|
|
||||||
|
export const usePingControllerPing = <
|
||||||
|
TData = Awaited<ReturnType<typeof pingControllerPing>>,
|
||||||
|
TError = ErrorType<unknown>,
|
||||||
|
>(options?: {
|
||||||
|
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof pingControllerPing>>, TError, TData>>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
||||||
|
const queryOptions = getPingControllerPingQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
};
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type AuthenticationControllerLogin200 = {
|
||||||
|
token?: string;
|
||||||
|
};
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtTransPhieunhapDetail } from './khovtTransPhieunhapDetail';
|
||||||
|
|
||||||
|
export interface CreatePhieuNhapRequest {
|
||||||
|
details?: KhovtTransPhieunhapDetail[];
|
||||||
|
/** @nullable */
|
||||||
|
donViNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** @nullable */
|
||||||
|
maKho?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
ngayNhanKqtn?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
ngayNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
nguoiNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
soHoaDon?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
soPhieuNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
typeNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
viTriLuuKho?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
xeVanChuyen?: string | null;
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtTransPhieunhapDetail } from './khovtTransPhieunhapDetail';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (tsType: Partial<CreatePhieuNhapRequest>, schemaOptions: { partial: true })
|
||||||
|
*/
|
||||||
|
export interface CreatePhieuNhapRequestPartial {
|
||||||
|
details?: KhovtTransPhieunhapDetail[];
|
||||||
|
/** @nullable */
|
||||||
|
donViNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** @nullable */
|
||||||
|
maKho?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
ngayNhanKqtn?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
ngayNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
nguoiNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
soHoaDon?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
soPhieuNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
typeNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
viTriLuuKho?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
xeVanChuyen?: string | null;
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtTransPhieuXuatDetail } from './khovtTransPhieuXuatDetail';
|
||||||
|
|
||||||
|
export interface CreatePhieuXuatRequest {
|
||||||
|
details?: KhovtTransPhieuXuatDetail[];
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** @nullable */
|
||||||
|
khoNhap?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
khoXuat?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
lyDoXuat?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
ngayXuat?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
nguoiTaoPhieu?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
soPhieu?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
status?: string | null;
|
||||||
|
/** @nullable */
|
||||||
|
thongTinCanhBao?: string | null;
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface Credentials {
|
||||||
|
email: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (tsType: CredentialsWithRelations, schemaOptions: { includeRelations: true })
|
||||||
|
*/
|
||||||
|
export interface CredentialsWithRelations {
|
||||||
|
email: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,147 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from './authenticationControllerLogin200';
|
||||||
|
export * from './createPhieuNhapRequest';
|
||||||
|
export * from './createPhieuNhapRequestPartial';
|
||||||
|
export * from './createPhieuXuatRequest';
|
||||||
|
export * from './credentials';
|
||||||
|
export * from './credentialsWithRelations';
|
||||||
|
export * from './khovtMasterKho';
|
||||||
|
export * from './khovtMasterKhoControllerCountParams';
|
||||||
|
export * from './khovtMasterKhoControllerFindByIdParams';
|
||||||
|
export * from './khovtMasterKhoControllerFindParams';
|
||||||
|
export * from './khovtMasterKhoFilter';
|
||||||
|
export * from './khovtMasterKhoFilter1';
|
||||||
|
export * from './khovtMasterKhoFilter1Fields';
|
||||||
|
export * from './khovtMasterKhoFilter1FieldsOneOf';
|
||||||
|
export * from './khovtMasterKhoFilter1FieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterKhoFilter1Order';
|
||||||
|
export * from './khovtMasterKhoFilter1Where';
|
||||||
|
export * from './khovtMasterKhoFilterFields';
|
||||||
|
export * from './khovtMasterKhoFilterFieldsOneOf';
|
||||||
|
export * from './khovtMasterKhoFilterFieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterKhoFilterOrder';
|
||||||
|
export * from './khovtMasterKhoPartial';
|
||||||
|
export * from './khovtMasterKhoWithRelations';
|
||||||
|
export * from './khovtMasterNguonGoc';
|
||||||
|
export * from './khovtMasterNguonGocControllerCountParams';
|
||||||
|
export * from './khovtMasterNguonGocControllerFindByIdParams';
|
||||||
|
export * from './khovtMasterNguonGocControllerFindParams';
|
||||||
|
export * from './khovtMasterNguonGocFilter';
|
||||||
|
export * from './khovtMasterNguonGocFilter1';
|
||||||
|
export * from './khovtMasterNguonGocFilter1Fields';
|
||||||
|
export * from './khovtMasterNguonGocFilter1FieldsOneOf';
|
||||||
|
export * from './khovtMasterNguonGocFilter1FieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterNguonGocFilter1Order';
|
||||||
|
export * from './khovtMasterNguonGocFilter1Where';
|
||||||
|
export * from './khovtMasterNguonGocFilterFields';
|
||||||
|
export * from './khovtMasterNguonGocFilterFieldsOneOf';
|
||||||
|
export * from './khovtMasterNguonGocFilterFieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterNguonGocFilterOrder';
|
||||||
|
export * from './khovtMasterNguonGocPartial';
|
||||||
|
export * from './khovtMasterNguonGocWithRelations';
|
||||||
|
export * from './khovtMasterNhom';
|
||||||
|
export * from './khovtMasterNhomFilter';
|
||||||
|
export * from './khovtMasterNhomFilter1';
|
||||||
|
export * from './khovtMasterNhomFilter1Fields';
|
||||||
|
export * from './khovtMasterNhomFilter1FieldsOneOf';
|
||||||
|
export * from './khovtMasterNhomFilter1FieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterNhomFilter1Order';
|
||||||
|
export * from './khovtMasterNhomFilter1Where';
|
||||||
|
export * from './khovtMasterNhomFilterFields';
|
||||||
|
export * from './khovtMasterNhomFilterFieldsOneOf';
|
||||||
|
export * from './khovtMasterNhomFilterFieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterNhomFilterOrder';
|
||||||
|
export * from './khovtMasterNhomPartial';
|
||||||
|
export * from './khovtMasterNhomWithRelations';
|
||||||
|
export * from './khovtMasterVt';
|
||||||
|
export * from './khovtMasterVtControllerCountParams';
|
||||||
|
export * from './khovtMasterVtControllerFindByIdParams';
|
||||||
|
export * from './khovtMasterVtControllerFindParams';
|
||||||
|
export * from './khovtMasterVtFilter';
|
||||||
|
export * from './khovtMasterVtFilter1';
|
||||||
|
export * from './khovtMasterVtFilter1Fields';
|
||||||
|
export * from './khovtMasterVtFilter1FieldsOneOf';
|
||||||
|
export * from './khovtMasterVtFilter1FieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterVtFilter1Order';
|
||||||
|
export * from './khovtMasterVtFilter1Where';
|
||||||
|
export * from './khovtMasterVtFilterFields';
|
||||||
|
export * from './khovtMasterVtFilterFieldsOneOf';
|
||||||
|
export * from './khovtMasterVtFilterFieldsOneOfTwoItem';
|
||||||
|
export * from './khovtMasterVtFilterOrder';
|
||||||
|
export * from './khovtMasterVtPartial';
|
||||||
|
export * from './khovtMasterVtWithRelations';
|
||||||
|
export * from './khovtNhomControllerCountParams';
|
||||||
|
export * from './khovtNhomControllerFindByIdParams';
|
||||||
|
export * from './khovtNhomControllerFindParams';
|
||||||
|
export * from './khovtTransPhieuNhapControllerCountParams';
|
||||||
|
export * from './khovtTransPhieuNhapControllerFindParams';
|
||||||
|
export * from './khovtTransPhieuNhapFilter';
|
||||||
|
export * from './khovtTransPhieuNhapFilterFields';
|
||||||
|
export * from './khovtTransPhieuNhapFilterFieldsOneOf';
|
||||||
|
export * from './khovtTransPhieuNhapFilterFieldsOneOfTwoItem';
|
||||||
|
export * from './khovtTransPhieuNhapFilterIncludeItem';
|
||||||
|
export * from './khovtTransPhieuNhapFilterOrder';
|
||||||
|
export * from './khovtTransPhieuNhapFilterWhere';
|
||||||
|
export * from './khovtTransPhieuNhapIncludeFilterItems';
|
||||||
|
export * from './khovtTransPhieuNhapIncludeFilterItemsRelation';
|
||||||
|
export * from './khovtTransPhieuNhapScopeFilter';
|
||||||
|
export * from './khovtTransPhieuNhapScopeFilterFields';
|
||||||
|
export * from './khovtTransPhieuNhapScopeFilterFieldsOneOf';
|
||||||
|
export * from './khovtTransPhieuNhapScopeFilterIncludeItem';
|
||||||
|
export * from './khovtTransPhieuNhapScopeFilterOrder';
|
||||||
|
export * from './khovtTransPhieuNhapScopeFilterWhere';
|
||||||
|
export * from './khovtTransPhieuNhapWithRelations';
|
||||||
|
export * from './khovtTransPhieuXuatControllerCountParams';
|
||||||
|
export * from './khovtTransPhieuXuatControllerFindParams';
|
||||||
|
export * from './khovtTransPhieuXuatDetail';
|
||||||
|
export * from './khovtTransPhieuXuatDetailWithRelations';
|
||||||
|
export * from './khovtTransPhieuXuatFilter';
|
||||||
|
export * from './khovtTransPhieuXuatFilterFields';
|
||||||
|
export * from './khovtTransPhieuXuatFilterFieldsOneOf';
|
||||||
|
export * from './khovtTransPhieuXuatFilterFieldsOneOfTwoItem';
|
||||||
|
export * from './khovtTransPhieuXuatFilterIncludeItem';
|
||||||
|
export * from './khovtTransPhieuXuatFilterOrder';
|
||||||
|
export * from './khovtTransPhieuXuatFilterWhere';
|
||||||
|
export * from './khovtTransPhieuXuatIncludeFilterItems';
|
||||||
|
export * from './khovtTransPhieuXuatIncludeFilterItemsRelation';
|
||||||
|
export * from './khovtTransPhieuXuatScopeFilter';
|
||||||
|
export * from './khovtTransPhieuXuatScopeFilterFields';
|
||||||
|
export * from './khovtTransPhieuXuatScopeFilterFieldsOneOf';
|
||||||
|
export * from './khovtTransPhieuXuatScopeFilterIncludeItem';
|
||||||
|
export * from './khovtTransPhieuXuatScopeFilterOrder';
|
||||||
|
export * from './khovtTransPhieuXuatScopeFilterWhere';
|
||||||
|
export * from './khovtTransPhieuXuatWithRelations';
|
||||||
|
export * from './khovtTransPhieunhapDetail';
|
||||||
|
export * from './khovtTransPhieunhapDetailWithRelations';
|
||||||
|
export * from './khovtTransThanhKhoan';
|
||||||
|
export * from './khovtTransThanhKhoanControllerCountParams';
|
||||||
|
export * from './khovtTransThanhKhoanControllerFindByIdParams';
|
||||||
|
export * from './khovtTransThanhKhoanControllerFindParams';
|
||||||
|
export * from './khovtTransThanhKhoanFilter';
|
||||||
|
export * from './khovtTransThanhKhoanFilter1';
|
||||||
|
export * from './khovtTransThanhKhoanFilter1Fields';
|
||||||
|
export * from './khovtTransThanhKhoanFilter1FieldsOneOf';
|
||||||
|
export * from './khovtTransThanhKhoanFilter1FieldsOneOfTwoItem';
|
||||||
|
export * from './khovtTransThanhKhoanFilter1Order';
|
||||||
|
export * from './khovtTransThanhKhoanFilter1Where';
|
||||||
|
export * from './khovtTransThanhKhoanFilterFields';
|
||||||
|
export * from './khovtTransThanhKhoanFilterFieldsOneOf';
|
||||||
|
export * from './khovtTransThanhKhoanFilterFieldsOneOfTwoItem';
|
||||||
|
export * from './khovtTransThanhKhoanFilterOrder';
|
||||||
|
export * from './khovtTransThanhKhoanPartial';
|
||||||
|
export * from './khovtTransThanhKhoanWithRelations';
|
||||||
|
export * from './loopbackCount';
|
||||||
|
export * from './newKhovtMasterKho';
|
||||||
|
export * from './newKhovtMasterNguonGoc';
|
||||||
|
export * from './newKhovtMasterNhom';
|
||||||
|
export * from './newKhovtMasterVt';
|
||||||
|
export * from './newKhovtTransThanhKhoan';
|
||||||
|
export * from './pingResponse';
|
||||||
|
export * from './pingResponseHeaders';
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface KhovtMasterKho {
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** */
|
||||||
|
maKho: string;
|
||||||
|
/** */
|
||||||
|
tenKho: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerCountParams = {
|
||||||
|
where?: { [key: string]: unknown };
|
||||||
|
};
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterKhoFilter } from './khovtMasterKhoFilter';
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerFindByIdParams = {
|
||||||
|
filter?: KhovtMasterKhoFilter;
|
||||||
|
};
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterKhoFilter1 } from './khovtMasterKhoFilter1';
|
||||||
|
|
||||||
|
export type KhovtMasterKhoControllerFindParams = {
|
||||||
|
filter?: KhovtMasterKhoFilter1;
|
||||||
|
};
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterKhoFilterFields } from './khovtMasterKhoFilterFields';
|
||||||
|
import type { KhovtMasterKhoFilterOrder } from './khovtMasterKhoFilterOrder';
|
||||||
|
|
||||||
|
export interface KhovtMasterKhoFilter {
|
||||||
|
fields?: KhovtMasterKhoFilterFields;
|
||||||
|
/** @minimum 1 */
|
||||||
|
limit?: number;
|
||||||
|
/** @minimum 0 */
|
||||||
|
offset?: number;
|
||||||
|
order?: KhovtMasterKhoFilterOrder;
|
||||||
|
/** @minimum 0 */
|
||||||
|
skip?: number;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterKhoFilter1Fields } from './khovtMasterKhoFilter1Fields';
|
||||||
|
import type { KhovtMasterKhoFilter1Order } from './khovtMasterKhoFilter1Order';
|
||||||
|
import type { KhovtMasterKhoFilter1Where } from './khovtMasterKhoFilter1Where';
|
||||||
|
|
||||||
|
export interface KhovtMasterKhoFilter1 {
|
||||||
|
fields?: KhovtMasterKhoFilter1Fields;
|
||||||
|
/** @minimum 1 */
|
||||||
|
limit?: number;
|
||||||
|
/** @minimum 0 */
|
||||||
|
offset?: number;
|
||||||
|
order?: KhovtMasterKhoFilter1Order;
|
||||||
|
/** @minimum 0 */
|
||||||
|
skip?: number;
|
||||||
|
where?: KhovtMasterKhoFilter1Where;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterKhoFilter1FieldsOneOf } from './khovtMasterKhoFilter1FieldsOneOf';
|
||||||
|
import type { KhovtMasterKhoFilter1FieldsOneOfTwoItem } from './khovtMasterKhoFilter1FieldsOneOfTwoItem';
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilter1Fields = KhovtMasterKhoFilter1FieldsOneOf | KhovtMasterKhoFilter1FieldsOneOfTwoItem[];
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilter1FieldsOneOf = {
|
||||||
|
ghiChu?: boolean;
|
||||||
|
id?: boolean;
|
||||||
|
maKho?: boolean;
|
||||||
|
tenKho?: boolean;
|
||||||
|
};
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilter1FieldsOneOfTwoItem =
|
||||||
|
(typeof KhovtMasterKhoFilter1FieldsOneOfTwoItem)[keyof typeof KhovtMasterKhoFilter1FieldsOneOfTwoItem];
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const KhovtMasterKhoFilter1FieldsOneOfTwoItem = {
|
||||||
|
ghiChu: 'ghiChu',
|
||||||
|
id: 'id',
|
||||||
|
maKho: 'maKho',
|
||||||
|
tenKho: 'tenKho',
|
||||||
|
} as const;
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilter1Order = string | string[];
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilter1Where = { [key: string]: unknown };
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterKhoFilterFieldsOneOf } from './khovtMasterKhoFilterFieldsOneOf';
|
||||||
|
import type { KhovtMasterKhoFilterFieldsOneOfTwoItem } from './khovtMasterKhoFilterFieldsOneOfTwoItem';
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilterFields = KhovtMasterKhoFilterFieldsOneOf | KhovtMasterKhoFilterFieldsOneOfTwoItem[];
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilterFieldsOneOf = {
|
||||||
|
ghiChu?: boolean;
|
||||||
|
id?: boolean;
|
||||||
|
maKho?: boolean;
|
||||||
|
tenKho?: boolean;
|
||||||
|
};
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilterFieldsOneOfTwoItem =
|
||||||
|
(typeof KhovtMasterKhoFilterFieldsOneOfTwoItem)[keyof typeof KhovtMasterKhoFilterFieldsOneOfTwoItem];
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const KhovtMasterKhoFilterFieldsOneOfTwoItem = {
|
||||||
|
ghiChu: 'ghiChu',
|
||||||
|
id: 'id',
|
||||||
|
maKho: 'maKho',
|
||||||
|
tenKho: 'tenKho',
|
||||||
|
} as const;
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterKhoFilterOrder = string | string[];
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (tsType: Partial<KhovtMasterKho>, schemaOptions: { partial: true })
|
||||||
|
*/
|
||||||
|
export interface KhovtMasterKhoPartial {
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** */
|
||||||
|
maKho?: string;
|
||||||
|
/** */
|
||||||
|
tenKho?: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (tsType: KhovtMasterKhoWithRelations, schemaOptions: { includeRelations: true })
|
||||||
|
*/
|
||||||
|
export interface KhovtMasterKhoWithRelations {
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** */
|
||||||
|
maKho: string;
|
||||||
|
/** */
|
||||||
|
tenKho: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface KhovtMasterNguonGoc {
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** @nullable */
|
||||||
|
maNguonGoc?: string | null;
|
||||||
|
/** */
|
||||||
|
nuocId: string;
|
||||||
|
/** */
|
||||||
|
tenNhaSx: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerCountParams = {
|
||||||
|
where?: { [key: string]: unknown };
|
||||||
|
};
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNguonGocFilter } from './khovtMasterNguonGocFilter';
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerFindByIdParams = {
|
||||||
|
filter?: KhovtMasterNguonGocFilter;
|
||||||
|
};
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNguonGocFilter1 } from './khovtMasterNguonGocFilter1';
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocControllerFindParams = {
|
||||||
|
filter?: KhovtMasterNguonGocFilter1;
|
||||||
|
};
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNguonGocFilterFields } from './khovtMasterNguonGocFilterFields';
|
||||||
|
import type { KhovtMasterNguonGocFilterOrder } from './khovtMasterNguonGocFilterOrder';
|
||||||
|
|
||||||
|
export interface KhovtMasterNguonGocFilter {
|
||||||
|
fields?: KhovtMasterNguonGocFilterFields;
|
||||||
|
/** @minimum 1 */
|
||||||
|
limit?: number;
|
||||||
|
/** @minimum 0 */
|
||||||
|
offset?: number;
|
||||||
|
order?: KhovtMasterNguonGocFilterOrder;
|
||||||
|
/** @minimum 0 */
|
||||||
|
skip?: number;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNguonGocFilter1Fields } from './khovtMasterNguonGocFilter1Fields';
|
||||||
|
import type { KhovtMasterNguonGocFilter1Order } from './khovtMasterNguonGocFilter1Order';
|
||||||
|
import type { KhovtMasterNguonGocFilter1Where } from './khovtMasterNguonGocFilter1Where';
|
||||||
|
|
||||||
|
export interface KhovtMasterNguonGocFilter1 {
|
||||||
|
fields?: KhovtMasterNguonGocFilter1Fields;
|
||||||
|
/** @minimum 1 */
|
||||||
|
limit?: number;
|
||||||
|
/** @minimum 0 */
|
||||||
|
offset?: number;
|
||||||
|
order?: KhovtMasterNguonGocFilter1Order;
|
||||||
|
/** @minimum 0 */
|
||||||
|
skip?: number;
|
||||||
|
where?: KhovtMasterNguonGocFilter1Where;
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNguonGocFilter1FieldsOneOf } from './khovtMasterNguonGocFilter1FieldsOneOf';
|
||||||
|
import type { KhovtMasterNguonGocFilter1FieldsOneOfTwoItem } from './khovtMasterNguonGocFilter1FieldsOneOfTwoItem';
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilter1Fields =
|
||||||
|
| KhovtMasterNguonGocFilter1FieldsOneOf
|
||||||
|
| KhovtMasterNguonGocFilter1FieldsOneOfTwoItem[];
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilter1FieldsOneOf = {
|
||||||
|
ghiChu?: boolean;
|
||||||
|
id?: boolean;
|
||||||
|
maNguonGoc?: boolean;
|
||||||
|
nuocId?: boolean;
|
||||||
|
tenNhaSx?: boolean;
|
||||||
|
};
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilter1FieldsOneOfTwoItem =
|
||||||
|
(typeof KhovtMasterNguonGocFilter1FieldsOneOfTwoItem)[keyof typeof KhovtMasterNguonGocFilter1FieldsOneOfTwoItem];
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const KhovtMasterNguonGocFilter1FieldsOneOfTwoItem = {
|
||||||
|
ghiChu: 'ghiChu',
|
||||||
|
id: 'id',
|
||||||
|
maNguonGoc: 'maNguonGoc',
|
||||||
|
nuocId: 'nuocId',
|
||||||
|
tenNhaSx: 'tenNhaSx',
|
||||||
|
} as const;
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilter1Order = string | string[];
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilter1Where = { [key: string]: unknown };
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNguonGocFilterFieldsOneOf } from './khovtMasterNguonGocFilterFieldsOneOf';
|
||||||
|
import type { KhovtMasterNguonGocFilterFieldsOneOfTwoItem } from './khovtMasterNguonGocFilterFieldsOneOfTwoItem';
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilterFields =
|
||||||
|
| KhovtMasterNguonGocFilterFieldsOneOf
|
||||||
|
| KhovtMasterNguonGocFilterFieldsOneOfTwoItem[];
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilterFieldsOneOf = {
|
||||||
|
ghiChu?: boolean;
|
||||||
|
id?: boolean;
|
||||||
|
maNguonGoc?: boolean;
|
||||||
|
nuocId?: boolean;
|
||||||
|
tenNhaSx?: boolean;
|
||||||
|
};
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilterFieldsOneOfTwoItem =
|
||||||
|
(typeof KhovtMasterNguonGocFilterFieldsOneOfTwoItem)[keyof typeof KhovtMasterNguonGocFilterFieldsOneOfTwoItem];
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const KhovtMasterNguonGocFilterFieldsOneOfTwoItem = {
|
||||||
|
ghiChu: 'ghiChu',
|
||||||
|
id: 'id',
|
||||||
|
maNguonGoc: 'maNguonGoc',
|
||||||
|
nuocId: 'nuocId',
|
||||||
|
tenNhaSx: 'tenNhaSx',
|
||||||
|
} as const;
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNguonGocFilterOrder = string | string[];
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (tsType: Partial<KhovtMasterNguonGoc>, schemaOptions: { partial: true })
|
||||||
|
*/
|
||||||
|
export interface KhovtMasterNguonGocPartial {
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** @nullable */
|
||||||
|
maNguonGoc?: string | null;
|
||||||
|
/** */
|
||||||
|
nuocId?: string;
|
||||||
|
/** */
|
||||||
|
tenNhaSx?: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (tsType: KhovtMasterNguonGocWithRelations, schemaOptions: { includeRelations: true })
|
||||||
|
*/
|
||||||
|
export interface KhovtMasterNguonGocWithRelations {
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** @nullable */
|
||||||
|
maNguonGoc?: string | null;
|
||||||
|
/** */
|
||||||
|
nuocId: string;
|
||||||
|
/** */
|
||||||
|
tenNhaSx: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface KhovtMasterNhom {
|
||||||
|
/** @nullable */
|
||||||
|
ghiChu?: string | null;
|
||||||
|
/** */
|
||||||
|
id?: number;
|
||||||
|
/** */
|
||||||
|
maNhom: string;
|
||||||
|
/** */
|
||||||
|
tenNhom: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNhomFilterFields } from './khovtMasterNhomFilterFields';
|
||||||
|
import type { KhovtMasterNhomFilterOrder } from './khovtMasterNhomFilterOrder';
|
||||||
|
|
||||||
|
export interface KhovtMasterNhomFilter {
|
||||||
|
fields?: KhovtMasterNhomFilterFields;
|
||||||
|
/** @minimum 1 */
|
||||||
|
limit?: number;
|
||||||
|
/** @minimum 0 */
|
||||||
|
offset?: number;
|
||||||
|
order?: KhovtMasterNhomFilterOrder;
|
||||||
|
/** @minimum 0 */
|
||||||
|
skip?: number;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNhomFilter1Fields } from './khovtMasterNhomFilter1Fields';
|
||||||
|
import type { KhovtMasterNhomFilter1Order } from './khovtMasterNhomFilter1Order';
|
||||||
|
import type { KhovtMasterNhomFilter1Where } from './khovtMasterNhomFilter1Where';
|
||||||
|
|
||||||
|
export interface KhovtMasterNhomFilter1 {
|
||||||
|
fields?: KhovtMasterNhomFilter1Fields;
|
||||||
|
/** @minimum 1 */
|
||||||
|
limit?: number;
|
||||||
|
/** @minimum 0 */
|
||||||
|
offset?: number;
|
||||||
|
order?: KhovtMasterNhomFilter1Order;
|
||||||
|
/** @minimum 0 */
|
||||||
|
skip?: number;
|
||||||
|
where?: KhovtMasterNhomFilter1Where;
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNhomFilter1FieldsOneOf } from './khovtMasterNhomFilter1FieldsOneOf';
|
||||||
|
import type { KhovtMasterNhomFilter1FieldsOneOfTwoItem } from './khovtMasterNhomFilter1FieldsOneOfTwoItem';
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilter1Fields =
|
||||||
|
| KhovtMasterNhomFilter1FieldsOneOf
|
||||||
|
| KhovtMasterNhomFilter1FieldsOneOfTwoItem[];
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilter1FieldsOneOf = {
|
||||||
|
ghiChu?: boolean;
|
||||||
|
id?: boolean;
|
||||||
|
maNhom?: boolean;
|
||||||
|
tenNhom?: boolean;
|
||||||
|
};
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilter1FieldsOneOfTwoItem =
|
||||||
|
(typeof KhovtMasterNhomFilter1FieldsOneOfTwoItem)[keyof typeof KhovtMasterNhomFilter1FieldsOneOfTwoItem];
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const KhovtMasterNhomFilter1FieldsOneOfTwoItem = {
|
||||||
|
ghiChu: 'ghiChu',
|
||||||
|
id: 'id',
|
||||||
|
maNhom: 'maNhom',
|
||||||
|
tenNhom: 'tenNhom',
|
||||||
|
} as const;
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilter1Order = string | string[];
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilter1Where = { [key: string]: unknown };
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
import type { KhovtMasterNhomFilterFieldsOneOf } from './khovtMasterNhomFilterFieldsOneOf';
|
||||||
|
import type { KhovtMasterNhomFilterFieldsOneOfTwoItem } from './khovtMasterNhomFilterFieldsOneOfTwoItem';
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilterFields = KhovtMasterNhomFilterFieldsOneOf | KhovtMasterNhomFilterFieldsOneOfTwoItem[];
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilterFieldsOneOf = {
|
||||||
|
ghiChu?: boolean;
|
||||||
|
id?: boolean;
|
||||||
|
maNhom?: boolean;
|
||||||
|
tenNhom?: boolean;
|
||||||
|
};
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilterFieldsOneOfTwoItem =
|
||||||
|
(typeof KhovtMasterNhomFilterFieldsOneOfTwoItem)[keyof typeof KhovtMasterNhomFilterFieldsOneOfTwoItem];
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const KhovtMasterNhomFilterFieldsOneOfTwoItem = {
|
||||||
|
ghiChu: 'ghiChu',
|
||||||
|
id: 'id',
|
||||||
|
maNhom: 'maNhom',
|
||||||
|
tenNhom: 'tenNhom',
|
||||||
|
} as const;
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v6.31.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* pkh-api
|
||||||
|
* pkh api
|
||||||
|
* OpenAPI spec version: 0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type KhovtMasterNhomFilterOrder = string | string[];
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue