Skip to content

Commit

Permalink
Run yarn format on the code
Browse files Browse the repository at this point in the history
  • Loading branch information
tahini committed Feb 5, 2024
1 parent 3e2c096 commit 63d01c2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 37 deletions.
28 changes: 14 additions & 14 deletions packages/evolution-backend/src/models/interviews.db.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,21 +417,21 @@ const getRawWhereClause = (
case 'uuid':
return `${tblAlias}.${field} ${filter.op ? operatorSigns[filter.op] : operatorSigns.eq} '${filter.value}'`;
case 'audits': {
if (typeof filter.value !== 'string') {
return undefined;
}
const match = filter.value.match(dotSeparatedStringRegex);
if (match === null) {
throw new TrError(
`Invalid value for where clause in ${tableName} database`,
'DBQCR0006',
'DatabaseInvalidWhereClauseUserEntry'
);
}
// Add subquery to audits table
const auditSubQuery = knex('sv_audits').select('interview_id').distinct().where('error_code', filter.value);
return [`${tblAlias}.id in (${auditSubQuery.toSQL().sql})`, filter.value];
if (typeof filter.value !== 'string') {
return undefined;
}
const match = filter.value.match(dotSeparatedStringRegex);
if (match === null) {
throw new TrError(
`Invalid value for where clause in ${tableName} database`,
'DBQCR0006',
'DatabaseInvalidWhereClauseUserEntry'
);
}
// Add subquery to audits table
const auditSubQuery = knex('sv_audits').select('interview_id').distinct().where('error_code', filter.value);
return [`${tblAlias}.id in (${auditSubQuery.toSQL().sql})`, filter.value];
}
}
const jsonObject = field.split('.');
// TODO only responses field order by is supported
Expand Down
2 changes: 1 addition & 1 deletion packages/evolution-backend/src/services/surveys/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export type SurveyAttributes = {
end_date?: Date;
config?: {
[key: string]: string;
}
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type BasePersonAttributes = {
type ExtendedPersonAttributes = BasePersonAttributes & { [key: string]: any };

// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface IBasePersonAttributes extends BasePersonAttributes { }
interface IBasePersonAttributes extends BasePersonAttributes {}

class BasePerson extends Uuidable implements IBasePersonAttributes, IValidatable {
_isValid: OptionalValidity;
Expand Down Expand Up @@ -136,7 +136,6 @@ class BasePerson extends Uuidable implements IBasePersonAttributes, IValidatable
this.baseHome = params.baseHome;
}


/**
* Factory that validates input from an interview and makes
* sure types and required fields are valid before returning a new object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,17 @@ export const ageGroupValues = [
'110-114',
'115-119',
'120-124',
'125-129',
'125-129'
];

export type AgeGroup = typeof ageGroupValues[number];
export type AgeGroup = (typeof ageGroupValues)[number];
// Most of the time at least age OR age group must be defined

export const genderValues = [
'female',
'male',
'custom',
];
export type Gender = typeof genderValues[number];

export const genderValues = ['female', 'male', 'custom'];
export type Gender = (typeof genderValues)[number];

export const yesNoDontKnowNonApplicableValues = ['yes', 'no', 'dontKnow', 'nonApplicable'];
export type YesNoDontKnowNonApplicable = typeof yesNoDontKnowNonApplicableValues[number];

export type YesNoDontKnowNonApplicable = (typeof yesNoDontKnowNonApplicableValues)[number];

export type DrivingLicenseOwnership = YesNoDontKnowNonApplicable;

Expand Down Expand Up @@ -86,9 +80,9 @@ export const occupationValues = [
'unemployed',
'other',
'nonApplicable',
'preferNotToAnswer',
'preferNotToAnswer'
];
export type Occupation = typeof occupationValues[number];
export type Occupation = (typeof occupationValues)[number];

export type JobCategory = string | 'dontKnow' | 'nonApplicable'; // TODO: add job categories from official source if possible and document it
export type JobName = string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@

export type GeocodingPrecisionCategory = string; // TODO: add normalized precision levels

export const lastActionValues = [
'findPlace',
'mapClicked',
'markerDragged',
'preGeocoded',
];
export const lastActionValues = ['findPlace', 'mapClicked', 'markerDragged', 'preGeocoded'];

export type LastAction = typeof lastActionValues[number];
export type LastAction = (typeof lastActionValues)[number];

0 comments on commit 63d01c2

Please sign in to comment.