mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 07:04:45 -04:00
fix: services use the new typings from create methods
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
d0b8e4cd36
commit
8cda5f99fb
4 changed files with 15 additions and 11 deletions
|
@ -79,17 +79,17 @@ export class AuthService {
|
||||||
new Date().getTime() + 2 * 365 * 24 * 60 * 60 * 1000;
|
new Date().getTime() + 2 * 365 * 24 * 60 * 60 * 1000;
|
||||||
if (validUntil === 0 || validUntil > maximumTokenValidity) {
|
if (validUntil === 0 || validUntil > maximumTokenValidity) {
|
||||||
token = AuthToken.create(
|
token = AuthToken.create(
|
||||||
|
keyId,
|
||||||
user,
|
user,
|
||||||
identifier,
|
identifier,
|
||||||
keyId,
|
|
||||||
accessToken,
|
accessToken,
|
||||||
new Date(maximumTokenValidity),
|
new Date(maximumTokenValidity),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
token = AuthToken.create(
|
token = AuthToken.create(
|
||||||
|
keyId,
|
||||||
user,
|
user,
|
||||||
identifier,
|
identifier,
|
||||||
keyId,
|
|
||||||
accessToken,
|
accessToken,
|
||||||
new Date(validUntil),
|
new Date(validUntil),
|
||||||
);
|
);
|
||||||
|
|
|
@ -173,7 +173,7 @@ export class HistoryService {
|
||||||
`Note with id/alias '${historyEntry.note}' not found.`,
|
`Note with id/alias '${historyEntry.note}' not found.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const entry = HistoryEntry.create(user, note);
|
const entry = HistoryEntry.create(user, note) as HistoryEntry;
|
||||||
entry.pinStatus = historyEntry.pinStatus;
|
entry.pinStatus = historyEntry.pinStatus;
|
||||||
entry.updatedAt = historyEntry.lastVisited;
|
entry.updatedAt = historyEntry.lastVisited;
|
||||||
await manager.save<HistoryEntry>(entry);
|
await manager.save<HistoryEntry>(entry);
|
||||||
|
|
|
@ -61,17 +61,17 @@ export class AliasService {
|
||||||
`The alias '${alias}' is already a public id.`,
|
`The alias '${alias}' is already a public id.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let newAlias: Alias;
|
let newAlias;
|
||||||
if (note.aliases.length === 0) {
|
if (note.aliases.length === 0) {
|
||||||
// the first alias is automatically made the primary alias
|
// the first alias is automatically made the primary alias
|
||||||
newAlias = Alias.create(alias, true);
|
newAlias = Alias.create(alias, note, true);
|
||||||
} else {
|
} else {
|
||||||
newAlias = Alias.create(alias);
|
newAlias = Alias.create(alias, note);
|
||||||
}
|
}
|
||||||
note.aliases.push(newAlias);
|
note.aliases.push(newAlias as Alias);
|
||||||
|
|
||||||
await this.noteRepository.save(note);
|
await this.noteRepository.save(note);
|
||||||
return newAlias;
|
return newAlias as Alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -97,10 +97,12 @@ export class NotesService {
|
||||||
const newNote = Note.create(owner, alias);
|
const newNote = Note.create(owner, alias);
|
||||||
//TODO: Calculate patch
|
//TODO: Calculate patch
|
||||||
newNote.revisions = Promise.resolve([
|
newNote.revisions = Promise.resolve([
|
||||||
Revision.create(noteContent, noteContent),
|
Revision.create(noteContent, noteContent, newNote as Note) as Revision,
|
||||||
]);
|
]);
|
||||||
if (owner) {
|
if (owner) {
|
||||||
newNote.historyEntries = [HistoryEntry.create(owner)];
|
newNote.historyEntries = [
|
||||||
|
HistoryEntry.create(owner, newNote as Note) as HistoryEntry,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return await this.noteRepository.save(newNote);
|
return await this.noteRepository.save(newNote);
|
||||||
|
@ -258,7 +260,7 @@ export class NotesService {
|
||||||
async updateNote(note: Note, noteContent: string): Promise<Note> {
|
async updateNote(note: Note, noteContent: string): Promise<Note> {
|
||||||
const revisions = await note.revisions;
|
const revisions = await note.revisions;
|
||||||
//TODO: Calculate patch
|
//TODO: Calculate patch
|
||||||
revisions.push(Revision.create(noteContent, noteContent));
|
revisions.push(Revision.create(noteContent, noteContent, note) as Revision);
|
||||||
note.revisions = Promise.resolve(revisions);
|
note.revisions = Promise.resolve(revisions);
|
||||||
note.userPermissions = [];
|
note.userPermissions = [];
|
||||||
note.groupPermissions = [];
|
note.groupPermissions = [];
|
||||||
|
@ -306,6 +308,7 @@ export class NotesService {
|
||||||
);
|
);
|
||||||
const createdPermission = NoteUserPermission.create(
|
const createdPermission = NoteUserPermission.create(
|
||||||
user,
|
user,
|
||||||
|
note,
|
||||||
newUserPermission.canEdit,
|
newUserPermission.canEdit,
|
||||||
);
|
);
|
||||||
createdPermission.note = note;
|
createdPermission.note = note;
|
||||||
|
@ -319,6 +322,7 @@ export class NotesService {
|
||||||
);
|
);
|
||||||
const createdPermission = NoteGroupPermission.create(
|
const createdPermission = NoteGroupPermission.create(
|
||||||
group,
|
group,
|
||||||
|
note,
|
||||||
newGroupPermission.canEdit,
|
newGroupPermission.canEdit,
|
||||||
);
|
);
|
||||||
createdPermission.note = note;
|
createdPermission.note = note;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue