Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

fix: add style and logging

Acho Arnold Ewin1a85d912cd57
diff --git a/api/pkg/entities/contact.go b/api/pkg/entities/contact.go
index 71723bf1..d2733218 100644
--- a/api/pkg/entities/contact.go
+++ b/api/pkg/entities/contact.go
@@ -17,7 +17,7 @@ const EntityNameContact = "Contact"
type ContactProperties map[string]string
// Value implements driver.Valuer, serializing the map to JSON bytes.
-func (p ContactProperties) Value() (driver.Value, error) {
+func (p *ContactProperties) Value() (driver.Value, error) {
if p == nil {
return []byte("{}"), nil
}
diff --git a/api/pkg/handlers/heartbeat_handler.go b/api/pkg/handlers/heartbeat_handler.go
index 660bdeed..20554b04 100644
--- a/api/pkg/handlers/heartbeat_handler.go
+++ b/api/pkg/handlers/heartbeat_handler.go
@@ -85,7 +85,7 @@ func (h *HeartbeatHandler) Index(c fiber.Ctx) error {
heartbeats, err := h.service.Index(ctx, h.userIDFomContext(c), request.Owner, request.ToIndexParams())
if err != nil {
- ctxLogger.Error(stacktrace.Propagatef(err, "cannot get messgaes with params [%+#v]", request))
+ ctxLogger.Error(stacktrace.Propagatef(err, "cannot get heartbeats with params [%+#v]", request))
return h.responseInternalServerError(c)
}
diff --git a/api/pkg/services/contact_service.go b/api/pkg/services/contact_service.go
index de6fa40f..fd7df59e 100644
--- a/api/pkg/services/contact_service.go
+++ b/api/pkg/services/contact_service.go
@@ -147,13 +147,15 @@ func (service *ContactService) Get(ctx context.Context, userID entities.UserID,
// Index lists contacts for a user with the provided search/pagination params.
func (service *ContactService) Index(ctx context.Context, userID entities.UserID, params repositories.IndexParams) (*[]entities.Contact, error) {
- ctx, span := service.tracer.Start(ctx)
+ ctx, span, ctxLogger := service.tracer.StartWithLogger(ctx, service.logger)
defer span.End()
contacts, err := service.repository.Index(ctx, userID, params)
if err != nil {
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "cannot index contacts for user [%s]", userID))
}
+
+ ctxLogger.Info(fmt.Sprintf("fetched [%d] contacts with params [%+#v]", len(*contacts), params))
return contacts, nil
}
@@ -252,6 +254,7 @@ func (service *ContactService) GetContactMap(ctx context.Context, userID entitie
return result, nil
}
+ ctxLogger.Info(fmt.Sprintf("fetching [%d] missing contacts by phone numbers for user [%s]", len(missing), userID))
contacts, err := service.repository.FetchByPhoneNumbers(ctx, userID, missing)
if err != nil {
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "cannot fetch contacts by phone numbers for user [%s]", userID))
diff --git a/api/pkg/services/heartbeat_service.go b/api/pkg/services/heartbeat_service.go
index 7441d2aa..d6c44234 100644
--- a/api/pkg/services/heartbeat_service.go
+++ b/api/pkg/services/heartbeat_service.go
@@ -78,7 +78,7 @@ func (service *HeartbeatService) Index(ctx context.Context, userID entities.User
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "could not fetch heartbeats with parms [%+#v]", params))
}
- ctxLogger.Info(fmt.Sprintf("fetched [%d] messages with prams [%+#v]", len(*heartbeats), params))
+ ctxLogger.Info(fmt.Sprintf("fetched [%d] entities.Heartbeat with prams [%+#v]", len(*heartbeats), params))
return heartbeats, nil
}
diff --git a/web/app/components/MessageThread.vue b/web/app/components/MessageThread.vue
index d62eeb09..51de93fc 100644
--- a/web/app/components/MessageThread.vue
+++ b/web/app/components/MessageThread.vue
@@ -143,37 +143,42 @@ function threadAvatarInitial(thread: EntitiesMessageThread): string {
<span class="text-body-small text-medium-emphasis">
{{ threadDate(thread.order_timestamp) }}
</span>
- <div class="mt-1">
- <v-icon
- v-if="thread.status === 'expired'"
- color="warning"
- size="x-small"
- :icon="mdiAlert"
- />
- <v-icon
- v-else-if="thread.status === 'delivered'"
- color="primary"
- size="x-small"
- :icon="mdiCheckAll"
- />
- <v-icon
- v-else-if="thread.status === 'received'"
- color="success"
- size="x-small"
- :icon="mdiCheckAll"
- />
- <v-icon
- v-else-if="thread.status === 'sent'"
- size="x-small"
- :icon="mdiCheck"
- />
- <v-icon
- v-else-if="thread.status === 'failed'"
- color="error"
- size="x-small"
- :icon="mdiAlert"
- />
- </div>
+ <VTooltip location="bottom">
+ <template #activator="{ props }">
+ <div v-bind="props" class="mt-1">
+ <v-icon
+ v-if="thread.status === 'expired'"
+ color="warning"
+ size="x-small"
+ :icon="mdiAlert"
+ />
+ <v-icon
+ v-else-if="thread.status === 'delivered'"
+ color="primary"
+ size="x-small"
+ :icon="mdiCheckAll"
+ />
+ <v-icon
+ v-else-if="thread.status === 'received'"
+ color="success"
+ size="x-small"
+ :icon="mdiCheckAll"
+ />
+ <v-icon
+ v-else-if="thread.status === 'sent'"
+ size="x-small"
+ :icon="mdiCheck"
+ />
+ <v-icon
+ v-else-if="thread.status === 'failed'"
+ color="error"
+ size="x-small"
+ :icon="mdiAlert"
+ />
+ </div>
+ </template>
+ <span>{{ thread.status }}</span>
+ </VTooltip>
</div>
</template>
</v-list-item>