update cicd

This commit is contained in:
2026-04-02 11:01:30 +00:00
parent 863a0ea2f6
commit 5a7f29c116
54 changed files with 4298 additions and 473 deletions

View File

@@ -7,12 +7,12 @@ import (
"time"
"github.com/google/uuid"
_ "modernc.org/sqlite"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
_ "modernc.org/sqlite"
appv1 "stream.api/internal/api/proto/app/v1"
"stream.api/internal/database/model"
"stream.api/internal/database/query"
@@ -152,9 +152,9 @@ func popupTestContext(userID, role string) context.Context {
))
}
func popupPtrString(v string) *string { return &v }
func popupPtrBool(v bool) *bool { return &v }
func popupPtrInt32(v int32) *int32 { return &v }
func popupPtrString(v string) *string { return &v }
func popupPtrBool(v bool) *bool { return &v }
func popupPtrInt32(v int32) *int32 { return &v }
func popupPtrTime(v time.Time) *time.Time { return &v }
func popupSeedUser(t *testing.T, db *gorm.DB, user model.User) model.User {
@@ -209,10 +209,10 @@ func TestPopupAdsUserFlow(t *testing.T) {
user := popupSeedUser(t, db, model.User{ID: uuid.NewString(), Email: "user@example.com", Role: popupPtrString("USER")})
createResp, err := (&popupAdsAppService{appServices: services}).CreatePopupAd(popupTestContext(user.ID, "USER"), &appv1.CreatePopupAdRequest{
Type: "url",
Label: "Homepage Campaign",
Value: "https://example.com/landing",
IsActive: popupPtrBool(true),
Type: "url",
Label: "Homepage Campaign",
Value: "https://example.com/landing",
IsActive: popupPtrBool(true),
MaxTriggersPerSession: popupPtrInt32(5),
})
if err != nil {
@@ -231,11 +231,11 @@ func TestPopupAdsUserFlow(t *testing.T) {
}
updateResp, err := (&popupAdsAppService{appServices: services}).UpdatePopupAd(popupTestContext(user.ID, "USER"), &appv1.UpdatePopupAdRequest{
Id: createResp.Item.Id,
Type: "script",
Label: "Homepage Campaign v2",
Value: `<script async src="//example.com/ad.js"></script>`,
IsActive: popupPtrBool(false),
Id: createResp.Item.Id,
Type: "script",
Label: "Homepage Campaign v2",
Value: `<script async src="//example.com/ad.js"></script>`,
IsActive: popupPtrBool(false),
MaxTriggersPerSession: popupPtrInt32(8),
})
if err != nil {
@@ -302,11 +302,11 @@ func TestPopupAdsAdminFlow(t *testing.T) {
user := popupSeedUser(t, db, model.User{ID: uuid.NewString(), Email: "user@example.com", Role: popupPtrString("USER")})
createResp, err := services.CreateAdminPopupAd(popupTestContext(admin.ID, "ADMIN"), &appv1.CreateAdminPopupAdRequest{
UserId: user.ID,
Type: "url",
Label: "Admin Campaign",
Value: "https://example.com/admin",
IsActive: popupPtrBool(true),
UserId: user.ID,
Type: "url",
Label: "Admin Campaign",
Value: "https://example.com/admin",
IsActive: popupPtrBool(true),
MaxTriggersPerSession: popupPtrInt32(7),
})
if err != nil {
@@ -325,12 +325,12 @@ func TestPopupAdsAdminFlow(t *testing.T) {
}
updateResp, err := services.UpdateAdminPopupAd(popupTestContext(admin.ID, "ADMIN"), &appv1.UpdateAdminPopupAdRequest{
Id: createResp.Item.Id,
UserId: user.ID,
Type: "script",
Label: "Admin Campaign v2",
Value: `<script async src="//example.com/admin-v2.js"></script>`,
IsActive: popupPtrBool(false),
Id: createResp.Item.Id,
UserId: user.ID,
Type: "script",
Label: "Admin Campaign v2",
Value: `<script async src="//example.com/admin-v2.js"></script>`,
IsActive: popupPtrBool(false),
MaxTriggersPerSession: popupPtrInt32(11),
})
if err != nil {