Skip to content

Commit

Permalink
Merge branch 'main' into feat/list-user-segment
Browse files Browse the repository at this point in the history
  • Loading branch information
hvn2k1 committed Jan 8, 2025
2 parents 9f679fe + 3fe31b4 commit 905edf8
Show file tree
Hide file tree
Showing 36 changed files with 880 additions and 699 deletions.
6 changes: 6 additions & 0 deletions api-description/apidocs.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,8 @@ paths:
- NAME
- CREATED_AT
- UPDATED_AT
- ENVIRONMENT
- STATE
default: DEFAULT
- name: orderDirection
in: query
Expand Down Expand Up @@ -2411,6 +2413,8 @@ definitions:
- NAME
- CREATED_AT
- UPDATED_AT
- ENVIRONMENT
- STATE
default: DEFAULT
pushListPushesRequestOrderDirection:
type: string
Expand Down Expand Up @@ -2443,6 +2447,8 @@ definitions:
type: boolean
environmentId:
type: string
environmentName:
type: string
userUser:
type: object
properties:
Expand Down
12 changes: 12 additions & 0 deletions api-description/web-api.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3249,6 +3249,8 @@ paths:
- NAME
- CREATED_AT
- UPDATED_AT
- ENVIRONMENT
- STATE
default: DEFAULT
- name: orderDirection
in: query
Expand Down Expand Up @@ -3741,6 +3743,8 @@ paths:
- NAME
- CREATED_AT
- UPDATED_AT
- ENVIRONMENT
- STATE
default: DEFAULT
- name: orderDirection
in: query
Expand Down Expand Up @@ -6159,6 +6163,8 @@ definitions:
- NAME
- CREATED_AT
- UPDATED_AT
- ENVIRONMENT
- STATE
default: DEFAULT
notificationListSubscriptionsRequestOrderDirection:
type: string
Expand Down Expand Up @@ -6229,6 +6235,8 @@ definitions:
$ref: '#/definitions/notificationRecipient'
name:
type: string
environmentId:
type: string
environmentName:
type: string
notificationUpdateAdminSubscriptionResponse:
Expand Down Expand Up @@ -6450,6 +6458,8 @@ definitions:
- NAME
- CREATED_AT
- UPDATED_AT
- ENVIRONMENT
- STATE
default: DEFAULT
pushListPushesRequestOrderDirection:
type: string
Expand Down Expand Up @@ -6495,6 +6505,8 @@ definitions:
type: boolean
environmentId:
type: string
environmentName:
type: string
pushRenamePushCommand:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion manifests/bucketeer/charts/api/values.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions manifests/bucketeer/charts/web/values.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/feature/api/segment_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ func (s *FeatureService) bulkUploadSegmentUsersNoCommand(
segment.Segment,
prev,
)
if err != nil {
return err
}
err = s.domainPublisher.Publish(ctx, e)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions pkg/notification/api/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,10 @@ func (s *NotificationService) newSubscriptionListOrders(
column = "sub.created_at"
case notificationproto.ListSubscriptionsRequest_UPDATED_AT:
column = "sub.updated_at"
case notificationproto.ListSubscriptionsRequest_ENVIRONMENT:
column = "env.name"
case notificationproto.ListSubscriptionsRequest_STATE:
column = "sub.disabled"
default:
dt, err := statusInvalidOrderBy.WithDetails(&errdetails.LocalizedMessage{
Locale: localizer.GetLocale(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ SELECT
sub.source_types,
sub.recipient,
sub.name,
sub.environment_id,
env.name as environment_name
FROM
subscription sub
JOIN environment_v2 env
ON sub.environment_id = env.id
JOIN
environment_v2 env ON sub.environment_id = env.id
WHERE
sub.id = ? AND
sub.environment_id = ?
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ SELECT
sub.source_types,
sub.recipient,
sub.name,
sub.environment_id,
env.name as environment_name
FROM
subscription sub
JOIN environment_v2 env
ON sub.environment_id = env.id
JOIN
environment_v2 env ON sub.environment_id = env.id
%s %s %s
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ SELECT
COUNT(1)
FROM
subscription sub
JOIN environment_v2 env
ON sub.environment_id = env.id
JOIN
environment_v2 env ON sub.environment_id = env.id
%s
2 changes: 2 additions & 0 deletions pkg/notification/storage/v2/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (s *subscriptionStorage) GetSubscription(
&mysql.JSONObject{Val: &subscription.SourceTypes},
&mysql.JSONObject{Val: &subscription.Recipient},
&subscription.Name,
&subscription.EnvironmentId,
&subscription.EnvironmentName,
)
if err != nil {
Expand Down Expand Up @@ -199,6 +200,7 @@ func (s *subscriptionStorage) ListSubscriptions(
&mysql.JSONObject{Val: &subscription.SourceTypes},
&mysql.JSONObject{Val: &subscription.Recipient},
&subscription.Name,
&subscription.EnvironmentId,
&subscription.EnvironmentName,
)
if err != nil {
Expand Down
20 changes: 12 additions & 8 deletions pkg/push/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,8 @@ func (s *PushService) listAllPushes(
localizer locale.Localizer,
) ([]*pushproto.Push, error) {
whereParts := []mysql.WherePart{
mysql.NewFilter("deleted", "=", false),
mysql.NewFilter("environment_id", "=", environmentId),
mysql.NewFilter("push.deleted", "=", false),
mysql.NewFilter("push.environment_id", "=", environmentId),
}
pushes, _, _, err := s.listPushes(
ctx,
Expand Down Expand Up @@ -1161,11 +1161,11 @@ func (s *PushService) ListPushes(
return nil, err
}
whereParts := []mysql.WherePart{
mysql.NewFilter("deleted", "=", false),
mysql.NewFilter("environment_id", "=", req.EnvironmentId),
mysql.NewFilter("push.deleted", "=", false),
mysql.NewFilter("push.environment_id", "=", req.EnvironmentId),
}
if req.SearchKeyword != "" {
whereParts = append(whereParts, mysql.NewSearchQuery([]string{"name"}, req.SearchKeyword))
whereParts = append(whereParts, mysql.NewSearchQuery([]string{"push.name"}, req.SearchKeyword))
}
orders, err := s.newListOrders(req.OrderBy, req.OrderDirection, localizer)
if err != nil {
Expand Down Expand Up @@ -1207,11 +1207,15 @@ func (s *PushService) newListOrders(
switch orderBy {
case pushproto.ListPushesRequest_DEFAULT,
pushproto.ListPushesRequest_NAME:
column = "name"
column = "push.name"
case pushproto.ListPushesRequest_CREATED_AT:
column = "created_at"
column = "push.created_at"
case pushproto.ListPushesRequest_UPDATED_AT:
column = "updated_at"
column = "push.updated_at"
case pushproto.ListPushesRequest_ENVIRONMENT:
column = "env.name"
case pushproto.ListPushesRequest_STATE:
column = "push.disabled"
default:
dt, err := statusInvalidOrderBy.WithDetails(&errdetails.LocalizedMessage{
Locale: localizer.GetLocale(),
Expand Down
2 changes: 2 additions & 0 deletions pkg/push/storage/v2/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (s *pushStorage) GetPush(ctx context.Context, id, environmentId string) (*d
&push.UpdatedAt,
&push.Disabled,
&push.EnvironmentId,
&push.EnvironmentName,
)
if err != nil {
if errors.Is(err, mysql.ErrNoRows) {
Expand Down Expand Up @@ -168,6 +169,7 @@ func (s *pushStorage) ListPushes(
&push.UpdatedAt,
&push.Disabled,
&push.EnvironmentId,
&push.EnvironmentName,
)
if err != nil {
return nil, 0, 0, err
Expand Down
2 changes: 2 additions & 0 deletions pkg/push/storage/v2/sql/push/count_pushes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ SELECT
COUNT(1)
FROM
push
JOIN
environment_v2 env ON push.environment_id = env.id
%s
21 changes: 12 additions & 9 deletions pkg/push/storage/v2/sql/push/list_pushes.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
SELECT
id,
fcm_service_account,
tags,
deleted,
name,
created_at,
updated_at,
disabled,
environment_id
push.id,
push.fcm_service_account,
push.tags,
push.deleted,
push.name,
push.created_at,
push.updated_at,
push.disabled,
push.environment_id,
env.name AS environment_name
FROM
push
JOIN
environment_v2 env ON push.environment_id = env.id
%s %s %s
25 changes: 14 additions & 11 deletions pkg/push/storage/v2/sql/push/select_push.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
SELECT
id,
fcm_service_account,
tags,
deleted,
name,
created_at,
updated_at,
disabled,
environment_id
push.id,
push.fcm_service_account,
push.tags,
push.deleted,
push.name,
push.created_at,
push.updated_at,
push.disabled,
push.environment_id,
env.name AS environment_name
FROM
push
JOIN
environment_v2 env ON push.environment_id = env.id
WHERE
id = ? AND
environment_id = ?
push.id = ? AND
push.environment_id = ?
Binary file modified proto/auditlog/proto_descriptor.pb
Binary file not shown.
Binary file modified proto/gateway/proto_descriptor.pb
Binary file not shown.
Binary file modified proto/notification/proto_descriptor.pb
Binary file not shown.
Loading

0 comments on commit 905edf8

Please sign in to comment.