Skip to content

Commit 1a85d91

Browse files
committed
fix: add style and logging
1 parent c2709f7 commit 1a85d91

5 files changed

Lines changed: 43 additions & 35 deletions

File tree

‎api/pkg/entities/contact.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const EntityNameContact = "Contact"
1717
type ContactProperties map[string]string
1818

1919
// Value implements driver.Valuer, serializing the map to JSON bytes.
20-
func (p ContactProperties) Value() (driver.Value, error) {
20+
func (p *ContactProperties) Value() (driver.Value, error) {
2121
if p == nil {
2222
return []byte("{}"), nil
2323
}

‎api/pkg/handlers/heartbeat_handler.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (h *HeartbeatHandler) Index(c fiber.Ctx) error {
8585

8686
heartbeats, err := h.service.Index(ctx, h.userIDFomContext(c), request.Owner, request.ToIndexParams())
8787
if err != nil {
88-
ctxLogger.Error(stacktrace.Propagatef(err, "cannot get messgaes with params [%+#v]", request))
88+
ctxLogger.Error(stacktrace.Propagatef(err, "cannot get heartbeats with params [%+#v]", request))
8989
return h.responseInternalServerError(c)
9090
}
9191

‎api/pkg/services/contact_service.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,15 @@ func (service *ContactService) Get(ctx context.Context, userID entities.UserID,
147147

148148
// Index lists contacts for a user with the provided search/pagination params.
149149
func (service *ContactService) Index(ctx context.Context, userID entities.UserID, params repositories.IndexParams) (*[]entities.Contact, error) {
150-
ctx, span := service.tracer.Start(ctx)
150+
ctx, span, ctxLogger := service.tracer.StartWithLogger(ctx, service.logger)
151151
defer span.End()
152152

153153
contacts, err := service.repository.Index(ctx, userID, params)
154154
if err != nil {
155155
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "cannot index contacts for user [%s]", userID))
156156
}
157+
158+
ctxLogger.Info(fmt.Sprintf("fetched [%d] contacts with params [%+#v]", len(*contacts), params))
157159
return contacts, nil
158160
}
159161

@@ -252,6 +254,7 @@ func (service *ContactService) GetContactMap(ctx context.Context, userID entitie
252254
return result, nil
253255
}
254256

257+
ctxLogger.Info(fmt.Sprintf("fetching [%d] missing contacts by phone numbers for user [%s]", len(missing), userID))
255258
contacts, err := service.repository.FetchByPhoneNumbers(ctx, userID, missing)
256259
if err != nil {
257260
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "cannot fetch contacts by phone numbers for user [%s]", userID))

‎api/pkg/services/heartbeat_service.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (service *HeartbeatService) Index(ctx context.Context, userID entities.User
7878
return nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "could not fetch heartbeats with parms [%+#v]", params))
7979
}
8080

81-
ctxLogger.Info(fmt.Sprintf("fetched [%d] messages with prams [%+#v]", len(*heartbeats), params))
81+
ctxLogger.Info(fmt.Sprintf("fetched [%d] entities.Heartbeat with prams [%+#v]", len(*heartbeats), params))
8282
return heartbeats, nil
8383
}
8484

‎web/app/components/MessageThread.vue‎

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -143,37 +143,42 @@ function threadAvatarInitial(thread: EntitiesMessageThread): string {
143143
<span class="text-body-small text-medium-emphasis">
144144
{{ threadDate(thread.order_timestamp) }}
145145
</span>
146-
<div class="mt-1">
147-
<v-icon
148-
v-if="thread.status === 'expired'"
149-
color="warning"
150-
size="x-small"
151-
:icon="mdiAlert"
152-
/>
153-
<v-icon
154-
v-else-if="thread.status === 'delivered'"
155-
color="primary"
156-
size="x-small"
157-
:icon="mdiCheckAll"
158-
/>
159-
<v-icon
160-
v-else-if="thread.status === 'received'"
161-
color="success"
162-
size="x-small"
163-
:icon="mdiCheckAll"
164-
/>
165-
<v-icon
166-
v-else-if="thread.status === 'sent'"
167-
size="x-small"
168-
:icon="mdiCheck"
169-
/>
170-
<v-icon
171-
v-else-if="thread.status === 'failed'"
172-
color="error"
173-
size="x-small"
174-
:icon="mdiAlert"
175-
/>
176-
</div>
146+
<VTooltip location="bottom">
147+
<template #activator="{ props }">
148+
<div v-bind="props" class="mt-1">
149+
<v-icon
150+
v-if="thread.status === 'expired'"
151+
color="warning"
152+
size="x-small"
153+
:icon="mdiAlert"
154+
/>
155+
<v-icon
156+
v-else-if="thread.status === 'delivered'"
157+
color="primary"
158+
size="x-small"
159+
:icon="mdiCheckAll"
160+
/>
161+
<v-icon
162+
v-else-if="thread.status === 'received'"
163+
color="success"
164+
size="x-small"
165+
:icon="mdiCheckAll"
166+
/>
167+
<v-icon
168+
v-else-if="thread.status === 'sent'"
169+
size="x-small"
170+
:icon="mdiCheck"
171+
/>
172+
<v-icon
173+
v-else-if="thread.status === 'failed'"
174+
color="error"
175+
size="x-small"
176+
:icon="mdiAlert"
177+
/>
178+
</div>
179+
</template>
180+
<span>{{ thread.status }}</span>
181+
</VTooltip>
177182
</div>
178183
</template>
179184
</v-list-item>

0 commit comments

Comments
 (0)