Skip to content

Commit

Permalink
fixup! fix(dav): Make current ooo info time-dependent
Browse files Browse the repository at this point in the history
[ciskip]

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Dec 1, 2023
1 parent 169026c commit 75ceb72
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
13 changes: 4 additions & 9 deletions apps/dav/lib/Controller/OutOfOfficeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\User\IAvailabilityCoordinator;
use OCP\User\IOutOfOfficeData;

/**
* @psalm-import-type DAVOutOfOfficeData from ResponseDefinitions
* @psalm-import-type OutOfOfficeData from IOutOfOfficeData
*/
class OutOfOfficeController extends OCSController {

Expand All @@ -59,7 +61,7 @@ public function __construct(
* Get the currently configured out-of-office data of a user.
*
* @param string $userId The user id to get out-of-office data for.
* @return DataResponse<Http::STATUS_OK, DAVOutOfOfficeData, array{}>|DataResponse<Http::STATUS_NOT_FOUND, null, array{}>
* @return DataResponse<Http::STATUS_OK, OutOfOfficeData, array{}>|DataResponse<Http::STATUS_NOT_FOUND, null, array{}>
*
* 200: Out-of-office data
* 404: No out-of-office data was found
Expand All @@ -79,14 +81,7 @@ public function getCurrentOutOfOfficeData(string $userId): DataResponse {
return new DataResponse(null, Http::STATUS_NOT_FOUND);
}

return new DataResponse([
'id' => $data->getId(),
'userId' => $data->getUserId(),
'firstDay' => $data->getFirstDay(),
'lastDay' => $data->getLastDay(),
'status' => $data->getStatus(),
'message' => $data->getMessage(),
]);
return new DataResponse($data->jsonSerialize());
}

/**
Expand Down
18 changes: 10 additions & 8 deletions lib/public/User/IOutOfOfficeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
/**
* DTO to hold out-of-office information of a user
*
* @psalm-type OutOfOfficeData = array{
* id: int,
* userId: string,
* startDate: int,
* endDate: int,
* shortMessage: string,
* message: string,
* }
*
* @since 28.0.0
*/
interface IOutOfOfficeData extends JsonSerializable {
Expand Down Expand Up @@ -77,14 +86,7 @@ public function getShortMessage(): string;
public function getMessage(): string;

/**
* @return array {
* id: int,
* userId: string,
* startDate: int,
* endDate: int,
* shortMessage: string,
* message: string,
* }
* @return OutOfOfficeData
*
* @since 28.0.0
*/
Expand Down

0 comments on commit 75ceb72

Please sign in to comment.