public Mono<GroupInvitationsWithVersion> queryUserGroupInvitationsWithVersion(
            @NotNull Long userId,
            boolean areSentByUser,
            @Nullable Date lastUpdatedDate) {
        try {
            Validator.notNull(userId, "userId");
        } catch (ResponseException e) {
            return Mono.error(e);
        }
        Mono<Date> versionMono = areSentByUser
                ? userVersionService.querySentGroupInvitationsLastUpdatedDate(userId)
                : userVersionService.queryReceivedGroupInvitationsLastUpdatedDate(userId);
        return versionMono.flatMap(version -> {
            if (DateTimeUtil.isAfterOrSame(lastUpdatedDate, version)) {
                return ResponseExceptionPublisherPool.alreadyUpToUpdate();
            }
            Flux<GroupInvitation> invitationFlux = areSentByUser
                    ? queryGroupInvitationsByInviterId(userId)
                    : queryGroupInvitationsByInviteeId(userId);
            return invitationFlux.collect(CollectorUtil.toChunkedList())
                    .map(groupInvitations -> {
                        if (groupInvitations.isEmpty()) {
                            throw ResponseException.get(ResponseStatusCode.NO_CONTENT);
                        }
                        GroupInvitationsWithVersion.Builder builder =
                                ClientMessagePool.getGroupInvitationsWithVersionBuilder();
                        int expireAfterSeconds =
                                groupInvitationRepository.getEntityExpireAfterSeconds();
                        for (GroupInvitation groupInvitation : groupInvitations) {
                            builder.addGroupInvitations(ProtoModelConvertor
                                    .groupInvitation2proto(groupInvitation, expireAfterSeconds));
                        }
                        return builder.setLastUpdatedDate(version.getTime())
                                .build();
                    });
        })
                .switchIfEmpty(ResponseExceptionPublisherPool.alreadyUpToUpdate());
    }
@return group ID, invitee ID, and status
turms-service/src/main/java/im/turms/service/domain/group/service/GroupInvitationService.java