• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DigitalTolk / ex / 24964496916

26 Apr 2026 06:58PM UTC coverage: 90.069% (-0.3%) from 90.372%
24964496916

push

github

web-flow
Docker fixes (#13)

* Docker fixes

* test

1506 of 1799 branches covered (83.71%)

Branch coverage included in aggregate %.

955 of 1086 new or added lines in 34 files covered. (87.94%)

7935 of 8683 relevant lines covered (91.39%)

18.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.18
/internal/handler/store_adapters.go
1
package handler
2

3
import (
4
        "context"
5

6
        "github.com/DigitalTolk/ex/internal/model"
7
        "github.com/DigitalTolk/ex/internal/store"
8
)
9

10
// UserStoreAdapter wraps store.UserStoreImpl to satisfy service.UserStore.
11
type UserStoreAdapter struct {
12
        s *store.UserStoreImpl
13
}
14

15
func NewUserStoreAdapter(s *store.UserStoreImpl) *UserStoreAdapter {
1✔
16
        return &UserStoreAdapter{s: s}
1✔
17
}
1✔
18

19
func (a *UserStoreAdapter) CreateUser(ctx context.Context, user *model.User) error {
1✔
20
        return a.s.Create(ctx, user)
1✔
21
}
1✔
22
func (a *UserStoreAdapter) GetUser(ctx context.Context, id string) (*model.User, error) {
1✔
23
        return a.s.GetByID(ctx, id)
1✔
24
}
1✔
25
func (a *UserStoreAdapter) GetUserByEmail(ctx context.Context, email string) (*model.User, error) {
1✔
26
        return a.s.GetByEmail(ctx, email)
1✔
27
}
1✔
28
func (a *UserStoreAdapter) UpdateUser(ctx context.Context, user *model.User) error {
1✔
29
        return a.s.Update(ctx, user)
1✔
30
}
1✔
31
func (a *UserStoreAdapter) ListUsers(ctx context.Context, limit int, cursor string) ([]*model.User, string, error) {
1✔
32
        return a.s.List(ctx, limit, cursor)
1✔
33
}
1✔
34
func (a *UserStoreAdapter) HasUsers(ctx context.Context) (bool, error) {
1✔
35
        return a.s.HasUsers(ctx)
1✔
36
}
1✔
37

38
// ChannelStoreAdapter wraps store.ChannelStoreImpl to satisfy service.ChannelStore.
39
type ChannelStoreAdapter struct {
40
        s *store.ChannelStoreImpl
41
}
42

43
func NewChannelStoreAdapter(s *store.ChannelStoreImpl) *ChannelStoreAdapter {
1✔
44
        return &ChannelStoreAdapter{s: s}
1✔
45
}
1✔
46

47
func (a *ChannelStoreAdapter) CreateChannel(ctx context.Context, ch *model.Channel) error {
1✔
48
        return a.s.Create(ctx, ch)
1✔
49
}
1✔
50
func (a *ChannelStoreAdapter) GetChannel(ctx context.Context, id string) (*model.Channel, error) {
1✔
51
        return a.s.GetByID(ctx, id)
1✔
52
}
1✔
53
func (a *ChannelStoreAdapter) GetChannelBySlug(ctx context.Context, slug string) (*model.Channel, error) {
1✔
54
        return a.s.GetBySlug(ctx, slug)
1✔
55
}
1✔
56
func (a *ChannelStoreAdapter) UpdateChannel(ctx context.Context, ch *model.Channel) error {
1✔
57
        return a.s.Update(ctx, ch)
1✔
58
}
1✔
59
func (a *ChannelStoreAdapter) ListPublicChannels(ctx context.Context, limit int, cursor string) ([]*model.Channel, string, error) {
1✔
60
        return a.s.ListPublic(ctx, limit, cursor)
1✔
61
}
1✔
62

63
// MembershipStoreAdapter wraps store.MembershipStoreImpl to satisfy service.MembershipStore.
64
type MembershipStoreAdapter struct {
65
        s *store.MembershipStoreImpl
66
}
67

68
func NewMembershipStoreAdapter(s *store.MembershipStoreImpl) *MembershipStoreAdapter {
1✔
69
        return &MembershipStoreAdapter{s: s}
1✔
70
}
1✔
71

72
func (a *MembershipStoreAdapter) AddMember(ctx context.Context, membership *model.ChannelMembership, userChannel *model.UserChannel) error {
1✔
73
        // The store's AddChannelMember requires a *model.Channel, but the service
1✔
74
        // interface does not pass one. We construct a minimal Channel with just the
1✔
75
        // ID so the store can build DynamoDB keys.
1✔
76
        ch := &model.Channel{ID: membership.ChannelID}
1✔
77
        return a.s.AddChannelMember(ctx, ch, membership, userChannel)
1✔
78
}
1✔
79
func (a *MembershipStoreAdapter) RemoveMember(ctx context.Context, channelID, userID string) error {
1✔
80
        return a.s.RemoveChannelMember(ctx, channelID, userID)
1✔
81
}
1✔
82
func (a *MembershipStoreAdapter) GetMembership(ctx context.Context, channelID, userID string) (*model.ChannelMembership, error) {
1✔
83
        return a.s.GetChannelMembership(ctx, channelID, userID)
1✔
84
}
1✔
85
func (a *MembershipStoreAdapter) UpdateMemberRole(ctx context.Context, channelID, userID string, role model.ChannelRole) error {
1✔
86
        return a.s.UpdateChannelRole(ctx, channelID, userID, role)
1✔
87
}
1✔
88
func (a *MembershipStoreAdapter) ListMembers(ctx context.Context, channelID string) ([]*model.ChannelMembership, error) {
1✔
89
        return a.s.ListChannelMembers(ctx, channelID)
1✔
90
}
1✔
91
func (a *MembershipStoreAdapter) ListUserChannels(ctx context.Context, userID string) ([]*model.UserChannel, error) {
1✔
92
        return a.s.ListUserChannels(ctx, userID)
1✔
93
}
1✔
94
func (a *MembershipStoreAdapter) SetMute(ctx context.Context, channelID, userID string, muted bool) error {
1✔
95
        return a.s.SetUserChannelMute(ctx, channelID, userID, muted)
1✔
96
}
1✔
NEW
97
func (a *MembershipStoreAdapter) SetFavorite(ctx context.Context, channelID, userID string, favorite bool) error {
×
NEW
98
        return a.s.SetUserChannelFavorite(ctx, channelID, userID, favorite)
×
NEW
99
}
×
NEW
100
func (a *MembershipStoreAdapter) SetCategory(ctx context.Context, channelID, userID, categoryID string) error {
×
NEW
101
        return a.s.SetUserChannelCategory(ctx, channelID, userID, categoryID)
×
NEW
102
}
×
103

104
// ConversationStoreAdapter wraps store.ConversationStoreImpl to satisfy service.ConversationStore.
105
type ConversationStoreAdapter struct {
106
        s *store.ConversationStoreImpl
107
}
108

109
func NewConversationStoreAdapter(s *store.ConversationStoreImpl) *ConversationStoreAdapter {
1✔
110
        return &ConversationStoreAdapter{s: s}
1✔
111
}
1✔
112

113
func (a *ConversationStoreAdapter) CreateConversation(ctx context.Context, conv *model.Conversation, userConvs []*model.UserConversation) error {
1✔
114
        return a.s.Create(ctx, conv, userConvs)
1✔
115
}
1✔
116
func (a *ConversationStoreAdapter) GetConversation(ctx context.Context, id string) (*model.Conversation, error) {
1✔
117
        return a.s.GetByID(ctx, id)
1✔
118
}
1✔
119
func (a *ConversationStoreAdapter) ListUserConversations(ctx context.Context, userID string) ([]*model.UserConversation, error) {
1✔
120
        return a.s.ListUserConversations(ctx, userID)
1✔
121
}
1✔
122
func (a *ConversationStoreAdapter) ActivateConversation(ctx context.Context, convID string, participantIDs []string) error {
1✔
123
        return a.s.Activate(ctx, convID, participantIDs)
1✔
124
}
1✔
NEW
125
func (a *ConversationStoreAdapter) SetFavorite(ctx context.Context, convID, userID string, favorite bool) error {
×
NEW
126
        return a.s.SetUserConversationFavorite(ctx, convID, userID, favorite)
×
NEW
127
}
×
NEW
128
func (a *ConversationStoreAdapter) SetCategory(ctx context.Context, convID, userID, categoryID string) error {
×
NEW
129
        return a.s.SetUserConversationCategory(ctx, convID, userID, categoryID)
×
NEW
130
}
×
131

132
// MessageStoreAdapter wraps store.MessageStoreImpl to satisfy service.MessageStore.
133
type MessageStoreAdapter struct {
134
        s *store.MessageStoreImpl
135
}
136

137
func NewMessageStoreAdapter(s *store.MessageStoreImpl) *MessageStoreAdapter {
1✔
138
        return &MessageStoreAdapter{s: s}
1✔
139
}
1✔
140

141
func (a *MessageStoreAdapter) CreateMessage(ctx context.Context, msg *model.Message) error {
1✔
142
        return a.s.Create(ctx, msg)
1✔
143
}
1✔
144
func (a *MessageStoreAdapter) GetMessage(ctx context.Context, parentID, msgID string) (*model.Message, error) {
1✔
145
        return a.s.GetByID(ctx, parentID, msgID)
1✔
146
}
1✔
147
func (a *MessageStoreAdapter) UpdateMessage(ctx context.Context, msg *model.Message) error {
1✔
148
        return a.s.Update(ctx, msg.ParentID, msg)
1✔
149
}
1✔
150
func (a *MessageStoreAdapter) DeleteMessage(ctx context.Context, parentID, msgID string) error {
1✔
151
        return a.s.Delete(ctx, parentID, msgID)
1✔
152
}
1✔
153
func (a *MessageStoreAdapter) ListMessages(ctx context.Context, parentID string, before string, limit int) ([]*model.Message, bool, error) {
1✔
154
        return a.s.List(ctx, parentID, before, limit)
1✔
155
}
1✔
156

157
// InviteStoreAdapter wraps store.InviteStoreImpl to satisfy service.InviteStore.
158
type InviteStoreAdapter struct {
159
        s *store.InviteStoreImpl
160
}
161

162
func NewInviteStoreAdapter(s *store.InviteStoreImpl) *InviteStoreAdapter {
1✔
163
        return &InviteStoreAdapter{s: s}
1✔
164
}
1✔
165

166
func (a *InviteStoreAdapter) CreateInvite(ctx context.Context, inv *model.Invite) error {
1✔
167
        return a.s.Create(ctx, inv)
1✔
168
}
1✔
169
func (a *InviteStoreAdapter) GetInvite(ctx context.Context, token string) (*model.Invite, error) {
1✔
170
        return a.s.GetByToken(ctx, token)
1✔
171
}
1✔
172
func (a *InviteStoreAdapter) DeleteInvite(ctx context.Context, token string) error {
1✔
173
        return a.s.Delete(ctx, token)
1✔
174
}
1✔
175

176
// TokenStoreAdapter wraps store.TokenStoreImpl to satisfy service.TokenStore.
177
type TokenStoreAdapter struct {
178
        s *store.TokenStoreImpl
179
}
180

181
func NewTokenStoreAdapter(s *store.TokenStoreImpl) *TokenStoreAdapter {
1✔
182
        return &TokenStoreAdapter{s: s}
1✔
183
}
1✔
184

185
func (a *TokenStoreAdapter) StoreRefreshToken(ctx context.Context, rt *model.RefreshToken) error {
1✔
186
        return a.s.Create(ctx, rt)
1✔
187
}
1✔
188
func (a *TokenStoreAdapter) GetRefreshToken(ctx context.Context, tokenHash string) (*model.RefreshToken, error) {
1✔
189
        return a.s.GetByHash(ctx, tokenHash)
1✔
190
}
1✔
191
func (a *TokenStoreAdapter) DeleteRefreshToken(ctx context.Context, tokenHash string) error {
1✔
192
        return a.s.Delete(ctx, tokenHash)
1✔
193
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc