BOD-24 Removed URL/Thumb URL to have them dynamically created.
This commit is contained in:
@@ -68,7 +68,7 @@ export function DocumentsUploadContainer({
|
||||
let timestamp = Math.floor(Date.now() / 1000);
|
||||
let public_id = fileName;
|
||||
let tags = `${bodyshop.textid},${
|
||||
tagsArray ? tagsArray.map((tag) => `{tag},`) : ""
|
||||
tagsArray ? tagsArray.map((tag) => `${tag},`) : ""
|
||||
}`;
|
||||
let eager = "w_200,h_200,c_thumb";
|
||||
axios
|
||||
@@ -110,8 +110,6 @@ export function DocumentsUploadContainer({
|
||||
{
|
||||
jobid: jobId,
|
||||
uploaded_by: currentUser.email,
|
||||
url: "c",
|
||||
thumb_url: "c",
|
||||
key: fileName,
|
||||
invoiceid: invoiceId,
|
||||
type: fileType,
|
||||
@@ -121,10 +119,8 @@ export function DocumentsUploadContainer({
|
||||
}).then((r) => {
|
||||
onSuccess({
|
||||
uid: r.data.insert_documents.returning[0].id,
|
||||
url: r.data.insert_documents.returning[0].thumb_url,
|
||||
name: r.data.insert_documents.returning[0].name,
|
||||
status: "done",
|
||||
full_url: r.data.insert_documents.returning[0].url,
|
||||
key: r.data.insert_documents.returning[0].key,
|
||||
});
|
||||
notification["success"]({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Button, notification } from "antd";
|
||||
import { Button } from "antd";
|
||||
import axios from "axios";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import axios from "axios";
|
||||
|
||||
export default function JobsDocumentsDownloadButton({ galleryImages }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -11,13 +11,11 @@ function JobsDocumentsComponent({ data, jobId, refetch }) {
|
||||
setgalleryImages(
|
||||
data.reduce((acc, value) => {
|
||||
acc.push({
|
||||
src: value.url,
|
||||
thumbnail: `${
|
||||
process.env.REACT_APP_CLOUDINARY_IMAGE_ENDPOINT
|
||||
}/h_200,w_200,c_thumb/${value.key}${
|
||||
value.type.includes("pdf") ? ".jpg" : ""
|
||||
}`,
|
||||
tags: value.type.includes("pdf") ? [{ value: "PDF" }] : [],
|
||||
src: `${process.env.REACT_APP_CLOUDINARY_IMAGE_ENDPOINT}/${value.key}.jpg`,
|
||||
thumbnail: `${process.env.REACT_APP_CLOUDINARY_IMAGE_ENDPOINT}/h_200,w_200,c_thumb/${value.key}.jpg`,
|
||||
tags: value.type.includes("pdf")
|
||||
? [{ value: "PDF", title: "PDF" }]
|
||||
: [],
|
||||
thumbnailHeight: 200,
|
||||
thumbnailWidth: 200,
|
||||
isSelected: false,
|
||||
@@ -31,7 +29,11 @@ function JobsDocumentsComponent({ data, jobId, refetch }) {
|
||||
|
||||
return (
|
||||
<div className="clearfix">
|
||||
<DocumentsUploadContainer jobId={jobId} callbackAfterUpload={refetch} />
|
||||
<DocumentsUploadContainer
|
||||
jobId={jobId}
|
||||
callbackAfterUpload={refetch}
|
||||
tagsArray={["test"]}
|
||||
/>
|
||||
|
||||
<JobsDocumentsDownloadButton galleryImages={galleryImages} />
|
||||
<JobsDocumentsDeleteButton
|
||||
|
||||
@@ -4,8 +4,6 @@ export const GET_DOCUMENTS_BY_JOB = gql`
|
||||
query GET_DOCUMENTS_BY_JOB($jobId: uuid!) {
|
||||
documents(where: { jobid: { _eq: $jobId } }) {
|
||||
id
|
||||
url
|
||||
thumb_url
|
||||
name
|
||||
key
|
||||
type
|
||||
@@ -18,8 +16,6 @@ export const INSERT_NEW_DOCUMENT = gql`
|
||||
insert_documents(objects: $docInput) {
|
||||
returning {
|
||||
id
|
||||
url
|
||||
thumb_url
|
||||
name
|
||||
key
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
cascade: true
|
||||
read_only: false
|
||||
sql: "ALTER TABLE documents \r\nDROP COLUMN url ;\r\nALTER TABLE documents \r\nDROP
|
||||
COLUMN thumb_url ;"
|
||||
type: run_sql
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: documents
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
@@ -0,0 +1,32 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_upsert: true
|
||||
check:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- uploaded_by
|
||||
- jobid
|
||||
- name
|
||||
- key
|
||||
- invoiceid
|
||||
- type
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: documents
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: documents
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
@@ -0,0 +1,30 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- key
|
||||
- name
|
||||
- type
|
||||
- uploaded_by
|
||||
- created_at
|
||||
- updated_at
|
||||
- id
|
||||
- invoiceid
|
||||
- jobid
|
||||
computed_fields: []
|
||||
filter:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
limit: null
|
||||
role: user
|
||||
table:
|
||||
name: documents
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: documents
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
@@ -0,0 +1,22 @@
|
||||
- args:
|
||||
permission:
|
||||
columns: []
|
||||
filter:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: documents
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
Reference in New Issue
Block a user