@testdracul/media-frontend 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +4 -0
- package/.env.example +3 -0
- package/.eslintrc.json +25 -0
- package/babel.config.js +5 -0
- package/dist/dracul-media-frontend.es.js +16238 -0
- package/dist/dracul-media-frontend.umd.js +586 -0
- package/dist/media-frontend.css +1 -0
- package/docs-en.md +45 -0
- package/docs-es.md +45 -0
- package/package.json +56 -0
- package/readme.md +36 -0
- package/src/components/CsvWebViewer/CsvWebViewer.vue +81 -0
- package/src/components/CsvWebViewer/index.ts +4 -0
- package/src/components/FileUpload/FileUpload.vue +94 -0
- package/src/components/FileUpload/index.ts +4 -0
- package/src/components/FileUploadButton/FileUploadButton.vue +127 -0
- package/src/components/FileUploadButton/index.ts +4 -0
- package/src/components/FileUploadExpiration/FileUploadExpiration.vue +274 -0
- package/src/components/FileUploadExpiration/index.ts +4 -0
- package/src/components/FileUploadExpress/FileUploadExpress.vue +208 -0
- package/src/components/FileUploadExpress/index.ts +4 -0
- package/src/components/FileView/FileView.vue +336 -0
- package/src/components/FileView/index.ts +4 -0
- package/src/components/GroupsShow/GroupsShow.vue +40 -0
- package/src/components/GroupsShow/index.ts +4 -0
- package/src/components/MediaField/MediaField.vue +62 -0
- package/src/components/MediaField/index.ts +4 -0
- package/src/components/PdfWebViewer/PdfWebViewer.vue +81 -0
- package/src/components/PdfWebViewer/index.ts +4 -0
- package/src/components/UsersShow/UsersShow.vue +39 -0
- package/src/components/UsersShow/index.ts +4 -0
- package/src/components/XlsxWebViewer/XlsxWebViewer.vue +70 -0
- package/src/components/XlsxWebViewer/index.ts +4 -0
- package/src/helpers/redeableBytes.ts +9 -0
- package/src/i18n/index.ts +22 -0
- package/src/i18n/messages/DocMessages.ts +31 -0
- package/src/i18n/messages/ExtraMessages.ts +29 -0
- package/src/i18n/messages/FileMessages.ts +223 -0
- package/src/i18n/messages/UserStorageMessages.ts +145 -0
- package/src/i18n/permissions/FilePermissionMessages.ts +50 -0
- package/src/i18n/permissions/OldPermissionMessages.ts +59 -0
- package/src/i18n/permissions/UserStoragePermissionMessages.ts +40 -0
- package/src/index.ts +70 -0
- package/src/mixins/readableBytesMixin.ts +9 -0
- package/src/pages/FileManagementPage/FileCreate/FileCreate.vue +108 -0
- package/src/pages/FileManagementPage/FileCreate/index.ts +3 -0
- package/src/pages/FileManagementPage/FileCrud/FileCrud.vue +133 -0
- package/src/pages/FileManagementPage/FileCrud/index.ts +4 -0
- package/src/pages/FileManagementPage/FileDelete/FileDelete.vue +61 -0
- package/src/pages/FileManagementPage/FileDelete/index.ts +3 -0
- package/src/pages/FileManagementPage/FileFilters/FileFilters.vue +150 -0
- package/src/pages/FileManagementPage/FileFilters/index.ts +3 -0
- package/src/pages/FileManagementPage/FileForm/FileForm.vue +184 -0
- package/src/pages/FileManagementPage/FileForm/UserCombobox.vue +66 -0
- package/src/pages/FileManagementPage/FileForm/index.ts +3 -0
- package/src/pages/FileManagementPage/FileList/FileEditButton.vue +410 -0
- package/src/pages/FileManagementPage/FileList/FileList.vue +178 -0
- package/src/pages/FileManagementPage/FileList/index.ts +4 -0
- package/src/pages/FileManagementPage/FileShow/FileShow.vue +23 -0
- package/src/pages/FileManagementPage/FileShow/FileShowData.vue +35 -0
- package/src/pages/FileManagementPage/FileShow/index.ts +3 -0
- package/src/pages/FileManagementPage/FileUpdate/FileUpdate.vue +107 -0
- package/src/pages/FileManagementPage/FileUpdate/index.ts +4 -0
- package/src/pages/FileManagementPage/index.vue +20 -0
- package/src/pages/MediaDocPage/MediaDocCard.vue +35 -0
- package/src/pages/MediaDocPage/MediaDocPage.vue +78 -0
- package/src/pages/UserStoragePage/UserStorage.vue +311 -0
- package/src/pages/UserStoragePage/UserStorageForm/UserStorageForm.vue +172 -0
- package/src/pages/UserStoragePage/UserStorageUpdate/UserStorageUpdate.vue +91 -0
- package/src/pages/UserStoragePage/index.vue +14 -0
- package/src/providers/FileMetricsProvider.ts +47 -0
- package/src/providers/FileProvider.ts +60 -0
- package/src/providers/UploadProvider.ts +32 -0
- package/src/providers/UserStorageProvider.ts +47 -0
- package/src/providers/gql/almacenamientoPorUsuario.graphql +10 -0
- package/src/providers/gql/cantidadArchivosPorUsuario.graphql +10 -0
- package/src/providers/gql/fetchMediaVariables.graphql +6 -0
- package/src/providers/gql/fileCreate.graphql +27 -0
- package/src/providers/gql/fileDelete.graphql +7 -0
- package/src/providers/gql/fileFetch.graphql +29 -0
- package/src/providers/gql/fileFind.graphql +29 -0
- package/src/providers/gql/fileGlobalMetrics.graphql +6 -0
- package/src/providers/gql/filePaginate.graphql +38 -0
- package/src/providers/gql/fileUpdate.graphql +29 -0
- package/src/providers/gql/fileUpload.graphql +29 -0
- package/src/providers/gql/fileUploadAnonymous.graphql +25 -0
- package/src/providers/gql/fileUserMetrics.graphql +9 -0
- package/src/providers/gql/userStorageFetch.graphql +17 -0
- package/src/providers/gql/userStorageFindByUser.graphql +17 -0
- package/src/providers/gql/userStorageUpdate.graphql +31 -0
- package/src/routes/index.ts +32 -0
- package/vite.config.ts +65 -0
- package/vue.config.js +22 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
<v-form ref="formRef" autocomplete="off" @submit.prevent="$emit('save')">
|
|
4
|
+
<v-row>
|
|
5
|
+
<v-col cols="12">
|
|
6
|
+
<span class="text-h5">{{ t('media.userStorage.cliente') }}: {{ form.name }}</span>
|
|
7
|
+
</v-col>
|
|
8
|
+
|
|
9
|
+
<v-col cols="12" md="6">
|
|
10
|
+
<v-text-field
|
|
11
|
+
v-model="form.capacity"
|
|
12
|
+
type='number'
|
|
13
|
+
:label="t('media.userStorage.capacity')"
|
|
14
|
+
variant="underlined"
|
|
15
|
+
density="compact"
|
|
16
|
+
suffix="MB"
|
|
17
|
+
:rules="storageRules"
|
|
18
|
+
required
|
|
19
|
+
></v-text-field>
|
|
20
|
+
</v-col>
|
|
21
|
+
<v-col cols="12" md="6" class="d-flex align-center">
|
|
22
|
+
<span class="text-subtitle-1">{{ t('media.userStorage.usedPercentage') }} {{ percentageUsed(form) }}</span>
|
|
23
|
+
</v-col>
|
|
24
|
+
|
|
25
|
+
<v-col cols="12" md="6">
|
|
26
|
+
<v-text-field
|
|
27
|
+
v-model="form.maxFileSize"
|
|
28
|
+
type='number'
|
|
29
|
+
:label="t('media.userStorage.maxFileSize')"
|
|
30
|
+
variant="underlined"
|
|
31
|
+
density="compact"
|
|
32
|
+
suffix="MB"
|
|
33
|
+
:rules="maxFileSizeRules"
|
|
34
|
+
required
|
|
35
|
+
:hint="'Max '+fileSizeLimit+' Mb'"
|
|
36
|
+
persistent-hint
|
|
37
|
+
></v-text-field>
|
|
38
|
+
</v-col>
|
|
39
|
+
<v-col cols="12" md="6" class="d-flex align-center">
|
|
40
|
+
<span class="text-subtitle-1">{{ t('media.userStorage.fileSizeLimit') }}</span>
|
|
41
|
+
</v-col>
|
|
42
|
+
|
|
43
|
+
<v-col cols="12" md="6">
|
|
44
|
+
<v-text-field
|
|
45
|
+
v-model="form.fileExpirationTime"
|
|
46
|
+
type='number'
|
|
47
|
+
:label="t('media.userStorage.fileExpirationTime')"
|
|
48
|
+
variant="underlined"
|
|
49
|
+
density="compact"
|
|
50
|
+
:suffix="t('media.userStorage.days')"
|
|
51
|
+
:rules="fileExpirationTimeRules"
|
|
52
|
+
required
|
|
53
|
+
:hint="'Max '+fileExpirationLimit"
|
|
54
|
+
persistent-hint
|
|
55
|
+
></v-text-field>
|
|
56
|
+
</v-col>
|
|
57
|
+
<v-col cols="12" md="6" class="d-flex align-center">
|
|
58
|
+
<span class="text-subtitle-1">{{ t('media.userStorage.fileExpirationLimit') }}</span>
|
|
59
|
+
</v-col>
|
|
60
|
+
|
|
61
|
+
<v-col cols="12" md="6">
|
|
62
|
+
<v-select
|
|
63
|
+
v-model="form.filesPrivacy"
|
|
64
|
+
:items="privacyOptions"
|
|
65
|
+
item-title="title"
|
|
66
|
+
item-value="value"
|
|
67
|
+
:label="t('media.userStorage.filesPrivacy')"
|
|
68
|
+
variant="underlined"
|
|
69
|
+
density="compact"
|
|
70
|
+
required
|
|
71
|
+
></v-select>
|
|
72
|
+
</v-col>
|
|
73
|
+
<v-col cols="12" md="6" class="d-flex align-center">
|
|
74
|
+
<span class="text-subtitle-1">{{ t('media.userStorage.filesPrivacyLabel') }}</span>
|
|
75
|
+
</v-col>
|
|
76
|
+
|
|
77
|
+
<v-col cols="12" md="6">
|
|
78
|
+
<v-switch color="success" :label="form.deleteByLastAccess ? t('media.userStorage.active') : t('media.userStorage.inactive')"
|
|
79
|
+
v-model="form.deleteByLastAccess" hide-details inset density="compact"></v-switch>
|
|
80
|
+
</v-col>
|
|
81
|
+
<v-col cols="12" md="6" class="d-flex align-center">
|
|
82
|
+
<span class="text-subtitle-1">{{ t('media.userStorage.deleteByLastAccess') }}</span>
|
|
83
|
+
</v-col>
|
|
84
|
+
|
|
85
|
+
<v-col cols="12" md="6">
|
|
86
|
+
<v-switch color="success" :label="form.deleteByCreatedAt ? t('media.userStorage.active') : t('media.userStorage.inactive')"
|
|
87
|
+
v-model="form.deleteByCreatedAt" hide-details inset density="compact"></v-switch>
|
|
88
|
+
</v-col>
|
|
89
|
+
<v-col cols="12" md="6" class="d-flex align-center">
|
|
90
|
+
<span class="text-subtitle-1">{{ t('media.userStorage.deleteByDateCreated') }}</span>
|
|
91
|
+
</v-col>
|
|
92
|
+
</v-row>
|
|
93
|
+
</v-form>
|
|
94
|
+
</v-container>
|
|
95
|
+
</template>
|
|
96
|
+
<script setup>
|
|
97
|
+
import { ref, computed, watch } from 'vue'
|
|
98
|
+
import { useI18n } from 'vue-i18n'
|
|
99
|
+
|
|
100
|
+
const { t } = useI18n()
|
|
101
|
+
|
|
102
|
+
const props = defineProps({
|
|
103
|
+
modelValue: { type: Object, required: true },
|
|
104
|
+
inputErrors: Object,
|
|
105
|
+
fileSizeLimit: Number,
|
|
106
|
+
fileExpirationLimit: Number
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const emit = defineEmits(['update:modelValue', 'save'])
|
|
110
|
+
|
|
111
|
+
const formRef = ref(null)
|
|
112
|
+
|
|
113
|
+
const form = computed({
|
|
114
|
+
get() { return props.modelValue },
|
|
115
|
+
set(val) { emit('update:modelValue', val) }
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// const error = computed({
|
|
119
|
+
// get() { return props.inputErrors },
|
|
120
|
+
// set(val) { emit('update:modelValue', val) }
|
|
121
|
+
// })
|
|
122
|
+
|
|
123
|
+
const privacyOptions = computed(() => [
|
|
124
|
+
{ title: t('media.userStorage.privacy.public'), value: 'public' },
|
|
125
|
+
{ title: t('media.userStorage.privacy.private'), value: 'private' },
|
|
126
|
+
])
|
|
127
|
+
|
|
128
|
+
const percentageUsed = (formData) => {
|
|
129
|
+
return formData.capacity > 0 ? parseFloat(formData.usedSpace * 100 / formData.capacity).toFixed(2) + "%" : "-"
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const storageRules = computed(() => [
|
|
133
|
+
(v) =>
|
|
134
|
+
parseFloat(v) >= form.value.usedSpace || t("media.userStorage.insufficientCapacity"),
|
|
135
|
+
])
|
|
136
|
+
|
|
137
|
+
const maxFileSizeRules = computed(() => [
|
|
138
|
+
(v) => {
|
|
139
|
+
if (props.fileSizeLimit != 0) {
|
|
140
|
+
return parseFloat(v) <= props.fileSizeLimit && parseFloat(v) > 0 || t("media.userStorage.sizeLimitExceeded");
|
|
141
|
+
} else {
|
|
142
|
+
return true
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
])
|
|
146
|
+
|
|
147
|
+
const fileExpirationTimeRules = computed(() => [
|
|
148
|
+
(v) => {
|
|
149
|
+
if (props.fileExpirationLimit != 0) {
|
|
150
|
+
return parseInt(v) <= props.fileExpirationLimit && parseFloat(v) > 0 || t("media.userStorage.fileExpirationTimeExceeded")
|
|
151
|
+
} else {
|
|
152
|
+
return true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
])
|
|
156
|
+
|
|
157
|
+
watch(() => form.value.deleteByCreatedAt, (newVal, oldVal) => {
|
|
158
|
+
if (oldVal == false && newVal == true && form.value.deleteByLastAccess) {
|
|
159
|
+
form.value.deleteByLastAccess = false
|
|
160
|
+
} else if (oldVal == true && newVal == false && form.value.deleteByLastAccess == false) {
|
|
161
|
+
form.value.deleteByLastAccess = true
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
watch(() => form.value.deleteByLastAccess, (newVal, oldVal) => {
|
|
166
|
+
if (oldVal == false && newVal == true && form.value.deleteByCreatedAt) {
|
|
167
|
+
form.value.deleteByCreatedAt = false
|
|
168
|
+
} else if (oldVal == true && newVal == false && form.value.deleteByCreatedAt == false) {
|
|
169
|
+
form.value.deleteByCreatedAt = true
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
</script>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<crud-update :open="open"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:title="title"
|
|
5
|
+
:error-message="errorMessage"
|
|
6
|
+
@update="save"
|
|
7
|
+
@close="$emit('close')"
|
|
8
|
+
>
|
|
9
|
+
<v-alert v-if="formError" type="error">{{ formError }}</v-alert>
|
|
10
|
+
<user-storage-form ref="formRef" v-model="form"
|
|
11
|
+
:file-size-limit="fileSizeLimitComputed"
|
|
12
|
+
:file-expiration-limit="fileExpirationLimit"
|
|
13
|
+
:input-errors="inputErrors"
|
|
14
|
+
@save="save">
|
|
15
|
+
|
|
16
|
+
</user-storage-form>
|
|
17
|
+
</crud-update>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { ref, computed, onBeforeMount } from 'vue'
|
|
22
|
+
import { useI18n } from 'vue-i18n'
|
|
23
|
+
import {CrudUpdate} from '@testdracul/common-frontend'
|
|
24
|
+
import UserStorageForm from '../UserStorageForm/UserStorageForm.vue';
|
|
25
|
+
import UserStorageProvider from '../../../providers/UserStorageProvider'
|
|
26
|
+
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
userStorageForm: Object,
|
|
29
|
+
open: {type: Boolean, default: true}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const emit = defineEmits(['close', 'roleUpdated'])
|
|
33
|
+
|
|
34
|
+
const { t } = useI18n()
|
|
35
|
+
|
|
36
|
+
const title = ref(t("media.userStorage.editTitle"))
|
|
37
|
+
const errorMessage = ref("")
|
|
38
|
+
const inputErrors = ref({})
|
|
39
|
+
const loading = ref(false)
|
|
40
|
+
const formError = ref(null)
|
|
41
|
+
const form = ref({
|
|
42
|
+
id: props.userStorageForm.id,
|
|
43
|
+
name: props.userStorageForm.user.name,
|
|
44
|
+
capacity: props.userStorageForm.capacity,
|
|
45
|
+
usedSpace: props.userStorageForm.usedSpace,
|
|
46
|
+
maxFileSize: props.userStorageForm.maxFileSize,
|
|
47
|
+
fileExpirationTime: props.userStorageForm.fileExpirationTime,
|
|
48
|
+
deleteByLastAccess: props.userStorageForm.deleteByLastAccess,
|
|
49
|
+
deleteByCreatedAt: props.userStorageForm.deleteByCreatedAt,
|
|
50
|
+
filesPrivacy: props.userStorageForm.filesPrivacy,
|
|
51
|
+
})
|
|
52
|
+
const fileSizeLimit = ref(0)
|
|
53
|
+
const fileExpirationLimit = ref(0)
|
|
54
|
+
const formRef = ref(null)
|
|
55
|
+
|
|
56
|
+
const fileSizeLimitComputed = computed(() => fileSizeLimit.value)
|
|
57
|
+
|
|
58
|
+
const save = () => {
|
|
59
|
+
formError.value = null
|
|
60
|
+
if (isFormValid()) {
|
|
61
|
+
UserStorageProvider.updateUserStorage(form.value).then(
|
|
62
|
+
emit("roleUpdated"),
|
|
63
|
+
emit("close")
|
|
64
|
+
).catch(err => console.error(err))
|
|
65
|
+
} else {
|
|
66
|
+
formError.value = "Valores Invalidos"
|
|
67
|
+
console.warn("Valores Invalidos")
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const fetchMediaVariables = () => {
|
|
72
|
+
return UserStorageProvider.fetchMediaVariables().then((res) => {
|
|
73
|
+
fileSizeLimit.value = res.data.fetchMediaVariables.maxFileSize;
|
|
74
|
+
fileExpirationLimit.value = res.data.fetchMediaVariables.fileExpirationTime;
|
|
75
|
+
}).catch(err => console.error(err))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const isFormValid = () => {
|
|
79
|
+
form.value.capacity = parseFloat(form.value.capacity)
|
|
80
|
+
form.value.maxFileSize = parseFloat(form.value.maxFileSize)
|
|
81
|
+
form.value.fileExpirationTime = parseInt(form.value.fileExpirationTime)
|
|
82
|
+
|
|
83
|
+
return form.value.capacity >= 0 && form.value.maxFileSize > 0 && form.value.fileExpirationTime > 0 &&
|
|
84
|
+
form.value.capacity > form.value.usedSpace && fileSizeLimit.value >= form.value.maxFileSize &&
|
|
85
|
+
fileExpirationLimit.value >= form.value.fileExpirationTime;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onBeforeMount(() => {
|
|
89
|
+
fetchMediaVariables()
|
|
90
|
+
})
|
|
91
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import fileGlobalMetricsGql from './gql/fileGlobalMetrics.graphql'
|
|
2
|
+
import fileUserMetricsGql from './gql/fileUserMetrics.graphql'
|
|
3
|
+
import almacenamientoPorUsuarioGql from './gql/almacenamientoPorUsuario.graphql'
|
|
4
|
+
import cantidadArchivosPorUsuarioGql from './gql/cantidadArchivosPorUsuario.graphql'
|
|
5
|
+
|
|
6
|
+
class FileMetricsProvider {
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
this.gqlc = null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setGqlc(gqlc) {
|
|
13
|
+
this.gqlc = gqlc
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
fileGlobalMetrics() {
|
|
17
|
+
return this.gqlc.query({
|
|
18
|
+
query: fileGlobalMetricsGql,
|
|
19
|
+
fetchPolicy: 'network-only'
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fileUserMetrics() {
|
|
24
|
+
return this.gqlc.query({
|
|
25
|
+
query: fileUserMetricsGql,
|
|
26
|
+
fetchPolicy: 'network-only'
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
almacenamientoPorUsuario() {
|
|
31
|
+
return this.gqlc.query({
|
|
32
|
+
query: almacenamientoPorUsuarioGql,
|
|
33
|
+
fetchPolicy: 'network-only'
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
cantidadArchivosPorUsuario() {
|
|
38
|
+
return this.gqlc.query({
|
|
39
|
+
query: cantidadArchivosPorUsuarioGql,
|
|
40
|
+
fetchPolicy: 'network-only'
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const fileMetricsProvider = new FileMetricsProvider()
|
|
46
|
+
|
|
47
|
+
export default fileMetricsProvider
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import fileFindGql from './gql/fileFind.graphql'
|
|
2
|
+
import fileFetchGql from './gql/fileFetch.graphql'
|
|
3
|
+
import filePaginateGql from './gql/filePaginate.graphql'
|
|
4
|
+
import fileUpdateGql from './gql/fileUpdate.graphql'
|
|
5
|
+
import fileDeleteGql from './gql/fileDelete.graphql'
|
|
6
|
+
|
|
7
|
+
class FileProvider {
|
|
8
|
+
private gqlc: any;
|
|
9
|
+
|
|
10
|
+
constructor() {
|
|
11
|
+
this.gqlc = null
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setGqlc(gqlc: any) {
|
|
15
|
+
this.gqlc = gqlc
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
findFile(id: string) {
|
|
19
|
+
return this.gqlc.query({
|
|
20
|
+
query: fileFindGql,
|
|
21
|
+
variables: { id: id }
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fetchFiles() {
|
|
26
|
+
return this.gqlc.query({ query: fileFetchGql })
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
paginateFiles(pageNumber: number, itemsPerPage: number, search: string | null = null, filters: any = null, orderBy: string | null = null, orderDesc: boolean = false) {
|
|
30
|
+
return this.gqlc.query({
|
|
31
|
+
query: filePaginateGql,
|
|
32
|
+
variables: {
|
|
33
|
+
input: {
|
|
34
|
+
pageNumber, itemsPerPage, search, filters, orderBy, orderDesc
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
fetchPolicy: "network-only"
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
updateFile(input: any, file: any) {
|
|
43
|
+
return this.gqlc.mutate({
|
|
44
|
+
mutation: fileUpdateGql,
|
|
45
|
+
variables: { input, file }
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
deleteFile(id: string) {
|
|
50
|
+
return this.gqlc.mutate({
|
|
51
|
+
mutation: fileDeleteGql,
|
|
52
|
+
variables: { id }
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const fileProvider = new FileProvider()
|
|
59
|
+
|
|
60
|
+
export default fileProvider
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fileUploadGql from './gql/fileUpload.graphql'
|
|
2
|
+
import fileUploadAnonymousGql from './gql/fileUploadAnonymous.graphql'
|
|
3
|
+
|
|
4
|
+
class UploadProvider {
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
this.gqlc = null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setGqlc(gqlc) {
|
|
12
|
+
this.gqlc = gqlc
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
uploadFile(file, expirationDate, isPublic, description, tags, groups, users) {
|
|
16
|
+
return this.gqlc.mutate({
|
|
17
|
+
mutation: fileUploadGql,
|
|
18
|
+
variables: { file: file, expirationDate: expirationDate, isPublic: isPublic, description: description, tags: tags, groups: groups, users: users }
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
uploadFileAnonymous(file) {
|
|
23
|
+
return this.gqlc.mutate({
|
|
24
|
+
mutation: fileUploadAnonymousGql,
|
|
25
|
+
variables: { file: file }
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const uploadProvider = new UploadProvider()
|
|
31
|
+
|
|
32
|
+
export default uploadProvider
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import fetchMediaVariablesGql from './gql/fetchMediaVariables.graphql'
|
|
2
|
+
import userStorageFetchGql from './gql/userStorageFetch.graphql'
|
|
3
|
+
import userStorageFindByUserGql from './gql/userStorageFindByUser.graphql'
|
|
4
|
+
import userStorageUpdateGql from './gql/userStorageUpdate.graphql'
|
|
5
|
+
|
|
6
|
+
class UserStorageProvider {
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
this.gqlc = null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setGqlc(gqlc) {
|
|
13
|
+
this.gqlc = gqlc
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
fetchMediaVariables() {
|
|
18
|
+
return this.gqlc.query({
|
|
19
|
+
query: fetchMediaVariablesGql,
|
|
20
|
+
fetchPolicy: "network-only"
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fetchUserStorage() {
|
|
25
|
+
return this.gqlc.query({
|
|
26
|
+
query: userStorageFetchGql,
|
|
27
|
+
fetchPolicy: "network-only"
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
findUserStorageByUser() {
|
|
32
|
+
return this.gqlc.query({
|
|
33
|
+
query: userStorageFindByUserGql,
|
|
34
|
+
fetchPolicy: "network-only"
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
updateUserStorage(form) {
|
|
39
|
+
return this.gqlc.mutate({
|
|
40
|
+
mutation: userStorageUpdateGql,
|
|
41
|
+
variables: form,
|
|
42
|
+
fetchPolicy: "no-cache"
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default new UserStorageProvider()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
mutation fileCreate($filename:String!, $extension:String!, $relativePath:String!, $absolutePath:String!, $size:String!, $url:String!, $isPublic:Boolean!){
|
|
2
|
+
fileCreate(input: {filename: $filename, extension: $extension, relativePath: $relativePath, absolutePath: $absolutePath, size: $size, url: $url, isPublic: $isPublic }){
|
|
3
|
+
id
|
|
4
|
+
filename
|
|
5
|
+
mimetype
|
|
6
|
+
type
|
|
7
|
+
extension
|
|
8
|
+
relativePath
|
|
9
|
+
absolutePath
|
|
10
|
+
size
|
|
11
|
+
url
|
|
12
|
+
createdAt
|
|
13
|
+
createdBy{
|
|
14
|
+
user {
|
|
15
|
+
id
|
|
16
|
+
username
|
|
17
|
+
}
|
|
18
|
+
username
|
|
19
|
+
}
|
|
20
|
+
lastAccess
|
|
21
|
+
expirationDate
|
|
22
|
+
isPublic
|
|
23
|
+
hits
|
|
24
|
+
groups
|
|
25
|
+
users
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
query fileFetch{
|
|
2
|
+
fileFetch{
|
|
3
|
+
id
|
|
4
|
+
filename
|
|
5
|
+
description
|
|
6
|
+
tags
|
|
7
|
+
mimetype
|
|
8
|
+
type
|
|
9
|
+
extension
|
|
10
|
+
relativePath
|
|
11
|
+
absolutePath
|
|
12
|
+
size
|
|
13
|
+
url
|
|
14
|
+
createdAt
|
|
15
|
+
createdBy{
|
|
16
|
+
user {
|
|
17
|
+
id
|
|
18
|
+
username
|
|
19
|
+
}
|
|
20
|
+
username
|
|
21
|
+
}
|
|
22
|
+
lastAccess
|
|
23
|
+
expirationDate
|
|
24
|
+
isPublic
|
|
25
|
+
hits
|
|
26
|
+
groups
|
|
27
|
+
users
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
query fileFind($id:ID!){
|
|
2
|
+
fileFind(id:$id){
|
|
3
|
+
id
|
|
4
|
+
filename
|
|
5
|
+
description
|
|
6
|
+
tags
|
|
7
|
+
mimetype
|
|
8
|
+
type
|
|
9
|
+
extension
|
|
10
|
+
relativePath
|
|
11
|
+
absolutePath
|
|
12
|
+
size
|
|
13
|
+
url
|
|
14
|
+
createdAt
|
|
15
|
+
createdBy{
|
|
16
|
+
user {
|
|
17
|
+
id
|
|
18
|
+
username
|
|
19
|
+
}
|
|
20
|
+
username
|
|
21
|
+
}
|
|
22
|
+
lastAccess
|
|
23
|
+
expirationDate
|
|
24
|
+
isPublic
|
|
25
|
+
hits
|
|
26
|
+
groups
|
|
27
|
+
users
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
query filePaginate($input: FilterPaginateInput){
|
|
2
|
+
filePaginate(input: $input){
|
|
3
|
+
totalItems
|
|
4
|
+
page
|
|
5
|
+
items{
|
|
6
|
+
id
|
|
7
|
+
filename
|
|
8
|
+
description
|
|
9
|
+
tags
|
|
10
|
+
mimetype
|
|
11
|
+
type
|
|
12
|
+
extension
|
|
13
|
+
relativePath
|
|
14
|
+
absolutePath
|
|
15
|
+
size
|
|
16
|
+
url
|
|
17
|
+
createdAt
|
|
18
|
+
createdBy{
|
|
19
|
+
user {
|
|
20
|
+
id
|
|
21
|
+
username
|
|
22
|
+
}
|
|
23
|
+
username
|
|
24
|
+
}
|
|
25
|
+
lastAccess
|
|
26
|
+
expirationDate
|
|
27
|
+
isPublic
|
|
28
|
+
hits
|
|
29
|
+
groups
|
|
30
|
+
users
|
|
31
|
+
fileReplaces {
|
|
32
|
+
user
|
|
33
|
+
date
|
|
34
|
+
username
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
mutation fileUpdate($input: FileUpdateInput!, $file: Upload){
|
|
2
|
+
fileUpdate(input: $input, file: $file){
|
|
3
|
+
id
|
|
4
|
+
filename
|
|
5
|
+
description
|
|
6
|
+
tags
|
|
7
|
+
mimetype
|
|
8
|
+
type
|
|
9
|
+
extension
|
|
10
|
+
relativePath
|
|
11
|
+
absolutePath
|
|
12
|
+
size
|
|
13
|
+
url
|
|
14
|
+
createdAt
|
|
15
|
+
createdBy{
|
|
16
|
+
user {
|
|
17
|
+
id
|
|
18
|
+
username
|
|
19
|
+
}
|
|
20
|
+
username
|
|
21
|
+
}
|
|
22
|
+
lastAccess
|
|
23
|
+
expirationDate
|
|
24
|
+
isPublic
|
|
25
|
+
hits
|
|
26
|
+
groups
|
|
27
|
+
users
|
|
28
|
+
}
|
|
29
|
+
}
|