public Mono<UpsertRelationshipResult> upsertOneSidedRelationship(
            @NotNull Long ownerId,
            @NotNull Long relatedUserId,
            @Nullable String name,
            @Nullable @PastOrPresent Date blockDate,
            @Nullable Integer newGroupIndex,
            @Nullable Integer deleteGroupIndex,
            @Nullable @PastOrPresent Date establishmentDate,
            boolean upsert,
            @Nullable ClientSession session) {
        try {
            Validator.notNull(ownerId, "ownerId");
            Validator.notNull(relatedUserId, "relatedUserId");
            Validator.pastOrPresent(blockDate, "blockDate");
            Validator.pastOrPresent(establishmentDate, "establishmentDate");
            Validator.notEquals(ownerId,
                    relatedUserId,
                    "The owner ID must not be equal to the related user ID");
        } catch (ResponseException e) {
            return Mono.error(e);
        }
        if (newGroupIndex != null && newGroupIndex.equals(deleteGroupIndex)) {
            return Mono.error(ResponseException.get(ResponseStatusCode.ILLEGAL_ARGUMENT,
                    "\"newGroupIndex\" and \"deleteGroupIndex\" must not be equal"));
        }
        // Notes:
        // 1. It is unnecessary to check whether the requester is in the blocklist of the related
        // user because only a one-sided relationship will be created here.
        // 2. Upsert the relationship first to ensure that the relationship exists before
        // "upsertRelationshipGroupMember".
        return upsertOneSidedRelationship(ownerId,
                relatedUserId,
                name,
                blockDate,
                establishmentDate,
                upsert,
                session)
                .flatMap(createdNewRelationship -> userRelationshipGroupService
                        .upsertRelationshipGroupMember(ownerId,
                                relatedUserId,
                                newGroupIndex,
                                deleteGroupIndex,
                                session)
                        .map(groupIndex -> new UpsertRelationshipResult(
                                createdNewRelationship,
                                groupIndex))
                        .defaultIfEmpty(createdNewRelationship
                                ? UpsertRelationshipResult.CREATED
                                : UpsertRelationshipResult.NOT_CREATED));
    }
@return true if the relationship existed and has been deleted;
        <p>
        false if the relationship does not exist, or still exists and has been deleted from a
        relationship group.
turms-service/src/main/java/im/turms/service/domain/user/service/UserRelationshipService.java