mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
AuthorshipEntity: Adjust to DB schema
This commit replaces the user property with a author property,
in accordance with the DB schema updated in 0d6c3002
.
It also adjusts the NoteService accordingly.
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
8040f47d00
commit
3d07c5e443
3 changed files with 25 additions and 11 deletions
|
@ -655,7 +655,8 @@ describe('NotesService', () => {
|
|||
describe('toNoteMetadataDto', () => {
|
||||
it('works', async () => {
|
||||
const user = User.create('hardcoded', 'Testy') as User;
|
||||
const otherUser = User.create('other hardcoded', 'Testy2') as User;
|
||||
const author = Author.create(1);
|
||||
author.user = user;
|
||||
const group = Group.create('testGroup', 'testGroup');
|
||||
const content = 'testContent';
|
||||
jest
|
||||
|
@ -665,18 +666,18 @@ describe('NotesService', () => {
|
|||
const revisions = await note.revisions;
|
||||
revisions[0].authorships = [
|
||||
{
|
||||
user: otherUser,
|
||||
revisions: revisions,
|
||||
startPos: 0,
|
||||
endPos: 1,
|
||||
updatedAt: new Date(1549312452000),
|
||||
author: author,
|
||||
} as Authorship,
|
||||
{
|
||||
user: user,
|
||||
revisions: revisions,
|
||||
startPos: 0,
|
||||
endPos: 1,
|
||||
updatedAt: new Date(1549312452001),
|
||||
author: author,
|
||||
} as Authorship,
|
||||
];
|
||||
revisions[0].createdAt = new Date(1549312452000);
|
||||
|
@ -738,6 +739,8 @@ describe('NotesService', () => {
|
|||
describe('toNoteDto', () => {
|
||||
it('works', async () => {
|
||||
const user = User.create('hardcoded', 'Testy') as User;
|
||||
const author = Author.create(1);
|
||||
author.user = user;
|
||||
const otherUser = User.create('other hardcoded', 'Testy2') as User;
|
||||
otherUser.userName = 'other hardcoded user';
|
||||
const group = Group.create('testGroup', 'testGroup');
|
||||
|
@ -749,18 +752,18 @@ describe('NotesService', () => {
|
|||
const revisions = await note.revisions;
|
||||
revisions[0].authorships = [
|
||||
{
|
||||
user: otherUser,
|
||||
revisions: revisions,
|
||||
startPos: 0,
|
||||
endPos: 1,
|
||||
updatedAt: new Date(1549312452000),
|
||||
author: author,
|
||||
} as Authorship,
|
||||
{
|
||||
user: user,
|
||||
revisions: revisions,
|
||||
startPos: 0,
|
||||
endPos: 1,
|
||||
updatedAt: new Date(1549312452001),
|
||||
author: author,
|
||||
} as Authorship,
|
||||
];
|
||||
revisions[0].createdAt = new Date(1549312452000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue