Compare commits
2 Commits
feature/IO
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf75ad68f9 | ||
|
|
c6784e548b |
@@ -20,7 +20,6 @@
|
|||||||
"dinero.js": "^1.8.1",
|
"dinero.js": "^1.8.1",
|
||||||
"dotenv": "^9.0.2",
|
"dotenv": "^9.0.2",
|
||||||
"env-cmd": "^10.1.0",
|
"env-cmd": "^10.1.0",
|
||||||
"exifr": "^7.0.0",
|
|
||||||
"firebase": "^8.6.0",
|
"firebase": "^8.6.0",
|
||||||
"graphql": "^15.5.0",
|
"graphql": "^15.5.0",
|
||||||
"i18next": "^20.2.2",
|
"i18next": "^20.2.2",
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
|
|||||||
import { INSERT_NEW_DOCUMENT } from "../../graphql/documents.queries";
|
import { INSERT_NEW_DOCUMENT } from "../../graphql/documents.queries";
|
||||||
import { axiosAuthInterceptorId } from "../../utils/CleanAxios";
|
import { axiosAuthInterceptorId } from "../../utils/CleanAxios";
|
||||||
import client from "../../utils/GraphQLClient";
|
import client from "../../utils/GraphQLClient";
|
||||||
import exifr from "exifr";
|
|
||||||
|
|
||||||
//Context: currentUserEmail, bodyshop, jobid, invoiceid
|
//Context: currentUserEmail, bodyshop, jobid, invoiceid
|
||||||
|
|
||||||
//Required to prevent headers from getting set and rejected from Cloudinary.
|
//Required to prevent headers from getting set and rejected from Cloudinary.
|
||||||
@@ -87,7 +85,6 @@ export const uploadToCloudinary = async (
|
|||||||
if (!!onProgress) onProgress({ percent: (e.loaded / e.total) * 100 });
|
if (!!onProgress) onProgress({ percent: (e.loaded / e.total) * 100 });
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
|
|
||||||
@@ -125,12 +122,6 @@ export const uploadToCloudinary = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Insert the document with the matching key.
|
//Insert the document with the matching key.
|
||||||
let takenat;
|
|
||||||
if (fileType.includes("image")) {
|
|
||||||
const exif = await exifr.parse(file);
|
|
||||||
console.log(`exif`, exif);
|
|
||||||
takenat = exif && exif.DateTimeOriginal;
|
|
||||||
}
|
|
||||||
const documentInsert = await client.mutate({
|
const documentInsert = await client.mutate({
|
||||||
mutation: INSERT_NEW_DOCUMENT,
|
mutation: INSERT_NEW_DOCUMENT,
|
||||||
variables: {
|
variables: {
|
||||||
@@ -144,7 +135,6 @@ export const uploadToCloudinary = async (
|
|||||||
extension: extension,
|
extension: extension,
|
||||||
bodyshopid: bodyshop.id,
|
bodyshopid: bodyshop.id,
|
||||||
size: cloudinaryUploadResponse.data.bytes || file.size,
|
size: cloudinaryUploadResponse.data.bytes || file.size,
|
||||||
takenat,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,13 +9,15 @@ export const GET_DOCUMENTS_BY_JOB = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
documents(order_by: { takenat: desc }, where: { jobid: { _eq: $jobId } }) {
|
documents(
|
||||||
|
order_by: { updated_at: desc }
|
||||||
|
where: { jobid: { _eq: $jobId } }
|
||||||
|
) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
key
|
key
|
||||||
type
|
type
|
||||||
size
|
size
|
||||||
takenat
|
|
||||||
bill {
|
bill {
|
||||||
id
|
id
|
||||||
invoice_number
|
invoice_number
|
||||||
@@ -49,7 +51,6 @@ export const INSERT_NEW_DOCUMENT = gql`
|
|||||||
name
|
name
|
||||||
key
|
key
|
||||||
size
|
size
|
||||||
takenat
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,6 @@ export const QUERY_TEMPORARY_DOCS = gql`
|
|||||||
type
|
type
|
||||||
extension
|
extension
|
||||||
size
|
size
|
||||||
takenat
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -94,7 +94,6 @@ export const UPDATE_DOCUMENT = gql`
|
|||||||
type
|
type
|
||||||
key
|
key
|
||||||
size
|
size
|
||||||
takenat
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -5696,11 +5696,6 @@ exenv@^1.2.2:
|
|||||||
resolved "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz"
|
resolved "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz"
|
||||||
integrity sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=
|
integrity sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=
|
||||||
|
|
||||||
exifr@^7.0.0:
|
|
||||||
version "7.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/exifr/-/exifr-7.0.0.tgz#065d54639f2999ac901dd8475db99b4d3f31f11e"
|
|
||||||
integrity sha512-5JRtopcolAfsX4YGcvTkldXyFDC+VPV40DxhSdRvrDr4OJQHtyccNoYl4aRzYBnVVpNueMmenS0KhzLiyNSfEQ==
|
|
||||||
|
|
||||||
exit@^0.1.2:
|
exit@^0.1.2:
|
||||||
version "0.1.2"
|
version "0.1.2"
|
||||||
resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz"
|
resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz"
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
- args:
|
|
||||||
cascade: false
|
|
||||||
read_only: false
|
|
||||||
sql: ALTER TABLE "public"."documents" DROP COLUMN "takenat";
|
|
||||||
type: run_sql
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
- args:
|
|
||||||
cascade: false
|
|
||||||
read_only: false
|
|
||||||
sql: ALTER TABLE "public"."documents" ADD COLUMN "takenat" timestamptz NULL;
|
|
||||||
type: run_sql
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
- args:
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: drop_insert_permission
|
|
||||||
- args:
|
|
||||||
permission:
|
|
||||||
check:
|
|
||||||
_or:
|
|
||||||
- job:
|
|
||||||
bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
- bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
columns:
|
|
||||||
- billid
|
|
||||||
- bodyshopid
|
|
||||||
- created_at
|
|
||||||
- extension
|
|
||||||
- id
|
|
||||||
- jobid
|
|
||||||
- key
|
|
||||||
- name
|
|
||||||
- size
|
|
||||||
- type
|
|
||||||
- updated_at
|
|
||||||
- uploaded_by
|
|
||||||
set: {}
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: create_insert_permission
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
- args:
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: drop_insert_permission
|
|
||||||
- args:
|
|
||||||
permission:
|
|
||||||
check:
|
|
||||||
_or:
|
|
||||||
- job:
|
|
||||||
bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
- bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
columns:
|
|
||||||
- billid
|
|
||||||
- bodyshopid
|
|
||||||
- created_at
|
|
||||||
- extension
|
|
||||||
- id
|
|
||||||
- jobid
|
|
||||||
- key
|
|
||||||
- name
|
|
||||||
- size
|
|
||||||
- takenat
|
|
||||||
- type
|
|
||||||
- updated_at
|
|
||||||
- uploaded_by
|
|
||||||
set: {}
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: create_insert_permission
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
- args:
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: drop_select_permission
|
|
||||||
- args:
|
|
||||||
permission:
|
|
||||||
allow_aggregations: true
|
|
||||||
columns:
|
|
||||||
- billid
|
|
||||||
- bodyshopid
|
|
||||||
- created_at
|
|
||||||
- extension
|
|
||||||
- id
|
|
||||||
- jobid
|
|
||||||
- key
|
|
||||||
- name
|
|
||||||
- size
|
|
||||||
- type
|
|
||||||
- updated_at
|
|
||||||
- uploaded_by
|
|
||||||
computed_fields: []
|
|
||||||
filter:
|
|
||||||
_or:
|
|
||||||
- job:
|
|
||||||
bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
- bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: create_select_permission
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
- args:
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: drop_select_permission
|
|
||||||
- args:
|
|
||||||
permission:
|
|
||||||
allow_aggregations: true
|
|
||||||
columns:
|
|
||||||
- billid
|
|
||||||
- bodyshopid
|
|
||||||
- created_at
|
|
||||||
- extension
|
|
||||||
- id
|
|
||||||
- jobid
|
|
||||||
- key
|
|
||||||
- name
|
|
||||||
- size
|
|
||||||
- takenat
|
|
||||||
- type
|
|
||||||
- updated_at
|
|
||||||
- uploaded_by
|
|
||||||
computed_fields: []
|
|
||||||
filter:
|
|
||||||
_or:
|
|
||||||
- job:
|
|
||||||
bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
- bodyshop:
|
|
||||||
associations:
|
|
||||||
_and:
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
role: user
|
|
||||||
table:
|
|
||||||
name: documents
|
|
||||||
schema: public
|
|
||||||
type: create_select_permission
|
|
||||||
@@ -1520,7 +1520,6 @@ tables:
|
|||||||
- key
|
- key
|
||||||
- name
|
- name
|
||||||
- size
|
- size
|
||||||
- takenat
|
|
||||||
- type
|
- type
|
||||||
- updated_at
|
- updated_at
|
||||||
- uploaded_by
|
- uploaded_by
|
||||||
@@ -1537,7 +1536,6 @@ tables:
|
|||||||
- key
|
- key
|
||||||
- name
|
- name
|
||||||
- size
|
- size
|
||||||
- takenat
|
|
||||||
- type
|
- type
|
||||||
- updated_at
|
- updated_at
|
||||||
- uploaded_by
|
- uploaded_by
|
||||||
|
|||||||
Reference in New Issue
Block a user