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:
David Mehren 2021-08-29 21:19:53 +02:00
parent f667410b51
commit 99db4bc336
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
6 changed files with 16 additions and 16 deletions

View file

@ -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,
);

View file

@ -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> {