add migration script for update menu & add IsArchive field in document cls

This commit is contained in:
prafull-opensignlabs
2024-01-10 12:21:00 +05:30
parent 9a3b70de43
commit 9cb0ced4f6
4 changed files with 54 additions and 13 deletions
@@ -21,6 +21,7 @@ export default async function getDocument(request) {
query.include('Signers');
query.include('AuditTrail.UserPtr');
query.include('Placeholders');
query.notEqualTo('IsArchive', true)
const res = await query.first({ useMasterKey: true });
if (res) {
const acl = res.getACL();
@@ -7,11 +7,11 @@ export default function reportJson(id, userId) {
return {
reportName: 'Draft Documents',
params: {
Type: null,
$or: [
{ Signers: null, SignedUrl: null },
{ Signers: { $exists: true }, Placeholders: null },
],
Type: { $ne: 'Folder' },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
$or: [{ Signers: null }, { Signers: { $exists: true }, Placeholders: null }],
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -28,6 +28,7 @@ export default function reportJson(id, userId) {
Type: { $ne: 'Folder' },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
ExpiryDate: {
$gt: { __type: 'Date', iso: new Date().toISOString() },
},
@@ -66,6 +67,7 @@ export default function reportJson(id, userId) {
Placeholders: { $ne: null },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -82,7 +84,7 @@ export default function reportJson(id, userId) {
return {
reportName: 'Completed Documents',
params: {
Type: null,
Type: { $ne: 'Folder' },
IsCompleted: true,
CreatedBy: {
__type: 'Pointer',
@@ -90,6 +92,7 @@ export default function reportJson(id, userId) {
objectId: currentUserId,
},
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
},
keys: [
'Name',
@@ -108,6 +111,7 @@ export default function reportJson(id, userId) {
reportName: 'Declined Documents',
params: {
Type: null,
IsArchive: { $ne: true },
IsDeclined: true,
CreatedBy: {
__type: 'Pointer',
@@ -125,6 +129,7 @@ export default function reportJson(id, userId) {
params: {
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
Type: { $ne: 'Folder' },
$and: [
{
@@ -157,6 +162,7 @@ export default function reportJson(id, userId) {
Placeholders: { $ne: null },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -176,6 +182,7 @@ export default function reportJson(id, userId) {
Type: { $ne: 'Folder' },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
ExpiryDate: {
$gt: { __type: 'Date', iso: new Date().toISOString() },
},
@@ -200,11 +207,11 @@ export default function reportJson(id, userId) {
return {
reportName: 'Drafts',
params: {
Type: null,
$or: [
{ Signers: null, SignedUrl: null },
{ Signers: { $exists: true }, Placeholders: null },
],
Type: { $ne: 'Folder' },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
IsArchive: { $ne: true },
$or: [{ Signers: null }, { Signers: { $exists: true }, Placeholders: null }],
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -235,6 +242,7 @@ export default function reportJson(id, userId) {
reportClass: 'contracts_Template',
params: {
Type: { $ne: 'Folder' },
IsArchive: { $ne: true },
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -59,7 +59,7 @@ exports.up = async Parse => {
},
{
icon: 'fas fa-folder',
title: 'OpenSignDrive',
title: 'OpenSignDrive',
target: '_self',
pageType: 'mf',
description: '',
@@ -206,6 +206,15 @@ exports.up = async Parse => {
description: '',
objectId: '6TeaPr321t',
},
{
icon: 'fas fa-folder',
title: 'OpenSign™ Drive',
target: '_self',
pageType: 'mf',
description: '',
objectId:
'remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9TaWduLU1pY3JvYXBwVjIvcmVtb3RlRW50cnkuanM=&moduleToLoad=AppRoutes&remoteName=signmicroapp/legadrive',
},
{
icon: 'fas fa-address-card',
title: 'Reports',
@@ -576,4 +585,4 @@ exports.down = async Parse => {
// schema.addString('name').addNumber('cash');
const batch = [revertUserMenu, revertAdminMenu];
return Parse.Object.saveAll(batch, { useMasterKey: true });
};
};
@@ -0,0 +1,23 @@
/**
*
* @param {Parse} Parse
*/
exports.up = async Parse => {
// TODO: set className here
const className = 'contracts_Document';
const schema = new Parse.Schema(className);
schema.addBoolean('IsArchive');
return schema.update();
};
/**
*
* @param {Parse} Parse
*/
exports.down = async Parse => {
// TODO: set className here
const className = 'contracts_Document';
const schema = new Parse.Schema(className);
schema.deleteField('IsArchive');
return schema.update();
};