Skip to content

Commit

Permalink
Merge pull request #342 from Chia-Network/fix/currentRegistry
Browse files Browse the repository at this point in the history
fix: add current registry to validation
  • Loading branch information
MichaelTaylor3D authored Mar 3, 2022
2 parents f5a640c + 81ae1cb commit 4317c90
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/tasks/sync-audit-table.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _ from 'lodash';

import logUpdate from 'log-update';
import { SimpleIntervalJob, Task } from 'toad-scheduler';
import { Organization, Audit } from '../models';
import datalayer from '../datalayer';
Expand All @@ -8,7 +9,7 @@ import dotenv from 'dotenv';
dotenv.config();

const task = new Task('sync-audit', async () => {
console.log('Syncing Audit Information');
logUpdate('Syncing Audit Information');
if (process.env.USE_SIMULATOR === 'false') {
const organizations = await Organization.findAll({ raw: true });
await Promise.all(
Expand All @@ -25,7 +26,7 @@ const job = new SimpleIntervalJob(

const syncOrganizationAudit = async (organization) => {
try {
console.log('Syncing Audit:', organization.name);
logUpdate('Syncing Audit:', organization.name);
const rootHistory = await datalayer.getRootHistory(organization.registryId);

const lastRootSaved = await Audit.findOne({
Expand Down
3 changes: 2 additions & 1 deletion src/tasks/sync-organizations.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import logUpdate from 'log-update';
import { SimpleIntervalJob, Task } from 'toad-scheduler';
import { Organization } from '../models';
import dotenv from 'dotenv';
dotenv.config();

const task = new Task('sync-organizations', () => {
console.log('Subscribing to default organizations');
logUpdate('Subscribing to default organizations');
if (process.env.USE_SIMULATOR === 'false') {
Organization.subscribeToDefaultOrganizations();
}
Expand Down
3 changes: 2 additions & 1 deletion src/tasks/sync-picklists.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logUpdate from 'log-update';
import { SimpleIntervalJob, Task } from 'toad-scheduler';
import { pullPickListValues } from '../utils/data-loaders';

const task = new Task('sync-picklist', () => {
console.log('Syncing Picklist Values');
logUpdate('Syncing Picklist Values');
pullPickListValues();
});

Expand Down
1 change: 1 addition & 0 deletions src/validations/projects.validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const baseSchema = {
// warehouseProjectId - derived upon creation
// orgUid - derived upon creation
projectId: Joi.string().required(),
currentRegistry: Joi.string().required(),
originProjectId: Joi.string().required(),
registryOfOrigin: Joi.string()
.custom(pickListValidation('registries', 'registryOfOrigin'))
Expand Down
1 change: 1 addition & 0 deletions tests/test-data/new-project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"projectId": "c9d147e2-bc07-4e68-a76d-43424fa8cd4e",
"registryOfOrigin": "Singapore National Registry",
"currentRegistry": "Singapore National Registry",
"originProjectId": "Singapore National Registry",
"program": "Restoration & Conservation",
"projectName": "Sungei Buloh Wetlands Conservation",
Expand Down
1 change: 1 addition & 0 deletions tests/test-data/update-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"projectId": "c9d147e2-bc07-4e68-a76d-43424fa8cd4e",
"program": "UPDATED",
"projectName": "UPDATED",
"currentRegistry": "Singapore National Registry",
"registryOfOrigin": "Singapore National Registry",
"originProjectId": "Singapore National Registry",
"projectLink": "UPDATED",
Expand Down

0 comments on commit 4317c90

Please sign in to comment.