mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00
fix(note): fix type for owner param
To make the create method easier to use in conjunction with the authentication framework, this commit changes the type of the `owner` parameter from `User | undefined` to `User | null`. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
01b53d3858
commit
9c08ff94fe
14 changed files with 69 additions and 58 deletions
|
@ -49,8 +49,8 @@ describe('Alias', () => {
|
|||
beforeAll(async () => {
|
||||
const note = await testSetup.notesService.createNote(
|
||||
content,
|
||||
testAlias,
|
||||
user,
|
||||
testAlias,
|
||||
);
|
||||
publicId = note.publicId;
|
||||
});
|
||||
|
@ -104,8 +104,8 @@ describe('Alias', () => {
|
|||
beforeAll(async () => {
|
||||
const note = await testSetup.notesService.createNote(
|
||||
content,
|
||||
testAlias,
|
||||
user,
|
||||
testAlias,
|
||||
);
|
||||
publicId = note.publicId;
|
||||
await testSetup.aliasService.addAlias(note, newAlias);
|
||||
|
@ -153,8 +153,8 @@ describe('Alias', () => {
|
|||
beforeAll(async () => {
|
||||
const note = await testSetup.notesService.createNote(
|
||||
content,
|
||||
testAlias,
|
||||
user,
|
||||
testAlias,
|
||||
);
|
||||
await testSetup.aliasService.addAlias(note, newAlias);
|
||||
});
|
||||
|
|
|
@ -50,8 +50,8 @@ describe('History', () => {
|
|||
user = await userService.createUser('hardcoded', 'Testy');
|
||||
await identityService.createLocalIdentity(user, 'test');
|
||||
const notesService = moduleRef.get(NotesService);
|
||||
note = await notesService.createNote(content, 'note', user);
|
||||
note2 = await notesService.createNote(content, 'note2', user);
|
||||
note = await notesService.createNote(content, user, 'note');
|
||||
note2 = await notesService.createNote(content, user, 'note2');
|
||||
agent = request.agent(testSetup.app.getHttpServer());
|
||||
await agent
|
||||
.post('/api/private/auth/local/login')
|
||||
|
|
|
@ -40,8 +40,8 @@ describe('Me', () => {
|
|||
|
||||
content = 'This is a test note.';
|
||||
alias2 = 'note2';
|
||||
note1 = await testSetup.notesService.createNote(content, undefined, user);
|
||||
note2 = await testSetup.notesService.createNote(content, alias2, user);
|
||||
note1 = await testSetup.notesService.createNote(content, user);
|
||||
note2 = await testSetup.notesService.createNote(content, user, alias2);
|
||||
agent = request.agent(testSetup.app.getHttpServer());
|
||||
await agent
|
||||
.post('/api/private/auth/local/login')
|
||||
|
|
|
@ -40,6 +40,7 @@ describe('Media', () => {
|
|||
|
||||
await testSetup.notesService.createNote(
|
||||
'test content',
|
||||
null,
|
||||
'test_upload_media',
|
||||
);
|
||||
user = await testSetup.userService.createUser('hardcoded', 'Testy');
|
||||
|
@ -109,6 +110,7 @@ describe('Media', () => {
|
|||
it('DELETE /media/{filename}', async () => {
|
||||
const testNote = await testSetup.notesService.createNote(
|
||||
'test content',
|
||||
null,
|
||||
'test_delete_media',
|
||||
);
|
||||
const testImage = await fs.readFile('test/private-api/fixtures/test.png');
|
||||
|
|
|
@ -74,7 +74,7 @@ describe('Notes', () => {
|
|||
describe('GET /notes/{note}', () => {
|
||||
it('works with an existing note', async () => {
|
||||
// check if we can succefully get a note that exists
|
||||
await testSetup.notesService.createNote(content, 'test1', user);
|
||||
await testSetup.notesService.createNote(content, user, 'test1');
|
||||
const response = await agent
|
||||
.get('/api/private/notes/test1')
|
||||
.expect('Content-Type', /json/)
|
||||
|
@ -133,8 +133,8 @@ describe('Notes', () => {
|
|||
const noteId = 'test3';
|
||||
const note = await testSetup.notesService.createNote(
|
||||
content,
|
||||
noteId,
|
||||
user,
|
||||
noteId,
|
||||
);
|
||||
await testSetup.mediaService.saveFile(testImage, user, note);
|
||||
await agent
|
||||
|
@ -158,8 +158,8 @@ describe('Notes', () => {
|
|||
const noteId = 'test3a';
|
||||
const note = await testSetup.notesService.createNote(
|
||||
content,
|
||||
noteId,
|
||||
user,
|
||||
noteId,
|
||||
);
|
||||
const url = await testSetup.mediaService.saveFile(
|
||||
testImage,
|
||||
|
@ -198,7 +198,7 @@ describe('Notes', () => {
|
|||
|
||||
describe('GET /notes/{note}/revisions', () => {
|
||||
it('works with existing alias', async () => {
|
||||
await testSetup.notesService.createNote(content, 'test4', user);
|
||||
await testSetup.notesService.createNote(content, user, 'test4');
|
||||
const response = await agent
|
||||
.get('/api/private/notes/test4/revisions')
|
||||
.expect('Content-Type', /json/)
|
||||
|
@ -226,8 +226,8 @@ describe('Notes', () => {
|
|||
const noteId = 'test8';
|
||||
const note = await testSetup.notesService.createNote(
|
||||
content,
|
||||
noteId,
|
||||
user,
|
||||
noteId,
|
||||
);
|
||||
await testSetup.notesService.updateNote(note, 'update');
|
||||
const responseBeforeDeleting = await agent
|
||||
|
@ -263,8 +263,8 @@ describe('Notes', () => {
|
|||
it('works with an existing alias', async () => {
|
||||
const note = await testSetup.notesService.createNote(
|
||||
content,
|
||||
'test5',
|
||||
user,
|
||||
'test5',
|
||||
);
|
||||
const revision = await testSetup.notesService.getLatestRevision(note);
|
||||
const response = await agent
|
||||
|
@ -293,13 +293,13 @@ describe('Notes', () => {
|
|||
const extraAlias = 'test7';
|
||||
const note1 = await testSetup.notesService.createNote(
|
||||
content,
|
||||
alias,
|
||||
user,
|
||||
alias,
|
||||
);
|
||||
const note2 = await testSetup.notesService.createNote(
|
||||
content,
|
||||
extraAlias,
|
||||
user,
|
||||
extraAlias,
|
||||
);
|
||||
const response = await agent
|
||||
.get(`/api/private/notes/${alias}/media/`)
|
||||
|
@ -343,8 +343,8 @@ describe('Notes', () => {
|
|||
const alias = 'test11';
|
||||
await testSetup.notesService.createNote(
|
||||
'This is a test note.',
|
||||
alias,
|
||||
user2,
|
||||
alias,
|
||||
);
|
||||
await agent
|
||||
.get(`/api/private/notes/${alias}/media/`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue