implement create avatar + delete avatar + add jsdocs
This commit is contained in:
@@ -36,6 +36,12 @@ export class UmbUserServerDataSource implements UmbUserDetailDataSource {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user with the given id
|
||||
* @param {string} id
|
||||
* @return {*}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
async get(id: string) {
|
||||
if (!id) throw new Error('Id is missing');
|
||||
const response = await tryExecuteAndNotify(this.#host, UserResource.getUserById({ id }));
|
||||
@@ -44,10 +50,23 @@ export class UmbUserServerDataSource implements UmbUserDetailDataSource {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new user
|
||||
* @param {CreateUserRequestModel} data
|
||||
* @return {*}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
insert(data: CreateUserRequestModel) {
|
||||
return tryExecuteAndNotify(this.#host, UserResource.postUser({ requestBody: data }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the user with the given id
|
||||
* @param {string} id
|
||||
* @param {UpdateUserRequestModel} data
|
||||
* @return {*}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
update(id: string, data: UpdateUserRequestModel) {
|
||||
if (!id) throw new Error('Id is missing');
|
||||
|
||||
@@ -60,16 +79,35 @@ export class UmbUserServerDataSource implements UmbUserDetailDataSource {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the user with the given id
|
||||
* @param {string} id
|
||||
* @return {*}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
delete(id: string) {
|
||||
if (!id) throw new Error('Id is missing');
|
||||
return tryExecuteAndNotify(this.#host, UserResource.deleteUserById({ id }));
|
||||
}
|
||||
|
||||
uploadAvatar(id: string, file: File): Promise<UmbDataSourceErrorResponse> {
|
||||
throw new Error('Method not implemented.');
|
||||
/**
|
||||
* Creates an avatar for the user with the given id based on a temporary uploaded file
|
||||
* @param {string} id
|
||||
* @param {string} fileId
|
||||
* @return {*} {Promise<UmbDataSourceErrorResponse>}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
createAvatar(id: string, fileId: string): Promise<UmbDataSourceErrorResponse> {
|
||||
return tryExecuteAndNotify(this.#host, UserResource.postUserAvatarById({ id, requestBody: { fileId } }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the avatar for the user with the given id
|
||||
* @param {string} id
|
||||
* @return {*} {Promise<UmbDataSourceErrorResponse>}
|
||||
* @memberof UmbUserServerDataSource
|
||||
*/
|
||||
deleteAvatar(id: string): Promise<UmbDataSourceErrorResponse> {
|
||||
throw new Error('Method not implemented.');
|
||||
return tryExecuteAndNotify(this.#host, UserResource.deleteUserAvatarById({ id }));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user