Full refactor to Typescript
This commit is contained in:
@@ -3,7 +3,7 @@ import crypto from 'crypto'
|
||||
import { readFile, writeFile, access, constants } from 'fs/promises'
|
||||
|
||||
import {
|
||||
CommonProps as MetaProps,
|
||||
MetadataProps as MetaProps,
|
||||
Problem,
|
||||
ProblemId,
|
||||
Solution,
|
||||
@@ -191,14 +191,16 @@ export const updateSolution = (
|
||||
})
|
||||
|
||||
type SolutionsQuery = Partial<{
|
||||
sentBy: UserId
|
||||
forProblem: ProblemId
|
||||
sentBy?: UserId
|
||||
forProblem?: ProblemId
|
||||
}>
|
||||
|
||||
export const getSolutions = (db: DatabaseConnection, { sentBy, forProblem }: SolutionsQuery = {}) =>
|
||||
withDatabase(db, state => {
|
||||
let solutions = Object.values(state.solutions)
|
||||
|
||||
console.log(solutions.length, sentBy, forProblem)
|
||||
|
||||
if (sentBy) {
|
||||
solutions = solutions.filter(s => s.sentBy === sentBy)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user