Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/tired-clubs-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@quassel/backend": patch
---

Fix creating language entries when creating for multiple days
21 changes: 12 additions & 9 deletions apps/backend/src/research/entries/entries.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
private readonly em: EntityManager
) {}

create({ weekday, ...rest }: EntryCreationDto) {
return this.entryRepository.insertMany(
weekday.map((w) => {
const entry = new Entry();
entry.assign({ weekday: w, ...rest }, { em: this.em });

return entry;
})
);
async create({ weekday, ...rest }: EntryCreationDto) {
const entries = weekday.map((w) => {
const entry = new Entry();
entry.assign({ ...rest, weekday: w }, { em: this.em });

Check warning on line 19 in apps/backend/src/research/entries/entries.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/backend/src/research/entries/entries.service.ts#L16-L19

Added lines #L16 - L19 were not covered by tests

this.em.persist(entry);
return entry;

Check warning on line 22 in apps/backend/src/research/entries/entries.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/backend/src/research/entries/entries.service.ts#L21-L22

Added lines #L21 - L22 were not covered by tests
});

await this.em.flush();

Check warning on line 25 in apps/backend/src/research/entries/entries.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/backend/src/research/entries/entries.service.ts#L25

Added line #L25 was not covered by tests

return entries.map((entries) => entries.toObject().id);

Check warning on line 27 in apps/backend/src/research/entries/entries.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/backend/src/research/entries/entries.service.ts#L27

Added line #L27 was not covered by tests
}

async findAll() {
Expand Down