Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run yarn format on the code #371

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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];
Loading