Skip to content

Commit

Permalink
Merge branch 'release/0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Pröschel committed Feb 23, 2021
2 parents a59dd07 + a935e91 commit 48571e1
Show file tree
Hide file tree
Showing 270 changed files with 4,802 additions and 2,701 deletions.
40 changes: 33 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,30 +1,56 @@
{
"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["react", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": [
"react",
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},

"env": {
"browser": true,
"es2021": true,
"node": true
},

"rules": {
"camelcase": [
"warn",
{
"properties": "never"
}
],
"react/prop-types": 0,
"@typescript-eslint/no-unused-vars": ["error", {"varsIgnorePattern": "_"}],
"@typescript-eslint/no-unused-vars": [
"error",
{
"ignoreRestSiblings": true,
"varsIgnorePattern": "_"
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/ban-types": ["error", {"extendDefaults": true, "types": {"{}": false, "Object": false}}]
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true,
"types": {
"{}": false,
"Object": false
}
}
]
},
"settings": {
"react": {
"version": "16.12"
}
}
}
}
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ exports_files(
],
)

# gazelle:ignore
# gazelle:proto disable_global
# gazelle:build_file_name BUILD
# gazelle:prefix
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.0
0.10.0
13 changes: 2 additions & 11 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

# Airy Bazel tools

git_repository(
name = "com_github_airyhq_bazel_tools",
commit = "5f3c835f4320292e76ad1b23308ea3704a35bd64",
commit = "701e4bd1503efe7308bf057ce031a165346b4580",
remote = "https://github.com/airyhq/bazel-tools.git",
shallow_since = "1612440527 +0100",
shallow_since = "1614011000 +0100",
)

load("@com_github_airyhq_bazel_tools//:repositories.bzl", "airy_bazel_tools_dependencies", "airy_jvm_deps")
Expand Down Expand Up @@ -212,14 +211,6 @@ yarn_install(
yarn_lock = "//:yarn.lock",
)

load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")

install_bazel_dependencies()

load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")

ts_setup_workspace()

### Bazel tooling

git_repository(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ ResponseEntity<?> updateChannel(@RequestBody @Valid UpdateChannelRequestPayload
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new EmptyResponsePayload());
}

container.getMetadataMap();
final MetadataMap metadataMap = container.getMetadataMap();
if (requestPayload.getName() != null) {
container.getMetadataMap().put(MetadataKeys.ChannelKeys.NAME, newChannelMetadata(channelId, MetadataKeys.ChannelKeys.NAME, requestPayload.getName()));
metadataMap.put(MetadataKeys.ChannelKeys.NAME, newChannelMetadata(channelId, MetadataKeys.ChannelKeys.NAME, requestPayload.getName()));
}
if (requestPayload.getImageUrl() != null) {
container.getMetadataMap().put(MetadataKeys.ChannelKeys.IMAGE_URL, newChannelMetadata(channelId, MetadataKeys.ChannelKeys.IMAGE_URL, requestPayload.getName()));
metadataMap.put(MetadataKeys.ChannelKeys.IMAGE_URL, newChannelMetadata(channelId, MetadataKeys.ChannelKeys.IMAGE_URL, requestPayload.getName()));
}

try {
stores.storeMetadataMap(container.getMetadataMap());
stores.storeMetadataMap(metadataMap);
return ResponseEntity.ok(fromChannelContainer(container));
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import static java.util.stream.Collectors.toList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import co.airy.avro.communication.Message;
import co.airy.avro.communication.Metadata;
import co.airy.avro.communication.ReadReceipt;
import co.airy.avro.communication.SenderType;
import co.airy.core.api.communication.dto.Conversation;
import co.airy.core.api.communication.dto.CountAction;
import co.airy.core.api.communication.dto.MessagesTreeSet;
Expand Down Expand Up @@ -50,6 +49,7 @@
import java.util.Optional;
import java.util.concurrent.ExecutionException;

import static co.airy.model.message.MessageRepository.isFromContact;
import static co.airy.model.metadata.MetadataRepository.getId;
import static co.airy.model.metadata.MetadataRepository.getSubject;
import static co.airy.model.metadata.MetadataRepository.isChannelMetadata;
Expand All @@ -61,11 +61,10 @@
@Component
@RestController
public class Stores implements HealthIndicator, ApplicationListener<ApplicationStartedEvent>, DisposableBean {
private static final String appId = "api.CommunicationStoresTEST";
private static final String appId = "api.CommunicationStores";

private final KafkaStreamsWrapper streams;
private final KafkaProducer<String, SpecificRecordBase> producer;
private final WebSocketController webSocketController;
private final LuceneProvider luceneProvider;

private final String messagesStore = "messages-store";
Expand All @@ -77,12 +76,10 @@ public class Stores implements HealthIndicator, ApplicationListener<ApplicationS

Stores(KafkaStreamsWrapper streams,
KafkaProducer<String, SpecificRecordBase> producer,
WebSocketController webSocketController,
LuceneProvider luceneProvider
) {
this.streams = streams;
this.producer = producer;
this.webSocketController = webSocketController;
this.luceneProvider = luceneProvider;
}

Expand All @@ -93,9 +90,7 @@ private void startStream() {

final KStream<String, Message> messageStream = builder.stream(new ApplicationCommunicationMessages().name());

final KTable<String, Channel> channelTable = builder.<String, Channel>stream(new ApplicationCommunicationChannels().name())
.peek((channelId, channel) -> webSocketController.onChannelUpdate(channel))
.toTable();
final KTable<String, Channel> channelTable = builder.<String, Channel>table(new ApplicationCommunicationChannels().name());

// conversation/message/channel metadata keyed by conversation/message/channel id
final KTable<String, MetadataMap> metadataTable = builder.<String, Metadata>table(applicationCommunicationMetadata)
Expand All @@ -109,7 +104,7 @@ private void startStream() {

// produce unread count metadata
messageStream.selectKey((messageId, message) -> message.getConversationId())
.peek((conversationId, message) -> webSocketController.onNewMessage(message))
.filter((conversationId, message) -> isFromContact(message))
.mapValues(message -> CountAction.increment(message.getSentAt()))
.merge(resetStream)
.groupByKey()
Expand All @@ -124,7 +119,7 @@ private void startStream() {
}

return unreadCountState;
}).toStream().peek(webSocketController::onUnreadCount)
}).toStream()
.map((conversationId, unreadCountState) -> {
final Metadata metadata = newConversationMetadata(conversationId, MetadataKeys.ConversationKeys.UNREAD_COUNT,
unreadCountState.getUnreadCount().toString());
Expand Down Expand Up @@ -165,7 +160,7 @@ private void startStream() {
aggregate.setLastMessageContainer(container);
}

if (SenderType.SOURCE_CONTACT.equals(container.getMessage().getSenderType())) {
if (isFromContact(container.getMessage())) {
aggregate.setSourceConversationId(container.getMessage().getSenderId());
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import lombok.NoArgsConstructor;

import static co.airy.date.format.DateFormat.isoFromMillis;
import static co.airy.model.metadata.MetadataKeys.*;
import static co.airy.model.metadata.MetadataKeys.ConversationKeys;
import static co.airy.model.metadata.MetadataObjectMapper.getMetadataPayload;

@Data
Expand Down
Loading

0 comments on commit 48571e1

Please sign in to comment.