style: fix linting issues met Prettier
This commit is contained in:
parent
e58835aa17
commit
e73d5c21c3
34 changed files with 103 additions and 296 deletions
|
@ -4,19 +4,13 @@ import { Question } from '../../entities/questions/question.entity.js';
|
|||
import { Teacher } from '../../entities/users/teacher.entity.js';
|
||||
|
||||
export class AnswerRepository extends DwengoEntityRepository<Answer> {
|
||||
public createAnswer(answer: {
|
||||
toQuestion: Question;
|
||||
author: Teacher;
|
||||
content: string;
|
||||
}): Promise<Answer> {
|
||||
const answerEntity = this.create(
|
||||
{
|
||||
toQuestion: answer.toQuestion,
|
||||
author: answer.author,
|
||||
content: answer.content,
|
||||
timestamp: new Date()
|
||||
}
|
||||
);
|
||||
public createAnswer(answer: { toQuestion: Question; author: Teacher; content: string }): Promise<Answer> {
|
||||
const answerEntity = this.create({
|
||||
toQuestion: answer.toQuestion,
|
||||
author: answer.author,
|
||||
content: answer.content,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return this.insert(answerEntity);
|
||||
}
|
||||
public findAllAnswersToQuestion(question: Question): Promise<Answer[]> {
|
||||
|
|
|
@ -11,7 +11,7 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
|
|||
learningObjectVersion: question.loId.version,
|
||||
author: question.author,
|
||||
content: question.content,
|
||||
timestamp: new Date()
|
||||
timestamp: new Date(),
|
||||
});
|
||||
questionEntity.learningObjectHruid = question.loId.hruid;
|
||||
questionEntity.learningObjectLanguage = question.loId.language;
|
||||
|
|
|
@ -24,7 +24,7 @@ import { LearningPath } from './entities/content/learning-path.entity.js';
|
|||
|
||||
import { Answer } from './entities/questions/answer.entity.js';
|
||||
import { Question } from './entities/questions/question.entity.js';
|
||||
import {SqliteAutoincrementSubscriber} from "./sqlite-autoincrement-workaround.js";
|
||||
import { SqliteAutoincrementSubscriber } from './sqlite-autoincrement-workaround.js';
|
||||
|
||||
const entities = [
|
||||
User,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {EntityManager, MikroORM} from '@mikro-orm/core';
|
||||
import { EntityManager, MikroORM } from '@mikro-orm/core';
|
||||
import config from './mikro-orm.config.js';
|
||||
import { EnvVars, getEnvVar } from './util/envvars.js';
|
||||
import { getLogger, Logger } from './logging/initalize.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {EntityProperty, EventArgs, EventSubscriber} from "@mikro-orm/core";
|
||||
import { EntityProperty, EventArgs, EventSubscriber } from '@mikro-orm/core';
|
||||
|
||||
/**
|
||||
* The tests are ran on an in-memory SQLite database. However, SQLite does not allow fields which are part of composite
|
||||
|
@ -29,7 +29,7 @@ export class SqliteAutoincrementSubscriber implements EventSubscriber {
|
|||
const property = prop as EntityProperty<T>;
|
||||
if (property.primary && property.autoincrement && !(args.entity as Record<string, any>)[property.name]) {
|
||||
// Obtain and increment sequence number of this entity.
|
||||
const propertyKey = args.meta.class.name + "." + property.name;
|
||||
const propertyKey = args.meta.class.name + '.' + property.name;
|
||||
const nextSeqNumber = this.sequenceNumbersForEntityType.get(propertyKey) || 0;
|
||||
this.sequenceNumbersForEntityType.set(propertyKey, nextSeqNumber + 1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue