mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-03 00:19:57 -04:00
UserService: Improve method naming
This renames `createOrUpdateHistoryEntry` to `updateHistoryEntryTimestamp`, which reduces confusion with the similarly named `updateHistoryEntry` function. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
f667410b51
commit
99db4bc336
6 changed files with 16 additions and 16 deletions
|
@ -159,7 +159,7 @@ describe('HistoryService', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('createOrUpdateHistoryEntry', () => {
|
||||
describe('updateHistoryEntryTimestamp', () => {
|
||||
describe('works', () => {
|
||||
const user = {} as User;
|
||||
const alias = 'alias';
|
||||
|
@ -171,7 +171,7 @@ describe('HistoryService', () => {
|
|||
.mockImplementation(
|
||||
async (entry: HistoryEntry): Promise<HistoryEntry> => entry,
|
||||
);
|
||||
const createHistoryEntry = await service.createOrUpdateHistoryEntry(
|
||||
const createHistoryEntry = await service.updateHistoryEntryTimestamp(
|
||||
Note.create(user, alias),
|
||||
user,
|
||||
);
|
||||
|
@ -188,7 +188,7 @@ describe('HistoryService', () => {
|
|||
.mockImplementation(
|
||||
async (entry: HistoryEntry): Promise<HistoryEntry> => entry,
|
||||
);
|
||||
const createHistoryEntry = await service.createOrUpdateHistoryEntry(
|
||||
const createHistoryEntry = await service.updateHistoryEntryTimestamp(
|
||||
Note.create(user, alias),
|
||||
user,
|
||||
);
|
||||
|
|
|
@ -86,12 +86,13 @@ export class HistoryService {
|
|||
|
||||
/**
|
||||
* @async
|
||||
* Create or update a history entry by the user and note. If the entry is merely updated the updatedAt date is set to the current date.
|
||||
* Updates the updatedAt timestamp of a HistoryEntry.
|
||||
* If no history entry exists, it will be created.
|
||||
* @param {Note} note - the note that the history entry belongs to
|
||||
* @param {User} user - the user that the history entry belongs to
|
||||
* @return {HistoryEntry} the requested history entry
|
||||
*/
|
||||
async createOrUpdateHistoryEntry(
|
||||
async updateHistoryEntryTimestamp(
|
||||
note: Note,
|
||||
user: User,
|
||||
): Promise<HistoryEntry> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue