2026-05-03 09:52:22 +00:00
|
|
|
import { ListFormWizardDto, WizardFileInfoDto, WizardSeedFileDto } from '@/proxy/admin/wizard/models'
|
2026-05-02 17:08:06 +00:00
|
|
|
import apiService from './api.service'
|
|
|
|
|
|
|
|
|
|
export const postListFormWizard = (input: ListFormWizardDto) =>
|
|
|
|
|
apiService.fetchData({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: `/api/app/list-form-wizard`,
|
|
|
|
|
data: input,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export const getWizardFiles = () =>
|
|
|
|
|
apiService.fetchData<WizardFileInfoDto[]>({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: `/api/app/list-form-wizard/files`,
|
|
|
|
|
})
|
|
|
|
|
|
2026-05-03 09:52:22 +00:00
|
|
|
export const getWizardFile = (fileName: string) =>
|
|
|
|
|
apiService.fetchData<WizardSeedFileDto>({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: `/api/app/list-form-wizard/file`,
|
|
|
|
|
params: { fileName },
|
|
|
|
|
})
|
|
|
|
|
|
2026-05-02 17:08:06 +00:00
|
|
|
export const deleteWizardFile = (fileName: string) =>
|
|
|
|
|
apiService.fetchData({
|
|
|
|
|
method: 'DELETE',
|
|
|
|
|
url: `/api/app/list-form-wizard/file`,
|
|
|
|
|
params: { fileName },
|
2026-08-18 10:33:50 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Wizard dosyasini ve bagli seed dosyalarini (custom/crud/sql) tek bir zip olarak indirir.
|
|
|
|
|
* Zip icindeki klasor duzeni seed kapsam klasoru ile aynidir; baska bir ortamda dogrudan acilabilir.
|
|
|
|
|
*/
|
|
|
|
|
export const exportWizardFile = (fileName: string) =>
|
|
|
|
|
apiService.fetchData<Blob>({
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: `/api/app/list-form-wizard/export`,
|
|
|
|
|
params: { fileName },
|
|
|
|
|
responseType: 'blob',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/** Blob'u tarayicida indirme olarak tetikler. */
|
|
|
|
|
export const downloadBlob = (blob: Blob, fileName: string) => {
|
|
|
|
|
const url = window.URL.createObjectURL(blob)
|
|
|
|
|
const link = document.createElement('a')
|
|
|
|
|
link.style.display = 'none'
|
|
|
|
|
link.href = url
|
|
|
|
|
link.download = fileName
|
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
link.click()
|
|
|
|
|
document.body.removeChild(link)
|
|
|
|
|
window.URL.revokeObjectURL(url)
|
|
|
|
|
}
|