Skip to content

Commit

Permalink
Fix linting errors coming from require-await rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Pl217 committed Sep 6, 2021
1 parent aa15deb commit 376be1f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
7 changes: 2 additions & 5 deletions src/db/models/authGrant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const authGrantModel = (conn: Knex) => {
// expose wrappers that require that a user is specified,
// and transactionally create logs

const create = async (
const create = (
data: UserData,
actor: ParticipantId,
date = new Date()
Expand All @@ -61,10 +61,7 @@ const authGrantModel = (conn: Knex) => {
});
};

const update = async (
data: UserData,
actor: ParticipantId
): Promise<void> => {
const update = (data: UserData, actor: ParticipantId): Promise<void> => {
return conn.transaction(async (trx) => {
await authGrantLog.create(
{
Expand Down
15 changes: 8 additions & 7 deletions src/db/models/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ export default defineVersionedModel({
},
},
},
prepare: async (data) => ({
belongsToType: data.belongsTo.type,
belongsToId:
data.belongsTo.type === 'operation'
? data.belongsTo.operation
: undefined,
}),
prepare: (data) =>
Promise.resolve({
belongsToType: data.belongsTo.type,
belongsToId:
data.belongsTo.type === 'operation'
? data.belongsTo.operation
: undefined,
}),
},
});
2 changes: 1 addition & 1 deletion src/db/models/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ export default defineVersionedModel({
data: OPERATION_DATA,
lookupColumns: {
columns: {},
prepare: async () => ({}),
prepare: () => Promise.resolve({}),
},
});
7 changes: 4 additions & 3 deletions src/db/models/operationCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ export default defineVersionedModel({
},
},
},
prepare: async (data) => ({
operationId: data.operation,
}),
prepare: (data) =>
Promise.resolve({
operationId: data.operation,
}),
},
});
15 changes: 8 additions & 7 deletions src/db/models/reportingWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ export default defineVersionedModel({
},
},
},
prepare: async (data) => ({
belongsToType: data.belongsTo.type,
belongsToId:
data.belongsTo.type === 'operation'
? data.belongsTo.operation
: undefined,
}),
prepare: (data) =>
Promise.resolve({
belongsToType: data.belongsTo.type,
belongsToId:
data.belongsTo.type === 'operation'
? data.belongsTo.operation
: undefined,
}),
},
});
2 changes: 1 addition & 1 deletion src/db/util/id-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const defineIDModel =

const model = defineSequelizeModel(opts)(conn);

const get = async (id: ID): Promise<Instance | null> =>
const get = (id: ID): Promise<Instance | null> =>
model.findOne({
where: {
[idField]: id,
Expand Down
4 changes: 2 additions & 2 deletions src/db/util/sequelize-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const defineSequelizeModel =
fields,
})(conn);

const create: CreateFn<Fields> = async (data, opts) => {
const create: CreateFn<Fields> = (data, opts) => {
return model.create(
{
...data,
Expand All @@ -98,7 +98,7 @@ export const defineSequelizeModel =
);
};

const update: UpdateFn<Fields> = async (args) => {
const update: UpdateFn<Fields> = (args) => {
return model.update({
...args,
values: {
Expand Down

0 comments on commit 376be1f

Please sign in to comment.