diff --git a/.github/workflows/frontend-e2e.yml b/.github/workflows/frontend-e2e.yml index 2053dacbc..d284d6a53 100644 --- a/.github/workflows/frontend-e2e.yml +++ b/.github/workflows/frontend-e2e.yml @@ -39,10 +39,10 @@ jobs: chmod 777 -R ./lnd; chmod 777 -R ./proxy; chmod 777 -R ./cln; - + - name: Check for NODES uses: nick-fields/retry@v2 - with: + with: timeout_minutes: 10 max_attempts: 3 command: | @@ -53,12 +53,12 @@ jobs: docker logs dave.sphinx docker wait stack_relaysetup_1 cat stack/relay/NODES.json; - + - name: Copy Node.json uses: canastro/copy-file-action@master with: - source: 'stack/relay/NODES.json' - target: 'tribes-frontend/cypress/fixtures/nodes.json' + source: "stack/relay/NODES.json" + target: "tribes-frontend/cypress/fixtures/nodes.json" - name: Install Frontend Dependencies working-directory: ./tribes-frontend @@ -73,14 +73,14 @@ jobs: run: | sleep 20 yarn run cypress:run - + - name: Upload Cypress logs if: failure() uses: actions/upload-artifact@v2 with: name: cypress-logs path: tribes-frontend/cypress/videos - + - name: Stop Stack working-directory: ./stack - run: docker-compose down \ No newline at end of file + run: docker-compose down diff --git a/cypress/screenshots/01_workspaces.cy.ts/Edit Mission -- passes (failed).png b/cypress/screenshots/01_workspaces.cy.ts/Edit Mission -- passes (failed).png new file mode 100644 index 000000000..ffdfddc30 Binary files /dev/null and b/cypress/screenshots/01_workspaces.cy.ts/Edit Mission -- passes (failed).png differ diff --git a/cypress/screenshots/01_workspaces.cy.ts/Edit Schematics Url -- passes (failed).png b/cypress/screenshots/01_workspaces.cy.ts/Edit Schematics Url -- passes (failed).png new file mode 100644 index 000000000..ab2084e18 Binary files /dev/null and b/cypress/screenshots/01_workspaces.cy.ts/Edit Schematics Url -- passes (failed).png differ diff --git a/cypress/screenshots/01_workspaces.cy.ts/Edit Tactics -- passes (failed).png b/cypress/screenshots/01_workspaces.cy.ts/Edit Tactics -- passes (failed).png new file mode 100644 index 000000000..39cea55c0 Binary files /dev/null and b/cypress/screenshots/01_workspaces.cy.ts/Edit Tactics -- passes (failed).png differ diff --git a/db/config.go b/db/config.go index f317cbfcf..9789078b9 100644 --- a/db/config.go +++ b/db/config.go @@ -12,8 +12,8 @@ import ( type database struct { db *gorm.DB - getWorkspaceByUuid func(uuid string) Organization - getUserRoles func(uuid string, pubkey string) []UserRoles + getWorkspaceByUuid func(uuid string) Workspace + getUserRoles func(uuid string, pubkey string) []WorkspaceUserRoles } func NewDatabaseConfig(db *gorm.DB) *database { @@ -65,17 +65,12 @@ func InitDB() { db.AutoMigrate(&Channel{}) db.AutoMigrate(&LeaderBoard{}) db.AutoMigrate(&ConnectionCodes{}) - db.AutoMigrate(&Bounty{}) - db.AutoMigrate(&Organization{}) - db.AutoMigrate(&OrganizationUsers{}) db.AutoMigrate(&BountyRoles{}) - db.AutoMigrate(&UserRoles{}) - db.AutoMigrate(&BountyBudget{}) - db.AutoMigrate(&BudgetHistory{}) - db.AutoMigrate(&PaymentHistory{}) - db.AutoMigrate(&InvoiceList{}) db.AutoMigrate(&UserInvoiceData{}) + DB.MigrateTablesWithOrgUuid() + DB.MigrateOrganizationToWorkspace() + people := DB.GetAllPeople() for _, p := range people { if p.Uuid == "" { @@ -178,6 +173,96 @@ func (db database) GetRolesCount() int64 { return count } +func (db database) MigrateTablesWithOrgUuid() { + if !db.db.Migrator().HasTable("bounty") { + if !db.db.Migrator().HasColumn(Bounty{}, "workspace_uuid") { + db.db.AutoMigrate(&Bounty{}) + } + } + if !db.db.Migrator().HasTable("budget_histories") { + if !db.db.Migrator().HasColumn(BudgetHistory{}, "workspace_uuid") { + db.db.AutoMigrate(&BudgetHistory{}) + } + } + if !db.db.Migrator().HasTable("payment_histories") { + if !db.db.Migrator().HasColumn(PaymentHistory{}, "workspace_uuid") { + db.db.AutoMigrate(&PaymentHistory{}) + } + } + if !db.db.Migrator().HasTable("invoice_list") { + if !db.db.Migrator().HasColumn(InvoiceList{}, "workspace_uuid") { + db.db.AutoMigrate(&InvoiceList{}) + } + } + if !db.db.Migrator().HasTable("bounty_budgets") { + if !db.db.Migrator().HasColumn(BountyBudget{}, "workspace_uuid") { + db.db.AutoMigrate(&BountyBudget{}) + } + } + if !db.db.Migrator().HasTable("workspace_user_roles") { + if !db.db.Migrator().HasColumn(UserRoles{}, "workspace_uuid") { + db.db.AutoMigrate(&UserRoles{}) + } + } + if !db.db.Migrator().HasTable("workspaces") { + db.db.AutoMigrate(&Organization{}) + } + if !db.db.Migrator().HasTable("workspace_users") { + db.db.AutoMigrate(&OrganizationUsers{}) + } +} + +func (db database) MigrateOrganizationToWorkspace() { + if (db.db.Migrator().HasTable(&Organization{}) && !db.db.Migrator().HasTable("workspaces")) { + db.db.Migrator().RenameTable(&Organization{}, "workspaces") + } + + if (db.db.Migrator().HasTable(&OrganizationUsers{}) && !db.db.Migrator().HasTable("workspace_users")) { + if db.db.Migrator().HasColumn(&OrganizationUsers{}, "org_uuid") { + db.db.Migrator().RenameColumn(&OrganizationUsers{}, "org_uuid", "workspace_uuid") + } + db.db.Migrator().RenameTable(&OrganizationUsers{}, "workspace_users") + } + + if (db.db.Migrator().HasTable(&UserRoles{}) && !db.db.Migrator().HasTable("workspace_user_roles")) { + if db.db.Migrator().HasColumn(&UserRoles{}, "org_uuid") { + db.db.Migrator().RenameColumn(&UserRoles{}, "org_uuid", "workspace_uuid") + } + + db.db.Migrator().RenameTable(&UserRoles{}, "workspace_user_roles") + } + + if (db.db.Migrator().HasTable(&Bounty{})) { + if db.db.Migrator().HasColumn(&Bounty{}, "org_uuid") { + db.db.Migrator().RenameColumn(&Bounty{}, "org_uuid", "workspace_uuid") + } + } + + if (db.db.Migrator().HasTable(&BountyBudget{})) { + if db.db.Migrator().HasColumn(&BountyBudget{}, "org_uuid") { + db.db.Migrator().RenameColumn(&BountyBudget{}, "org_uuid", "workspace_uuid") + } + } + + if (db.db.Migrator().HasTable(&BudgetHistory{})) { + if db.db.Migrator().HasColumn(&BudgetHistory{}, "org_uuid") { + db.db.Migrator().RenameColumn(&BudgetHistory{}, "org_uuid", "workspace_uuid") + } + } + + if (db.db.Migrator().HasTable(&PaymentHistory{})) { + if db.db.Migrator().HasColumn(&PaymentHistory{}, "org_uuid") { + db.db.Migrator().RenameColumn(&PaymentHistory{}, "org_uuid", "workspace_uuid") + } + } + + if (db.db.Migrator().HasTable(&InvoiceList{})) { + if db.db.Migrator().HasColumn(&InvoiceList{}, "org_uuid") { + db.db.Migrator().RenameColumn(&InvoiceList{}, "org_uuid", "workspace_uuid") + } + } +} + func (db database) CreateRoles() { db.db.Create(&ConfigBountyRoles) } @@ -205,7 +290,7 @@ func GetRolesMap() map[string]string { return roles } -func GetUserRolesMap(userRoles []UserRoles) map[string]string { +func GetUserRolesMap(userRoles []WorkspaceUserRoles) map[string]string { roles := map[string]string{} for _, v := range userRoles { roles[v.Role] = v.Role @@ -235,7 +320,7 @@ func (db database) ConvertMetricsBountiesToMap(metricsCsv []MetricsBountyCsv) [] return metricsMap } -func RolesCheck(userRoles []UserRoles, check string) bool { +func RolesCheck(userRoles []WorkspaceUserRoles, check string) bool { rolesMap := GetRolesMap() userRolesMap := GetUserRolesMap(userRoles) @@ -253,7 +338,7 @@ func RolesCheck(userRoles []UserRoles, check string) bool { return true } -func CheckUser(userRoles []UserRoles, pubkey string) bool { +func CheckUser(userRoles []WorkspaceUserRoles, pubkey string) bool { for _, role := range userRoles { if role.OwnerPubKey == pubkey { return true diff --git a/db/config_test.go b/db/config_test.go index b804fe76d..2c92099e0 100644 --- a/db/config_test.go +++ b/db/config_test.go @@ -10,8 +10,8 @@ import ( func TestRolesCheck_UserHasRole(t *testing.T) { // Mock user roles - userRoles := []UserRoles{ - {Role: "ADD BOUNTY", OwnerPubKey: "user1", OrgUuid: "org1", Created: &time.Time{}}, + userRoles := []WorkspaceUserRoles{ + {Role: "ADD BOUNTY", OwnerPubKey: "user1", WorkspaceUuid: "org1", Created: &time.Time{}}, } // Role to check @@ -28,8 +28,8 @@ func TestRolesCheck_UserHasRole(t *testing.T) { func TestRolesCheck_UserDoesNotHaveRole(t *testing.T) { // Mock user roles - userRoles := []UserRoles{ - {Role: "DELETE BOUNTY", OwnerPubKey: "user2", OrgUuid: "org1", Created: &time.Time{}}, + userRoles := []WorkspaceUserRoles{ + {Role: "DELETE BOUNTY", OwnerPubKey: "user2", WorkspaceUuid: "org1", Created: &time.Time{}}, } // Role to check @@ -45,7 +45,7 @@ func TestRolesCheck_UserDoesNotHaveRole(t *testing.T) { } func TestCheckUser(t *testing.T) { - userRoles := []UserRoles{ + userRoles := []WorkspaceUserRoles{ {OwnerPubKey: "userPublicKey"}, } @@ -55,16 +55,16 @@ func TestCheckUser(t *testing.T) { } func TestUserHasAccess(t *testing.T) { - mockGetWorkspaceByUuid := func(uuid string) Organization { - return Organization{ + mockGetWorkspaceByUuid := func(uuid string) Workspace { + return Workspace{ Uuid: uuid, OwnerPubKey: "org_admin", } } - mockGetUserRoles := func(uuid string, pubkey string) []UserRoles { - return []UserRoles{ - {Role: "ADD BOUNTY", OwnerPubKey: pubkey, OrgUuid: uuid, Created: &time.Time{}}, + mockGetUserRoles := func(uuid string, pubkey string) []WorkspaceUserRoles { + return []WorkspaceUserRoles{ + {Role: "ADD BOUNTY", OwnerPubKey: pubkey, WorkspaceUuid: uuid, Created: &time.Time{}}, } } @@ -74,17 +74,17 @@ func TestUserHasAccess(t *testing.T) { databaseConfig.getWorkspaceByUuid = mockGetWorkspaceByUuid databaseConfig.getUserRoles = mockGetUserRoles - t.Run("Should test that if the user is the admin of an organization returns true", func(t *testing.T) { - result := databaseConfig.UserHasAccess("org_admin", "org_uuid", "ADD BOUNTY") + t.Run("Should test that if the user is the admin of an workspace returns true", func(t *testing.T) { + result := databaseConfig.UserHasAccess("org_admin", "workspace_uuid", "ADD BOUNTY") // Assert that it returns true since the user is the org admin if !result { - t.Errorf("Expected UserHasAccess to return true for organization admin, got false") + t.Errorf("Expected UserHasAccess to return true for workspace admin, got false") } }) - t.Run("Should test that if the user is not the organization admin, and the user has the required role it should return true", func(t *testing.T) { - result := databaseConfig.UserHasAccess("user_pubkey", "org_uuid", "ADD BOUNTY") + t.Run("Should test that if the user is not the workspace admin, and the user has the required role it should return true", func(t *testing.T) { + result := databaseConfig.UserHasAccess("user_pubkey", "workspace_uuid", "ADD BOUNTY") // Assert that it returns true since the user has the required role if !result { @@ -92,8 +92,8 @@ func TestUserHasAccess(t *testing.T) { } }) - t.Run("Should test that if the user is not the organization admin, and the user has not the required role it should return false", func(t *testing.T) { - result := databaseConfig.UserHasAccess("user_pubkey", "org_uuid", "DELETE BOUNTY") + t.Run("Should test that if the user is not the workspace admin, and the user has not the required role it should return false", func(t *testing.T) { + result := databaseConfig.UserHasAccess("user_pubkey", "workspace_uuid", "DELETE BOUNTY") // Assert that it returns false since the user does not have the required role if result { @@ -103,24 +103,24 @@ func TestUserHasAccess(t *testing.T) { } func TestUserHasManageBountyRoles(t *testing.T) { - mockGetWorkspaceByUuid := func(uuid string) Organization { - return Organization{ + mockGetWorkspaceByUuid := func(uuid string) Workspace { + return Workspace{ Uuid: uuid, OwnerPubKey: "org_admin", } } - mockGetUserRoles := func(uuid string, pubkey string) []UserRoles { - if uuid == "org_uuid" { - return []UserRoles{ - {Role: "ADD BOUNTY", OwnerPubKey: pubkey, OrgUuid: uuid, Created: &time.Time{}}, + mockGetUserRoles := func(uuid string, pubkey string) []WorkspaceUserRoles { + if uuid == "workspace_uuid" { + return []WorkspaceUserRoles{ + {Role: "ADD BOUNTY", OwnerPubKey: pubkey, WorkspaceUuid: uuid, Created: &time.Time{}}, } } else { - return []UserRoles{ - {Role: "ADD BOUNTY", OwnerPubKey: pubkey, OrgUuid: uuid, Created: &time.Time{}}, - {Role: "UPDATE BOUNTY", OwnerPubKey: pubkey, OrgUuid: uuid, Created: &time.Time{}}, - {Role: "DELETE BOUNTY", OwnerPubKey: pubkey, OrgUuid: uuid, Created: &time.Time{}}, - {Role: "PAY BOUNTY", OwnerPubKey: pubkey, OrgUuid: uuid, Created: &time.Time{}}, + return []WorkspaceUserRoles{ + {Role: "ADD BOUNTY", OwnerPubKey: pubkey, WorkspaceUuid: uuid, Created: &time.Time{}}, + {Role: "UPDATE BOUNTY", OwnerPubKey: pubkey, WorkspaceUuid: uuid, Created: &time.Time{}}, + {Role: "DELETE BOUNTY", OwnerPubKey: pubkey, WorkspaceUuid: uuid, Created: &time.Time{}}, + {Role: "PAY BOUNTY", OwnerPubKey: pubkey, WorkspaceUuid: uuid, Created: &time.Time{}}, } } } @@ -131,22 +131,22 @@ func TestUserHasManageBountyRoles(t *testing.T) { databaseConfig.getWorkspaceByUuid = mockGetWorkspaceByUuid databaseConfig.getUserRoles = mockGetUserRoles - t.Run("Should test that if the user is the organization admin return true", func(t *testing.T) { - result := databaseConfig.UserHasManageBountyRoles("org_admin", "org_uuid") + t.Run("Should test that if the user is the workspace admin return true", func(t *testing.T) { + result := databaseConfig.UserHasManageBountyRoles("org_admin", "workspace_uuid") // Assert that it returns true since the user is the org admin - assert.True(t, result, "Expected UserHasManageBountyRoles to return true for organization admin") + assert.True(t, result, "Expected UserHasManageBountyRoles to return true for workspace admin") }) t.Run("Should test that if the user has all bounty roles return true", func(t *testing.T) { - result := databaseConfig.UserHasManageBountyRoles("user_pubkey", "org_uuid2") + result := databaseConfig.UserHasManageBountyRoles("user_pubkey", "workspace_uuid2") // Assert that it returns true since the user has all bounty roles assert.True(t, result, "Expected UserHasManageBountyRoles to return true for user with all bounty roles") }) t.Run("Should test that if the user don't have all bounty roles return false.", func(t *testing.T) { - result := databaseConfig.UserHasManageBountyRoles("user_pubkey", "org_uuid") + result := databaseConfig.UserHasManageBountyRoles("user_pubkey", "workspace_uuid") // Assert that it returns false since the user does not have all bounty roles assert.False(t, result, "Expected UserHasManageBountyRoles to return false for user without all bounty roles") diff --git a/db/db.go b/db/db.go index 4bce4e82d..d2af69fb5 100644 --- a/db/db.go +++ b/db/db.go @@ -586,7 +586,7 @@ func (db database) GetFilterStatusCount() FilterStattuCount { return ms } -func (db database) GetWorkspaceBounties(r *http.Request, org_uuid string) []Bounty { +func (db database) GetWorkspaceBounties(r *http.Request, workspace_uuid string) []NewBounty { keys := r.URL.Query() tags := keys.Get("tags") // this is a string of tags separated by commas offset, limit, sortBy, direction, search := utils.GetPaginationParams(r) @@ -598,7 +598,7 @@ func (db database) GetWorkspaceBounties(r *http.Request, org_uuid string) []Boun languageArray := strings.Split(languages, ",") languageLength := len(languageArray) - ms := []Bounty{} + ms := []NewBounty{} orderQuery := "" limitQuery := "" @@ -656,7 +656,7 @@ func (db database) GetWorkspaceBounties(r *http.Request, org_uuid string) []Boun } } - query := `SELECT * FROM bounty WHERE org_uuid = '` + org_uuid + `'` + query := `SELECT * FROM bounty WHERE workspace_uuid = '` + workspace_uuid + `'` allQuery := query + " " + statusQuery + " " + searchQuery + " " + languageQuery + " " + orderQuery + " " + limitQuery theQuery := db.db.Raw(allQuery) @@ -673,7 +673,7 @@ func (db database) GetWorkspaceBounties(r *http.Request, org_uuid string) []Boun return ms } -func (db database) GetWorkspaceBountiesCount(r *http.Request, org_uuid string) int64 { +func (db database) GetWorkspaceBountiesCount(r *http.Request, workspace_uuid string) int64 { keys := r.URL.Query() tags := keys.Get("tags") // this is a string of tags separated by commas search := keys.Get("search") @@ -730,7 +730,7 @@ func (db database) GetWorkspaceBountiesCount(r *http.Request, org_uuid string) i var count int64 - query := `SELECT COUNT(*) FROM bounty WHERE org_uuid = '` + org_uuid + `'` + query := `SELECT COUNT(*) FROM bounty WHERE workspace_uuid = '` + workspace_uuid + `'` allQuery := query + " " + statusQuery + " " + searchQuery + " " + languageQuery theQuery := db.db.Raw(allQuery) @@ -747,7 +747,7 @@ func (db database) GetWorkspaceBountiesCount(r *http.Request, org_uuid string) i return count } -func (db database) GetAssignedBounties(r *http.Request) ([]Bounty, error) { +func (db database) GetAssignedBounties(r *http.Request) ([]NewBounty, error) { offset, limit, sortBy, direction, _ := utils.GetPaginationParams(r) uuid := chi.URLParam(r, "uuid") person := db.GetPersonByUuid(uuid) @@ -788,7 +788,7 @@ func (db database) GetAssignedBounties(r *http.Request) ([]Bounty, error) { limitQuery = fmt.Sprintf("LIMIT %d OFFSET %d", limit, offset) } - ms := []Bounty{} + ms := []NewBounty{} query := `SELECT * FROM public.bounty WHERE assignee = '` + pubkey + `' AND show != false` allQuery := query + " " + statusQuery + " " + orderQuery + " " + limitQuery @@ -796,7 +796,7 @@ func (db database) GetAssignedBounties(r *http.Request) ([]Bounty, error) { return ms, err } -func (db database) GetCreatedBounties(r *http.Request) ([]Bounty, error) { +func (db database) GetCreatedBounties(r *http.Request) ([]NewBounty, error) { offset, limit, sortBy, direction, _ := utils.GetPaginationParams(r) uuid := chi.URLParam(r, "uuid") person := db.GetPersonByUuid(uuid) @@ -838,7 +838,7 @@ func (db database) GetCreatedBounties(r *http.Request) ([]Bounty, error) { limitQuery = fmt.Sprintf("LIMIT %d OFFSET %d", limit, offset) } - ms := []Bounty{} + ms := []NewBounty{} query := `SELECT * FROM public.bounty WHERE owner_id = '` + pubkey + `'` allQuery := query + " " + statusQuery + " " + orderQuery + " " + limitQuery @@ -847,8 +847,8 @@ func (db database) GetCreatedBounties(r *http.Request) ([]Bounty, error) { return ms, err } -func (db database) GetBountyById(id string) ([]Bounty, error) { - ms := []Bounty{} +func (db database) GetBountyById(id string) ([]NewBounty, error) { + ms := []NewBounty{} err := db.db.Raw(`SELECT * FROM public.bounty WHERE id = '` + id + `'`).Find(&ms).Error return ms, err } @@ -1036,7 +1036,7 @@ func (db database) GetNextWorkspaceBountyByCreated(r *http.Request) (uint, error } } - query := `SELECT id FROM public.bounty WHERE org_uuid = '` + uuid + `' AND created > '` + created + `' AND show = true` + query := `SELECT id FROM public.bounty WHERE workspace_uuid = '` + uuid + `' AND created > '` + created + `' AND show = true` orderQuery := "ORDER BY created ASC LIMIT 1" allQuery := query + " " + searchQuery + " " + statusQuery + " " + languageQuery + " " + orderQuery @@ -1102,7 +1102,7 @@ func (db database) GetPreviousWorkspaceBountyByCreated(r *http.Request) (uint, e } } - query := `SELECT id FROM public.bounty WHERE org_uuid = '` + uuid + `' AND created < '` + created + `' AND show = true` + query := `SELECT id FROM public.bounty WHERE workspace_uuid = '` + uuid + `' AND created < '` + created + `' AND show = true` orderQuery := "ORDER BY created DESC LIMIT 1" allQuery := query + " " + searchQuery + " " + statusQuery + " " + languageQuery + " " + orderQuery @@ -1117,8 +1117,8 @@ func (db database) GetBountyIndexById(id string) int64 { return index } -func (db database) GetBountyDataByCreated(created string) ([]Bounty, error) { - ms := []Bounty{} +func (db database) GetBountyDataByCreated(created string) ([]NewBounty, error) { + ms := []NewBounty{} err := db.db.Raw(`SELECT * FROM public.bounty WHERE created = '` + created + `'`).Find(&ms).Error return ms, err } @@ -1128,7 +1128,7 @@ func (db database) AddBounty(b Bounty) (Bounty, error) { return b, nil } -func (db database) GetAllBounties(r *http.Request) []Bounty { +func (db database) GetAllBounties(r *http.Request) []NewBounty { keys := r.URL.Query() tags := keys.Get("tags") // this is a string of tags separated by commas offset, limit, sortBy, direction, search := utils.GetPaginationParams(r) @@ -1137,16 +1137,21 @@ func (db database) GetAllBounties(r *http.Request) []Bounty { completed := keys.Get("Completed") paid := keys.Get("Paid") orgUuid := keys.Get("org_uuid") + workspaceUuid := keys.Get("workspace_uuid") languages := keys.Get("languages") languageArray := strings.Split(languages, ",") languageLength := len(languageArray) - ms := []Bounty{} + if workspaceUuid != "" && orgUuid != "" { + workspaceUuid = orgUuid + } + + ms := []NewBounty{} orderQuery := "" limitQuery := "" searchQuery := "" - orgQuery := "" + workspaceQuery := "" languageQuery := "" if sortBy != "" && direction != "" { @@ -1183,8 +1188,8 @@ func (db database) GetAllBounties(r *http.Request) []Bounty { statusQuery = "" } - if orgUuid != "" { - orgQuery = "AND org_uuid = '" + orgUuid + "'" + if workspaceUuid != "" { + workspaceQuery = "AND workspace_uuid = '" + workspaceUuid + "'" } if languageLength > 0 { langs := "" @@ -1202,7 +1207,7 @@ func (db database) GetAllBounties(r *http.Request) []Bounty { query := "SELECT * FROM public.bounty WHERE show != false" - allQuery := query + " " + statusQuery + " " + searchQuery + " " + orgQuery + " " + languageQuery + " " + orderQuery + " " + limitQuery + allQuery := query + " " + statusQuery + " " + searchQuery + " " + workspaceQuery + " " + languageQuery + " " + orderQuery + " " + limitQuery theQuery := db.db.Raw(allQuery) @@ -1219,9 +1224,9 @@ func (db database) GetAllBounties(r *http.Request) []Bounty { return ms } -func (db database) CreateOrEditBounty(b Bounty) (Bounty, error) { +func (db database) CreateOrEditBounty(b NewBounty) (NewBounty, error) { if b.OwnerID == "" { - return Bounty{}, errors.New("no pub key") + return NewBounty{}, errors.New("no pub key") } if db.db.Model(&b).Where("id = ? OR owner_id = ? AND created = ?", b.ID, b.OwnerID, b.Created).Updates(&b).RowsAffected == 0 { @@ -1230,44 +1235,44 @@ func (db database) CreateOrEditBounty(b Bounty) (Bounty, error) { return b, nil } -func (db database) UpdateBountyNullColumn(b Bounty, column string) Bounty { +func (db database) UpdateBountyNullColumn(b NewBounty, column string) NewBounty { columnMap := make(map[string]interface{}) columnMap[column] = "" db.db.Model(&b).Where("created = ?", b.Created).UpdateColumns(&columnMap) return b } -func (db database) UpdateBountyBoolColumn(b Bounty, column string) Bounty { +func (db database) UpdateBountyBoolColumn(b NewBounty, column string) NewBounty { columnMap := make(map[string]interface{}) columnMap[column] = false db.db.Model(&b).Select(column).UpdateColumns(columnMap) return b } -func (db database) DeleteBounty(pubkey string, created string) (Bounty, error) { - m := Bounty{} +func (db database) DeleteBounty(pubkey string, created string) (NewBounty, error) { + m := NewBounty{} db.db.Where("owner_id", pubkey).Where("created", created).Delete(&m) return m, nil } -func (db database) GetBountyByCreated(created uint) (Bounty, error) { - b := Bounty{} +func (db database) GetBountyByCreated(created uint) (NewBounty, error) { + b := NewBounty{} err := db.db.Where("created", created).Find(&b).Error return b, err } -func (db database) GetBounty(id uint) Bounty { - b := Bounty{} +func (db database) GetBounty(id uint) NewBounty { + b := NewBounty{} db.db.Where("id", id).Find(&b) return b } -func (db database) UpdateBounty(b Bounty) (Bounty, error) { +func (db database) UpdateBounty(b NewBounty) (NewBounty, error) { db.db.Where("created", b.Created).Updates(&b) return b, nil } -func (db database) UpdateBountyPayment(b Bounty) (Bounty, error) { +func (db database) UpdateBountyPayment(b NewBounty) (NewBounty, error) { db.db.Model(&b).Where("created", b.Created).Updates(map[string]interface{}{ "paid": b.Paid, }) @@ -1275,7 +1280,7 @@ func (db database) UpdateBountyPayment(b Bounty) (Bounty, error) { return b, nil } -func (db database) UpdateBountyCompleted(b Bounty) (Bounty, error) { +func (db database) UpdateBountyCompleted(b NewBounty) (NewBounty, error) { db.db.Model(&b).Where("created", b.Created).Updates(map[string]interface{}{ "completed": b.Completed, }) @@ -1676,20 +1681,20 @@ func GetLeaderData(arr []LeaderData, key string) (int, int) { return found, index } -func (db database) GetInvoice(payment_request string) InvoiceList { - ms := InvoiceList{} +func (db database) GetInvoice(payment_request string) NewInvoiceList { + ms := NewInvoiceList{} db.db.Where("payment_request = ?", payment_request).Find(&ms) return ms } -func (db database) UpdateInvoice(payment_request string) InvoiceList { - ms := InvoiceList{} - db.db.Model(&InvoiceList{}).Where("payment_request = ?", payment_request).Update("status", true) +func (db database) UpdateInvoice(payment_request string) NewInvoiceList { + ms := NewInvoiceList{} + db.db.Model(&NewInvoiceList{}).Where("payment_request = ?", payment_request).Update("status", true) ms.Status = true return ms } -func (db database) AddInvoice(invoice InvoiceList) InvoiceList { +func (db database) AddInvoice(invoice NewInvoiceList) NewInvoiceList { db.db.Create(&invoice) return invoice } diff --git a/db/interface.go b/db/interface.go index 4bd082473..e3cc95163 100644 --- a/db/interface.go +++ b/db/interface.go @@ -31,27 +31,27 @@ type Database interface { GetListedPosts(r *http.Request) ([]PeopleExtra, error) GetUserBountiesCount(personKey string, tabType string) int64 GetBountiesCount(r *http.Request) int64 - GetWorkspaceBounties(r *http.Request, org_uuid string) []Bounty - GetWorkspaceBountiesCount(r *http.Request, org_uuid string) int64 - GetAssignedBounties(r *http.Request) ([]Bounty, error) - GetCreatedBounties(r *http.Request) ([]Bounty, error) - GetBountyById(id string) ([]Bounty, error) + GetWorkspaceBounties(r *http.Request, workspace_uuid string) []NewBounty + GetWorkspaceBountiesCount(r *http.Request, workspace_uuid string) int64 + GetAssignedBounties(r *http.Request) ([]NewBounty, error) + GetCreatedBounties(r *http.Request) ([]NewBounty, error) + GetBountyById(id string) ([]NewBounty, error) GetNextBountyByCreated(r *http.Request) (uint, error) GetPreviousBountyByCreated(r *http.Request) (uint, error) GetNextWorkspaceBountyByCreated(r *http.Request) (uint, error) GetPreviousWorkspaceBountyByCreated(r *http.Request) (uint, error) GetBountyIndexById(id string) int64 - GetBountyDataByCreated(created string) ([]Bounty, error) + GetBountyDataByCreated(created string) ([]NewBounty, error) AddBounty(b Bounty) (Bounty, error) - GetAllBounties(r *http.Request) []Bounty - CreateOrEditBounty(b Bounty) (Bounty, error) - UpdateBountyNullColumn(b Bounty, column string) Bounty - UpdateBountyBoolColumn(b Bounty, column string) Bounty - DeleteBounty(pubkey string, created string) (Bounty, error) - GetBountyByCreated(created uint) (Bounty, error) - GetBounty(id uint) Bounty - UpdateBounty(b Bounty) (Bounty, error) - UpdateBountyPayment(b Bounty) (Bounty, error) + GetAllBounties(r *http.Request) []NewBounty + CreateOrEditBounty(b NewBounty) (NewBounty, error) + UpdateBountyNullColumn(b NewBounty, column string) NewBounty + UpdateBountyBoolColumn(b NewBounty, column string) NewBounty + DeleteBounty(pubkey string, created string) (NewBounty, error) + GetBountyByCreated(created uint) (NewBounty, error) + GetBounty(id uint) NewBounty + UpdateBounty(b NewBounty) (NewBounty, error) + UpdateBountyPayment(b NewBounty) (NewBounty, error) GetListedOffers(r *http.Request) ([]PeopleExtra, error) UpdateBot(uuid string, u map[string]interface{}) bool GetAllTribes() []Tribe @@ -83,41 +83,41 @@ type Database interface { GetLnUser(lnKey string) int64 CreateLnUser(lnKey string) (Person, error) GetBountiesLeaderboard() []LeaderData - GetWorkspaces(r *http.Request) []Organization + GetWorkspaces(r *http.Request) []Workspace GetWorkspacesCount() int64 - GetWorkspaceByUuid(uuid string) Organization - GetWorkspaceByName(name string) Organization - CreateOrEditWorkspace(m Organization) (Organization, error) - GetWorkspaceUsers(uuid string) ([]OrganizationUsersData, error) + GetWorkspaceByUuid(uuid string) Workspace + GetWorkspaceByName(name string) Workspace + CreateOrEditWorkspace(m Workspace) (Workspace, error) + GetWorkspaceUsers(uuid string) ([]WorkspaceUsersData, error) GetWorkspaceUsersCount(uuid string) int64 GetWorkspaceBountyCount(uuid string) int64 - GetWorkspaceUser(pubkey string, org_uuid string) OrganizationUsers - CreateWorkspaceUser(orgUser OrganizationUsers) OrganizationUsers - DeleteWorkspaceUser(orgUser OrganizationUsersData, org string) OrganizationUsersData + GetWorkspaceUser(pubkey string, workspace_uuid string) WorkspaceUsers + CreateWorkspaceUser(orgUser WorkspaceUsers) WorkspaceUsers + DeleteWorkspaceUser(orgUser WorkspaceUsersData, org string) WorkspaceUsersData GetBountyRoles() []BountyRoles - CreateUserRoles(roles []UserRoles, uuid string, pubkey string) []UserRoles - GetUserCreatedWorkspaces(pubkey string) []Organization - GetUserAssignedWorkspaces(pubkey string) []OrganizationUsers + CreateUserRoles(roles []WorkspaceUserRoles, uuid string, pubkey string) []WorkspaceUserRoles + GetUserCreatedWorkspaces(pubkey string) []Workspace + GetUserAssignedWorkspaces(pubkey string) []WorkspaceUsers AddBudgetHistory(budget BudgetHistory) BudgetHistory - CreateWorkspaceBudget(budget BountyBudget) BountyBudget - UpdateWorkspaceBudget(budget BountyBudget) BountyBudget - GetPaymentHistoryByCreated(created *time.Time, org_uuid string) PaymentHistory - GetWorkspaceBudget(org_uuid string) BountyBudget - GetWorkspaceStatusBudget(org_uuid string) StatusBudget - GetWorkspaceBudgetHistory(org_uuid string) []BudgetHistoryData - AddAndUpdateBudget(invoice InvoiceList) PaymentHistory - WithdrawBudget(sender_pubkey string, org_uuid string, amount uint) - AddPaymentHistory(payment PaymentHistory) PaymentHistory - GetPaymentHistory(org_uuid string, r *http.Request) []PaymentHistory - GetInvoice(payment_request string) InvoiceList - GetWorkspaceInvoices(org_uuid string) []InvoiceList - GetWorkspaceInvoicesCount(org_uuid string) int64 - UpdateInvoice(payment_request string) InvoiceList - AddInvoice(invoice InvoiceList) InvoiceList + CreateWorkspaceBudget(budget NewBountyBudget) NewBountyBudget + UpdateWorkspaceBudget(budget NewBountyBudget) NewBountyBudget + GetPaymentHistoryByCreated(created *time.Time, workspace_uuid string) NewPaymentHistory + GetWorkspaceBudget(workspace_uuid string) NewBountyBudget + GetWorkspaceStatusBudget(workspace_uuid string) StatusBudget + GetWorkspaceBudgetHistory(workspace_uuid string) []BudgetHistoryData + AddAndUpdateBudget(invoice NewInvoiceList) NewPaymentHistory + WithdrawBudget(sender_pubkey string, workspace_uuid string, amount uint) + AddPaymentHistory(payment NewPaymentHistory) NewPaymentHistory + GetPaymentHistory(workspace_uuid string, r *http.Request) []NewPaymentHistory + GetInvoice(payment_request string) NewInvoiceList + GetWorkspaceInvoices(workspace_uuid string) []NewInvoiceList + GetWorkspaceInvoicesCount(workspace_uuid string) int64 + UpdateInvoice(payment_request string) NewInvoiceList + AddInvoice(invoice NewInvoiceList) NewInvoiceList AddUserInvoiceData(userData UserInvoiceData) UserInvoiceData GetUserInvoiceData(payment_request string) UserInvoiceData DeleteUserInvoiceData(payment_request string) UserInvoiceData - ChangeWorkspaceDeleteStatus(org_uuid string, status bool) Organization + ChangeWorkspaceDeleteStatus(workspace_uuid string, status bool) Workspace UpdateWorkspaceForDeletion(uuid string) error DeleteAllUsersFromWorkspace(uuid string) error GetFilterStatusCount() FilterStattuCount diff --git a/db/structs.go b/db/structs.go index ee8233045..7f1bf8ea6 100644 --- a/db/structs.go +++ b/db/structs.go @@ -389,6 +389,41 @@ type Bounty struct { CodingLanguages pq.StringArray `gorm:"type:text[];not null default:'[]'" json:"coding_languages"` } +// Todo: Change back to Bounty +type NewBounty struct { + ID uint `json:"id"` + OwnerID string `json:"owner_id"` + Paid bool `json:"paid"` + Show bool `gorm:"default:false" json:"show"` + Completed bool `gorm:"default:false" json:"completed"` + Type string `json:"type"` + Award string `json:"award"` + AssignedHours uint8 `json:"assigned_hours"` + BountyExpires string `json:"bounty_expires"` + CommitmentFee uint64 `json:"commitment_fee"` + Price uint `json:"price"` + Title string `json:"title"` + Tribe string `json:"tribe"` + Assignee string `json:"assignee"` + TicketUrl string `json:"ticket_url"` + OrgUuid string `gorm:"-" json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid"` + Description string `json:"description"` + WantedType string `json:"wanted_type"` + Deliverables string `json:"deliverables"` + GithubDescription bool `json:"github_description"` + OneSentenceSummary string `json:"one_sentence_summary"` + EstimatedSessionLength string `json:"estimated_session_length"` + EstimatedCompletionDate string `json:"estimated_completion_date"` + Created int64 `json:"created"` + Updated *time.Time `json:"updated"` + AssignedDate *time.Time `json:"assigned_date,omitempty"` + CompletionDate *time.Time `json:"completion_date,omitempty"` + MarkAsPaidDate *time.Time `json:"mark_as_paid_date,omitempty"` + PaidDate *time.Time `json:"paid_date,omitempty"` + CodingLanguages pq.StringArray `gorm:"type:text[];not null default:'[]'" json:"coding_languages"` +} + type BountyOwners struct { OwnerID string `json:"owner_id"` } @@ -429,10 +464,11 @@ type BountyData struct { } type BountyResponse struct { - Bounty Bounty `json:"bounty"` - Assignee Person `json:"assignee"` - Owner Person `json:"owner"` - Organization OrganizationShort `json:"organization"` + Bounty NewBounty `json:"bounty"` + Assignee Person `json:"assignee"` + Owner Person `json:"owner"` + Organization WorkspaceShort `json:"organization"` + Workspace WorkspaceShort `json:"workspace"` } type BountyCountResponse struct { @@ -458,7 +494,24 @@ type Organization struct { Description string `json:"description" validate:"omitempty,lte=120"` } -type OrganizationShort struct { +type Workspace struct { + ID uint `json:"id"` + Uuid string `json:"uuid"` + Name string `gorm:"unique;not null" json:"name"` + OwnerPubKey string `json:"owner_pubkey"` + Img string `json:"img"` + Created *time.Time `json:"created"` + Updated *time.Time `json:"updated"` + Show bool `json:"show"` + Deleted bool `gorm:"default:false" json:"deleted"` + BountyCount int64 `json:"bounty_count,omitempty"` + Budget uint `json:"budget,omitempty"` + Website string `json:"website" validate:"omitempty,uri"` + Github string `json:"github" validate:"omitempty,uri"` + Description string `json:"description" validate:"omitempty,lte=120"` +} + +type WorkspaceShort struct { Uuid string `json:"uuid"` Name string `gorm:"unique;not null" json:"name"` Img string `json:"img"` @@ -472,9 +525,19 @@ type OrganizationUsers struct { Updated *time.Time `json:"updated"` } -type OrganizationUsersData struct { - OrgUuid string `json:"org_uuid"` - UserCreated *time.Time `json:"user_created"` +type WorkspaceUsers struct { + ID uint `json:"id"` + OwnerPubKey string `json:"owner_pubkey"` + OrgUuid string `gorm:"-" json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid,omitempty"` + Created *time.Time `json:"created"` + Updated *time.Time `json:"updated"` +} + +type WorkspaceUsersData struct { + OrgUuid string `gorm:"-" json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid,omitempty"` + UserCreated *time.Time `json:"user_created"` Person } @@ -489,16 +552,37 @@ type UserRoles struct { Created *time.Time `json:"created"` } +// change back to UserRoles after migration +type WorkspaceUserRoles struct { + Role string `json:"role"` + OwnerPubKey string `json:"owner_pubkey"` + OrgUuid string `gorm:"-" json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid,omitempty"` + Created *time.Time `json:"created"` +} + type BountyBudget struct { - ID uint `json:"id"` - OrgUuid string `json:"org_uuid"` - TotalBudget uint `json:"total_budget"` - Created *time.Time `json:"created"` - Updated *time.Time `json:"updated"` + ID uint `json:"id"` + OrgUuid string `json:"org_uuid"` + WorkspaceUuid string `gorm:"-" json:"workspace_uuid,omitempty"` + TotalBudget uint `json:"total_budget"` + Created *time.Time `json:"created"` + Updated *time.Time `json:"updated"` +} + +// Rename back to BountyBudget +type NewBountyBudget struct { + ID uint `json:"id"` + OrgUuid string `gorm:"-" json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid"` + TotalBudget uint `json:"total_budget"` + Created *time.Time `json:"created"` + Updated *time.Time `json:"updated"` } type StatusBudget struct { OrgUuid string `json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid"` CurrentBudget uint `json:"current_budget"` OpenBudget uint `json:"open_budget"` OpenCount int64 `json:"open_count"` @@ -511,7 +595,8 @@ type StatusBudget struct { type BudgetInvoiceRequest struct { Amount uint `json:"amount"` SenderPubKey string `json:"sender_pubkey"` - OrgUuid string `json:"org_uuid"` + OrgUuid string `json:"org_uuid,omitempty"` + WorkspaceUuid string `json:"workspace_uuid,omitempty"` PaymentType PaymentType `json:"payment_type,omitempty"` Websocket_token string `json:"websocket_token,omitempty"` } @@ -562,12 +647,26 @@ type PaymentHistory struct { Status bool `json:"status"` } +type NewPaymentHistory struct { + ID uint `json:"id"` + Amount uint `json:"amount"` + BountyId uint `json:"bounty_id"` + PaymentType PaymentType `json:"payment_type"` + OrgUuid string `gorm:"-" json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid,omitempty"` + SenderPubKey string `json:"sender_pubkey"` + ReceiverPubKey string `json:"receiver_pubkey"` + Created *time.Time `json:"created"` + Updated *time.Time `json:"updated"` + Status bool `json:"status"` +} + type PaymentHistoryData struct { - PaymentHistory - SenderName string `json:"sender_name"` - ReceiverName string `json:"receiver_name"` - SenderImg string `json:"sender_img"` - ReceiverImg string `json:"receiver_img"` + PaymentHistory NewPaymentHistory + SenderName string `json:"sender_name"` + ReceiverName string `json:"receiver_name"` + SenderImg string `json:"sender_img"` + ReceiverImg string `json:"receiver_img"` } type PaymentData struct { @@ -606,6 +705,19 @@ type InvoiceList struct { Updated *time.Time `json:"updated"` } +// Todo: Rename back to InvoiceList +type NewInvoiceList struct { + ID uint `json:"id"` + PaymentRequest string `json:"payment_request"` + Status bool `json:"status"` + Type InvoiceType `json:"type"` + OwnerPubkey string `json:"owner_pubkey"` + OrgUuid string `gorm:"-" json:"org_uuid"` + WorkspaceUuid string `json:"workspace_uuid"` + Created *time.Time `json:"created"` + Updated *time.Time `json:"updated"` +} + type UserInvoiceData struct { ID uint `json:"id"` Amount uint `json:"amount"` @@ -624,6 +736,13 @@ type WithdrawBudgetRequest struct { OrgUuid string `json:"org_uuid"` } +// change back to WithdrawBudgetReques +type NewWithdrawBudgetRequest struct { + PaymentRequest string `json:"payment_request"` + Websocket_token string `json:"websocket_token,omitempty"` + WorkspaceUuid string `json:"workspace_uuid"` +} + type PaymentDateRange struct { StartDate string `json:"start_date"` EndDate string `json:"end_date"` @@ -716,6 +835,22 @@ func (Bounty) TableName() string { return "bounty" } +func (NewBounty) TableName() string { + return "bounty" +} + +func (NewBountyBudget) TableName() string { + return "bounty_budgets" +} + +func (NewInvoiceList) TableName() string { + return "invoice_lists" +} + +func (NewPaymentHistory) TableName() string { + return "payment_histories" +} + func (ConnectionCodes) TableName() string { return "connectioncodes" } diff --git a/db/workspaces.go b/db/workspaces.go index 97cf37e37..d1e77b596 100644 --- a/db/workspaces.go +++ b/db/workspaces.go @@ -9,8 +9,8 @@ import ( "github.com/stakwork/sphinx-tribes/utils" ) -func (db database) GetWorkspaces(r *http.Request) []Organization { - ms := []Organization{} +func (db database) GetWorkspaces(r *http.Request) []Workspace { + ms := []Workspace{} offset, limit, sortBy, direction, search := utils.GetPaginationParams(r) // return if like owner_alias, unique_name, or equals pubkey @@ -20,29 +20,29 @@ func (db database) GetWorkspaces(r *http.Request) []Organization { func (db database) GetWorkspacesCount() int64 { var count int64 - db.db.Model(&Organization{}).Count(&count) + db.db.Model(&Workspace{}).Count(&count) return count } -func (db database) GetWorkspaceByUuid(uuid string) Organization { - ms := Organization{} +func (db database) GetWorkspaceByUuid(uuid string) Workspace { + ms := Workspace{} - db.db.Model(&Organization{}).Where("uuid = ?", uuid).Find(&ms) + db.db.Model(&Workspace{}).Where("uuid = ?", uuid).Find(&ms) return ms } -func (db database) GetWorkspaceByName(name string) Organization { - ms := Organization{} +func (db database) GetWorkspaceByName(name string) Workspace { + ms := Workspace{} - db.db.Model(&Organization{}).Where("name = ?", name).Find(&ms) + db.db.Model(&Workspace{}).Where("name = ?", name).Find(&ms) return ms } -func (db database) CreateOrEditWorkspace(m Organization) (Organization, error) { +func (db database) CreateOrEditWorkspace(m Workspace) (Workspace, error) { if m.OwnerPubKey == "" { - return Organization{}, errors.New("no pub key") + return Workspace{}, errors.New("no pub key") } if db.db.Model(&m).Where("uuid = ?", m.Uuid).Updates(&m).RowsAffected == 0 { @@ -52,41 +52,41 @@ func (db database) CreateOrEditWorkspace(m Organization) (Organization, error) { return m, nil } -func (db database) GetWorkspaceUsers(uuid string) ([]OrganizationUsersData, error) { - ms := []OrganizationUsersData{} +func (db database) GetWorkspaceUsers(uuid string) ([]WorkspaceUsersData, error) { + ms := []WorkspaceUsersData{} - err := db.db.Raw(`SELECT org.org_uuid, org.created as user_created, person.* FROM public.organization_users AS org LEFT OUTER JOIN public.people AS person ON org.owner_pub_key = person.owner_pub_key WHERE org.org_uuid = '` + uuid + `' ORDER BY org.created DESC`).Find(&ms).Error + err := db.db.Raw(`SELECT org.workspace_uuid, org.created as user_created, person.* FROM public.Workspace_users AS org LEFT OUTER JOIN public.people AS person ON org.owner_pub_key = person.owner_pub_key WHERE org.workspace_uuid = '` + uuid + `' ORDER BY org.created DESC`).Find(&ms).Error return ms, err } func (db database) GetWorkspaceUsersCount(uuid string) int64 { var count int64 - db.db.Model(&OrganizationUsers{}).Where("org_uuid = ?", uuid).Count(&count) + db.db.Model(&WorkspaceUsers{}).Where("workspace_uuid = ?", uuid).Count(&count) return count } func (db database) GetWorkspaceBountyCount(uuid string) int64 { var count int64 - db.db.Model(&Bounty{}).Where("org_uuid = ?", uuid).Count(&count) + db.db.Model(&Bounty{}).Where("workspace_uuid = ?", uuid).Count(&count) return count } -func (db database) GetWorkspaceUser(pubkey string, org_uuid string) OrganizationUsers { - ms := OrganizationUsers{} - db.db.Where("org_uuid = ?", org_uuid).Where("owner_pub_key = ?", pubkey).Find(&ms) +func (db database) GetWorkspaceUser(pubkey string, workspace_uuid string) WorkspaceUsers { + ms := WorkspaceUsers{} + db.db.Where("workspace_uuid = ?", workspace_uuid).Where("owner_pub_key = ?", pubkey).Find(&ms) return ms } -func (db database) CreateWorkspaceUser(orgUser OrganizationUsers) OrganizationUsers { +func (db database) CreateWorkspaceUser(orgUser WorkspaceUsers) WorkspaceUsers { db.db.Create(&orgUser) return orgUser } -func (db database) DeleteWorkspaceUser(orgUser OrganizationUsersData, org string) OrganizationUsersData { - db.db.Where("owner_pub_key = ?", orgUser.OwnerPubKey).Where("org_uuid = ?", org).Delete(&OrganizationUsers{}) - db.db.Where("owner_pub_key = ?", orgUser.OwnerPubKey).Where("org_uuid = ?", org).Delete(&UserRoles{}) +func (db database) DeleteWorkspaceUser(orgUser WorkspaceUsersData, org string) WorkspaceUsersData { + db.db.Where("owner_pub_key = ?", orgUser.OwnerPubKey).Where("workspace_uuid = ?", org).Delete(&WorkspaceUsers{}) + db.db.Where("owner_pub_key = ?", orgUser.OwnerPubKey).Where("workspace_uuid = ?", org).Delete(&UserRoles{}) return orgUser } @@ -96,28 +96,28 @@ func (db database) GetBountyRoles() []BountyRoles { return ms } -func (db database) CreateUserRoles(roles []UserRoles, uuid string, pubkey string) []UserRoles { +func (db database) CreateUserRoles(roles []WorkspaceUserRoles, uuid string, pubkey string) []WorkspaceUserRoles { // delete roles and create new ones - db.db.Where("org_uuid = ?", uuid).Where("owner_pub_key = ?", pubkey).Delete(&UserRoles{}) + db.db.Where("workspace_uuid = ?", uuid).Where("owner_pub_key = ?", pubkey).Delete(&WorkspaceUserRoles{}) db.db.Create(&roles) return roles } -func (db database) GetUserRoles(uuid string, pubkey string) []UserRoles { - ms := []UserRoles{} - db.db.Where("org_uuid = ?", uuid).Where("owner_pub_key = ?", pubkey).Find(&ms) +func (db database) GetUserRoles(uuid string, pubkey string) []WorkspaceUserRoles { + ms := []WorkspaceUserRoles{} + db.db.Where("workspace_uuid = ?", uuid).Where("owner_pub_key = ?", pubkey).Find(&ms) return ms } -func (db database) GetUserCreatedWorkspaces(pubkey string) []Organization { - ms := []Organization{} +func (db database) GetUserCreatedWorkspaces(pubkey string) []Workspace { + ms := []Workspace{} db.db.Where("owner_pub_key = ?", pubkey).Where("deleted != ?", true).Find(&ms) return ms } -func (db database) GetUserAssignedWorkspaces(pubkey string) []OrganizationUsers { - ms := []OrganizationUsers{} +func (db database) GetUserAssignedWorkspaces(pubkey string) []WorkspaceUsers { + ms := []WorkspaceUsers{} db.db.Where("owner_pub_key = ?", pubkey).Find(&ms) return ms } @@ -127,34 +127,34 @@ func (db database) AddBudgetHistory(budget BudgetHistory) BudgetHistory { return budget } -func (db database) CreateWorkspaceBudget(budget BountyBudget) BountyBudget { +func (db database) CreateWorkspaceBudget(budget NewBountyBudget) NewBountyBudget { db.db.Create(&budget) return budget } -func (db database) UpdateWorkspaceBudget(budget BountyBudget) BountyBudget { - db.db.Model(&BountyBudget{}).Where("org_uuid = ?", budget.OrgUuid).Updates(map[string]interface{}{ +func (db database) UpdateWorkspaceBudget(budget NewBountyBudget) NewBountyBudget { + db.db.Model(&NewBountyBudget{}).Where("workspace_uuid = ?", budget.OrgUuid).Updates(map[string]interface{}{ "total_budget": budget.TotalBudget, }) return budget } -func (db database) GetPaymentHistoryByCreated(created *time.Time, org_uuid string) PaymentHistory { - ms := PaymentHistory{} - db.db.Where("created = ?", created).Where("org_uuid = ? ", org_uuid).Find(&ms) +func (db database) GetPaymentHistoryByCreated(created *time.Time, workspace_uuid string) NewPaymentHistory { + ms := NewPaymentHistory{} + db.db.Where("created = ?", created).Where("workspace_uuid = ? ", workspace_uuid).Find(&ms) return ms } -func (db database) GetWorkspaceBudget(org_uuid string) BountyBudget { - ms := BountyBudget{} - db.db.Where("org_uuid = ?", org_uuid).Find(&ms) +func (db database) GetWorkspaceBudget(workspace_uuid string) NewBountyBudget { + ms := NewBountyBudget{} + db.db.Where("workspace_uuid = ?", workspace_uuid).Find(&ms) return ms } -func (db database) GetWorkspaceStatusBudget(org_uuid string) StatusBudget { +func (db database) GetWorkspaceStatusBudget(workspace_uuid string) StatusBudget { - orgBudget := db.GetWorkspaceBudget(org_uuid) + orgBudget := db.GetWorkspaceBudget(workspace_uuid) var openBudget uint db.db.Model(&Bounty{}).Where("assignee = '' ").Where("paid != true").Select("SUM(price)").Row().Scan(&openBudget) @@ -175,7 +175,8 @@ func (db database) GetWorkspaceStatusBudget(org_uuid string) StatusBudget { db.db.Model(&Bounty{}).Where("completed = true ").Where("paid != true").Count(&completedCount) statusBudget := StatusBudget{ - OrgUuid: org_uuid, + OrgUuid: workspace_uuid, + WorkspaceUuid: workspace_uuid, CurrentBudget: orgBudget.TotalBudget, OpenBudget: openBudget, OpenCount: openCount, @@ -188,59 +189,59 @@ func (db database) GetWorkspaceStatusBudget(org_uuid string) StatusBudget { return statusBudget } -func (db database) GetWorkspaceBudgetHistory(org_uuid string) []BudgetHistoryData { +func (db database) GetWorkspaceBudgetHistory(workspace_uuid string) []BudgetHistoryData { budgetHistory := []BudgetHistoryData{} - db.db.Raw(`SELECT budget.id, budget.org_uuid, budget.amount, budget.created, budget.updated, budget.payment_type, budget.status, budget.sender_pub_key, sender.unique_name AS sender_name FROM public.budget_histories AS budget LEFT OUTER JOIN public.people AS sender ON budget.sender_pub_key = sender.owner_pub_key WHERE budget.org_uuid = '` + org_uuid + `' ORDER BY budget.created DESC`).Find(&budgetHistory) + db.db.Raw(`SELECT budget.id, budget.workspace_uuid, budget.amount, budget.created, budget.updated, budget.payment_type, budget.status, budget.sender_pub_key, sender.unique_name AS sender_name FROM public.budget_histories AS budget LEFT OUTER JOIN public.people AS sender ON budget.sender_pub_key = sender.owner_pub_key WHERE budget.workspace_uuid = '` + workspace_uuid + `' ORDER BY budget.created DESC`).Find(&budgetHistory) return budgetHistory } -func (db database) AddAndUpdateBudget(invoice InvoiceList) PaymentHistory { +func (db database) AddAndUpdateBudget(invoice NewInvoiceList) NewPaymentHistory { created := invoice.Created - org_uuid := invoice.OrgUuid + workspace_uuid := invoice.WorkspaceUuid - paymentHistory := db.GetPaymentHistoryByCreated(created, org_uuid) + paymentHistory := db.GetPaymentHistoryByCreated(created, workspace_uuid) - if paymentHistory.OrgUuid != "" && paymentHistory.Amount != 0 { + if paymentHistory.WorkspaceUuid != "" && paymentHistory.Amount != 0 { paymentHistory.Status = true - db.db.Where("created = ?", created).Where("org_uuid = ? ", org_uuid).Updates(paymentHistory) + db.db.Where("created = ?", created).Where("workspace_uuid = ? ", workspace_uuid).Updates(paymentHistory) - // get organization budget and add payment to total budget - organizationBudget := db.GetWorkspaceBudget(org_uuid) + // get Workspace budget and add payment to total budget + WorkspaceBudget := db.GetWorkspaceBudget(workspace_uuid) - if organizationBudget.OrgUuid == "" { + if WorkspaceBudget.OrgUuid == "" { now := time.Now() - orgBudget := BountyBudget{ - OrgUuid: org_uuid, - TotalBudget: paymentHistory.Amount, - Created: &now, - Updated: &now, + orgBudget := NewBountyBudget{ + WorkspaceUuid: workspace_uuid, + TotalBudget: paymentHistory.Amount, + Created: &now, + Updated: &now, } db.CreateWorkspaceBudget(orgBudget) } else { - totalBudget := organizationBudget.TotalBudget - organizationBudget.TotalBudget = totalBudget + paymentHistory.Amount - db.UpdateWorkspaceBudget(organizationBudget) + totalBudget := WorkspaceBudget.TotalBudget + WorkspaceBudget.TotalBudget = totalBudget + paymentHistory.Amount + db.UpdateWorkspaceBudget(WorkspaceBudget) } } return paymentHistory } -func (db database) WithdrawBudget(sender_pubkey string, org_uuid string, amount uint) { - // get organization budget and add payment to total budget - organizationBudget := db.GetWorkspaceBudget(org_uuid) - totalBudget := organizationBudget.TotalBudget +func (db database) WithdrawBudget(sender_pubkey string, workspace_uuid string, amount uint) { + // get Workspace budget and add payment to total budget + WorkspaceBudget := db.GetWorkspaceBudget(workspace_uuid) + totalBudget := WorkspaceBudget.TotalBudget newBudget := totalBudget - amount - db.db.Model(&BountyBudget{}).Where("org_uuid = ?", org_uuid).Updates(map[string]interface{}{ + db.db.Model(&NewBountyBudget{}).Where("workspace_uuid = ?", workspace_uuid).Updates(map[string]interface{}{ "total_budget": newBudget, }) now := time.Now() - budgetHistory := PaymentHistory{ - OrgUuid: org_uuid, + budgetHistory := NewPaymentHistory{ + WorkspaceUuid: workspace_uuid, Amount: amount, Status: true, PaymentType: "withdraw", @@ -253,54 +254,54 @@ func (db database) WithdrawBudget(sender_pubkey string, org_uuid string, amount db.AddPaymentHistory(budgetHistory) } -func (db database) AddPaymentHistory(payment PaymentHistory) PaymentHistory { +func (db database) AddPaymentHistory(payment NewPaymentHistory) NewPaymentHistory { db.db.Create(&payment) - // get organization budget and subtract payment from total budget - organizationBudget := db.GetWorkspaceBudget(payment.OrgUuid) - totalBudget := organizationBudget.TotalBudget + // get Workspace budget and subtract payment from total budget + WorkspaceBudget := db.GetWorkspaceBudget(payment.OrgUuid) + totalBudget := WorkspaceBudget.TotalBudget // deduct amount if it's a bounty payment if payment.PaymentType == "payment" { - organizationBudget.TotalBudget = totalBudget - payment.Amount + WorkspaceBudget.TotalBudget = totalBudget - payment.Amount } - db.UpdateWorkspaceBudget(organizationBudget) + db.UpdateWorkspaceBudget(WorkspaceBudget) return payment } -func (db database) GetPaymentHistory(org_uuid string, r *http.Request) []PaymentHistory { - payment := []PaymentHistory{} +func (db database) GetPaymentHistory(workspace_uuid string, r *http.Request) []NewPaymentHistory { + payment := []NewPaymentHistory{} offset, limit, _, _, _ := utils.GetPaginationParams(r) limitQuery := "" limitQuery = fmt.Sprintf("LIMIT %d OFFSET %d", limit, offset) - query := `SELECT * FROM payment_histories WHERE org_uuid = '` + org_uuid + `' AND status = true ORDER BY created DESC` + query := `SELECT * FROM payment_histories WHERE workspace_uuid = '` + workspace_uuid + `' AND status = true ORDER BY created DESC` db.db.Raw(query + " " + limitQuery).Find(&payment) return payment } -func (db database) GetWorkspaceInvoices(org_uuid string) []InvoiceList { - ms := []InvoiceList{} - db.db.Where("org_uuid = ?", org_uuid).Where("status", false).Find(&ms) +func (db database) GetWorkspaceInvoices(workspace_uuid string) []NewInvoiceList { + ms := []NewInvoiceList{} + db.db.Where("workspace_uuid = ?", workspace_uuid).Where("status", false).Find(&ms) return ms } -func (db database) GetWorkspaceInvoicesCount(org_uuid string) int64 { +func (db database) GetWorkspaceInvoicesCount(workspace_uuid string) int64 { var count int64 - ms := InvoiceList{} + ms := NewInvoiceList{} - db.db.Model(&ms).Where("org_uuid = ?", org_uuid).Where("status", false).Count(&count) + db.db.Model(&ms).Where("workspace_uuid = ?", workspace_uuid).Where("status", false).Count(&count) return count } -func (db database) ChangeWorkspaceDeleteStatus(org_uuid string, status bool) Organization { - ms := Organization{} - db.db.Model(&ms).Where("uuid", org_uuid).Updates(map[string]interface{}{ +func (db database) ChangeWorkspaceDeleteStatus(workspace_uuid string, status bool) Workspace { + ms := Workspace{} + db.db.Model(&ms).Where("uuid", workspace_uuid).Updates(map[string]interface{}{ "deleted": status, }) return ms @@ -314,7 +315,7 @@ func (db database) UpdateWorkspaceForDeletion(uuid string) error { "show": false, } - result := db.db.Model(&Organization{}).Where("uuid = ?", uuid).Updates(updates) + result := db.db.Model(&Workspace{}).Where("uuid = ?", uuid).Updates(updates) if result.Error != nil { return result.Error } @@ -327,14 +328,14 @@ func (db database) DeleteAllUsersFromWorkspace(org string) error { return errors.New("no org uuid provided") } - // Delete all users associated with the organization - result := db.db.Where("org_uuid = ?", org).Delete(&OrganizationUsers{}) + // Delete all users associated with the Workspace + result := db.db.Where("workspace_uuid = ?", org).Delete(&WorkspaceUsers{}) if result.Error != nil { return result.Error } - // Delete all user roles associated with the organization - result = db.db.Where("org_uuid = ?", org).Delete(&UserRoles{}) + // Delete all user roles associated with the Workspace + result = db.db.Where("workspace_uuid = ?", org).Delete(&UserRoles{}) if result.Error != nil { return result.Error } diff --git a/handlers/bounty.go b/handlers/bounty.go index d3f9e58fa..1e8caedb6 100644 --- a/handlers/bounty.go +++ b/handlers/bounty.go @@ -23,7 +23,7 @@ type bountyHandler struct { httpClient HttpClient db db.Database getSocketConnections func(host string) (db.Client, error) - generateBountyResponse func(bounties []db.Bounty) []db.BountyResponse + generateBountyResponse func(bounties []db.NewBounty) []db.BountyResponse userHasAccess func(pubKeyFromAuth string, uuid string, role string) bool userHasManageBountyRoles func(pubKeyFromAuth string, uuid string) bool } @@ -182,7 +182,7 @@ func (h *bountyHandler) CreateOrEditBounty(w http.ResponseWriter, r *http.Reques ctx := r.Context() pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) - bounty := db.Bounty{} + bounty := db.NewBounty{} body, err := io.ReadAll(r.Body) r.Body.Close() @@ -195,6 +195,10 @@ func (h *bountyHandler) CreateOrEditBounty(w http.ResponseWriter, r *http.Reques now := time.Now() + if bounty.WorkspaceUuid == "" && bounty.OrgUuid != "" { + bounty.WorkspaceUuid = bounty.OrgUuid + } + //Check if bounty exists bounty.Updated = &now @@ -244,8 +248,8 @@ func (h *bountyHandler) CreateOrEditBounty(w http.ResponseWriter, r *http.Reques // trying to update // check if bounty belongs to user if pubKeyFromAuth != dbBounty.OwnerID { - if bounty.OrgUuid != "" { - hasBountyRoles := h.userHasManageBountyRoles(pubKeyFromAuth, bounty.OrgUuid) + if bounty.WorkspaceUuid != "" { + hasBountyRoles := h.userHasManageBountyRoles(pubKeyFromAuth, bounty.WorkspaceUuid) if !hasBountyRoles { msg := "You don't have a=the right permission ton update bounty" fmt.Println(msg) @@ -351,7 +355,7 @@ func UpdateCompletedStatus(w http.ResponseWriter, r *http.Request) { json.NewEncoder(w).Encode(bounty) } -func (h *bountyHandler) GenerateBountyResponse(bounties []db.Bounty) []db.BountyResponse { +func (h *bountyHandler) GenerateBountyResponse(bounties []db.NewBounty) []db.BountyResponse { var bountyResponse []db.BountyResponse for i := 0; i < len(bounties); i++ { @@ -359,10 +363,10 @@ func (h *bountyHandler) GenerateBountyResponse(bounties []db.Bounty) []db.Bounty owner := h.db.GetPersonByPubkey(bounty.OwnerID) assignee := h.db.GetPersonByPubkey(bounty.Assignee) - organization := h.db.GetWorkspaceByUuid(bounty.OrgUuid) + workspace := h.db.GetWorkspaceByUuid(bounty.WorkspaceUuid) b := db.BountyResponse{ - Bounty: db.Bounty{ + Bounty: db.NewBounty{ ID: bounty.ID, OwnerID: bounty.OwnerID, Paid: bounty.Paid, @@ -385,7 +389,8 @@ func (h *bountyHandler) GenerateBountyResponse(bounties []db.Bounty) []db.Bounty OneSentenceSummary: bounty.OneSentenceSummary, EstimatedSessionLength: bounty.EstimatedSessionLength, EstimatedCompletionDate: bounty.EstimatedCompletionDate, - OrgUuid: bounty.OrgUuid, + OrgUuid: bounty.WorkspaceUuid, + WorkspaceUuid: bounty.WorkspaceUuid, Updated: bounty.Updated, CodingLanguages: bounty.CodingLanguages, Completed: bounty.Completed, @@ -424,10 +429,15 @@ func (h *bountyHandler) GenerateBountyResponse(bounties []db.Bounty) []db.Bounty PriceToMeet: owner.PriceToMeet, TwitterConfirmed: owner.TwitterConfirmed, }, - Organization: db.OrganizationShort{ - Name: organization.Name, - Uuid: organization.Uuid, - Img: organization.Img, + Organization: db.WorkspaceShort{ + Name: workspace.Name, + Uuid: workspace.Uuid, + Img: workspace.Img, + }, + Workspace: db.WorkspaceShort{ + Name: workspace.Name, + Uuid: workspace.Uuid, + Img: workspace.Img, }, } bountyResponse = append(bountyResponse, b) @@ -460,6 +470,10 @@ func (h *bountyHandler) MakeBountyPayment(w http.ResponseWriter, r *http.Request bounty := h.db.GetBounty(id) amount := bounty.Price + if bounty.WorkspaceUuid == "" && bounty.OrgUuid != "" { + bounty.WorkspaceUuid = bounty.OrgUuid + } + if bounty.ID != id { w.WriteHeader(http.StatusNotFound) return @@ -472,21 +486,21 @@ func (h *bountyHandler) MakeBountyPayment(w http.ResponseWriter, r *http.Request return } - // check if user is the admin of the organization + // check if user is the admin of the workspace // or has a pay bounty role - hasRole := h.userHasAccess(pubKeyFromAuth, bounty.OrgUuid, db.PayBounty) + hasRole := h.userHasAccess(pubKeyFromAuth, bounty.WorkspaceUuid, db.PayBounty) if !hasRole { w.WriteHeader(http.StatusUnauthorized) json.NewEncoder(w).Encode("You don't have appropriate permissions to pay bounties") return } - // check if the organization bounty balance + // check if the workspace bounty balance // is greater than the amount - orgBudget := h.db.GetWorkspaceBudget(bounty.OrgUuid) + orgBudget := h.db.GetWorkspaceBudget(bounty.WorkspaceUuid) if orgBudget.TotalBudget < amount { w.WriteHeader(http.StatusForbidden) - json.NewEncoder(w).Encode("organization budget is not enough to pay the amount") + json.NewEncoder(w).Encode("workspace budget is not enough to pay the amount") return } @@ -530,11 +544,11 @@ func (h *bountyHandler) MakeBountyPayment(w http.ResponseWriter, r *http.Request err = json.Unmarshal(body, &keysendRes) now := time.Now() - paymentHistory := db.PaymentHistory{ + paymentHistory := db.NewPaymentHistory{ Amount: amount, SenderPubKey: pubKeyFromAuth, ReceiverPubKey: assignee.OwnerPubKey, - OrgUuid: bounty.OrgUuid, + WorkspaceUuid: bounty.WorkspaceUuid, BountyId: id, Created: &now, Updated: &now, @@ -592,7 +606,7 @@ func (h *bountyHandler) BountyBudgetWithdraw(w http.ResponseWriter, r *http.Requ return } - // check if user is the admin of the organization + // check if user is the admin of the workspace // or has a withdraw bounty budget role hasRole := h.userHasAccess(pubKeyFromAuth, request.OrgUuid, db.WithdrawBudget) if !hasRole { @@ -605,7 +619,7 @@ func (h *bountyHandler) BountyBudgetWithdraw(w http.ResponseWriter, r *http.Requ amount := utils.GetInvoiceAmount(request.PaymentRequest) if err == nil && amount > 0 { - // check if the organization bounty balance + // check if the workspace bounty balance // is greater than the amount orgBudget := h.db.GetWorkspaceBudget(request.OrgUuid) if amount > orgBudget.TotalBudget { @@ -616,7 +630,7 @@ func (h *bountyHandler) BountyBudgetWithdraw(w http.ResponseWriter, r *http.Requ } paymentSuccess, paymentError := h.PayLightningInvoice(request.PaymentRequest) if paymentSuccess.Success { - // withdraw amount from organization budget + // withdraw amount from workspace budget h.db.WithdrawBudget(pubKeyFromAuth, request.OrgUuid, amount) w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(paymentSuccess) @@ -633,6 +647,71 @@ func (h *bountyHandler) BountyBudgetWithdraw(w http.ResponseWriter, r *http.Requ m.Unlock() } +// Todo: change back to NewBountyBudgetWithdraw +func (h *bountyHandler) NewBountyBudgetWithdraw(w http.ResponseWriter, r *http.Request) { + var m sync.Mutex + m.Lock() + + ctx := r.Context() + pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) + + if pubKeyFromAuth == "" { + fmt.Println("no pubkey from auth") + w.WriteHeader(http.StatusUnauthorized) + return + } + + request := db.NewWithdrawBudgetRequest{} + body, err := io.ReadAll(r.Body) + r.Body.Close() + + err = json.Unmarshal(body, &request) + if err != nil { + w.WriteHeader(http.StatusNotAcceptable) + return + } + + // check if user is the admin of the workspace + // or has a withdraw bounty budget role + hasRole := h.userHasAccess(pubKeyFromAuth, request.WorkspaceUuid, db.WithdrawBudget) + if !hasRole { + w.WriteHeader(http.StatusUnauthorized) + errMsg := formatPayError("You don't have appropriate permissions to withdraw bounty budget") + json.NewEncoder(w).Encode(errMsg) + return + } + + amount := utils.GetInvoiceAmount(request.PaymentRequest) + + if err == nil && amount > 0 { + // check if the workspace bounty balance + // is greater than the amount + orgBudget := h.db.GetWorkspaceBudget(request.WorkspaceUuid) + if amount > orgBudget.TotalBudget { + w.WriteHeader(http.StatusForbidden) + errMsg := formatPayError("Workspace budget is not enough to withdraw the amount") + json.NewEncoder(w).Encode(errMsg) + return + } + paymentSuccess, paymentError := h.PayLightningInvoice(request.PaymentRequest) + if paymentSuccess.Success { + // withdraw amount from workspace budget + h.db.WithdrawBudget(pubKeyFromAuth, request.WorkspaceUuid, amount) + w.WriteHeader(http.StatusOK) + json.NewEncoder(w).Encode(paymentSuccess) + } else { + w.WriteHeader(http.StatusBadRequest) + json.NewEncoder(w).Encode(paymentError) + } + } else { + w.WriteHeader(http.StatusForbidden) + errMsg := formatPayError("Could not pay lightning invoice") + json.NewEncoder(w).Encode(errMsg) + } + + m.Unlock() +} + func formatPayError(errorMsg string) db.InvoicePayError { return db.InvoicePayError{ Success: false, diff --git a/handlers/bounty_test.go b/handlers/bounty_test.go index 21432500a..bfed8dc93 100644 --- a/handlers/bounty_test.go +++ b/handlers/bounty_test.go @@ -106,15 +106,15 @@ func TestCreateOrEditBounty(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.CreateOrEditBounty) - existingBounty := db.Bounty{ - ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - Assignee: "user1", - } - mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.Bounty"), "show").Return(existingBounty) + existingBounty := db.NewBounty{ + ID: 1, + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + WorkspaceUuid: "work-1", + Assignee: "user1", + } + mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.NewBounty"), "show").Return(existingBounty) mockDb.On("GetBounty", uint(1)).Return(existingBounty).Once() body := []byte(`{"id": 1, "type": "bounty_type", "title": "first bounty", "description": "my first bounty", "tribe": "random-value", "assignee": "john-doe", "owner_id": "second-user"}`) @@ -135,18 +135,18 @@ func TestCreateOrEditBounty(t *testing.T) { handler := http.HandlerFunc(bHandler.CreateOrEditBounty) bHandler.userHasManageBountyRoles = mockUserHasManageBountyRolesFalse - existingBounty := db.Bounty{ - ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - OwnerID: "second-user", + existingBounty := db.NewBounty{ + ID: 1, + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + WorkspaceUuid: "work-1", + OwnerID: "second-user", } updatedBounty := existingBounty updatedBounty.Title = "first bounty updated" - mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.Bounty"), "show").Return(existingBounty) - mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.Bounty"), "assignee").Return(existingBounty) + mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.NewBounty"), "show").Return(existingBounty) + mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.NewBounty"), "assignee").Return(existingBounty) mockDb.On("GetBounty", uint(1)).Return(existingBounty).Once() body, _ := json.Marshal(updatedBounty) @@ -165,20 +165,20 @@ func TestCreateOrEditBounty(t *testing.T) { handler := http.HandlerFunc(bHandler.CreateOrEditBounty) bHandler.userHasManageBountyRoles = mockUserHasManageBountyRolesTrue - existingBounty := db.Bounty{ - ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - OwnerID: "second-user", + existingBounty := db.NewBounty{ + ID: 1, + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + WorkspaceUuid: "work-1", + OwnerID: "second-user", } updatedBounty := existingBounty updatedBounty.Title = "first bounty updated" - mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.Bounty"), "show").Return(existingBounty) - mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.Bounty"), "assignee").Return(existingBounty) + mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.NewBounty"), "show").Return(existingBounty) + mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.NewBounty"), "assignee").Return(existingBounty) mockDb.On("GetBounty", uint(1)).Return(existingBounty).Once() - mockDb.On("CreateOrEditBounty", mock.AnythingOfType("db.Bounty")).Return(updatedBounty, nil).Once() + mockDb.On("CreateOrEditBounty", mock.AnythingOfType("db.NewBounty")).Return(updatedBounty, nil).Once() body, _ := json.Marshal(updatedBounty) req, err := http.NewRequestWithContext(ctx, http.MethodPost, "/", bytes.NewReader(body)) @@ -198,21 +198,21 @@ func TestCreateOrEditBounty(t *testing.T) { bHandler.userHasManageBountyRoles = mockUserHasManageBountyRolesTrue now := time.Now().UnixMilli() - existingBounty := db.Bounty{ - ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - OwnerID: "second-user", - Created: now, + existingBounty := db.NewBounty{ + ID: 1, + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + WorkspaceUuid: "work-1", + OwnerID: "second-user", + Created: now, } updatedBounty := existingBounty updatedBounty.Title = "first bounty updated" - mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.Bounty"), "show").Return(existingBounty) - mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.Bounty"), "assignee").Return(existingBounty) + mockDb.On("UpdateBountyBoolColumn", mock.AnythingOfType("db.NewBounty"), "show").Return(existingBounty) + mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.NewBounty"), "assignee").Return(existingBounty) mockDb.On("GetBounty", uint(1)).Return(existingBounty).Once() - mockDb.On("CreateOrEditBounty", mock.MatchedBy(func(b db.Bounty) bool { + mockDb.On("CreateOrEditBounty", mock.MatchedBy(func(b db.NewBounty) bool { return b.Created == now })).Return(updatedBounty, nil).Once() @@ -231,15 +231,15 @@ func TestCreateOrEditBounty(t *testing.T) { t.Run("should return error if failed to add new bounty", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.CreateOrEditBounty) - newBounty := db.Bounty{ - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - OwnerID: "test-key", + newBounty := db.NewBounty{ + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + WorkspaceUuid: "org-1", + OwnerID: "test-key", } - mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.Bounty"), "assignee").Return(db.Bounty{Assignee: "test-key"}) - mockDb.On("CreateOrEditBounty", mock.AnythingOfType("db.Bounty")).Return(db.Bounty{}, errors.New("failed to add")).Once() + mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.NewBounty"), "assignee").Return(db.NewBounty{Assignee: "test-key"}) + mockDb.On("CreateOrEditBounty", mock.AnythingOfType("db.NewBounty")).Return(db.NewBounty{}, errors.New("failed to add")).Once() body, _ := json.Marshal(newBounty) req, err := http.NewRequestWithContext(ctx, http.MethodPost, "/", bytes.NewReader(body)) @@ -256,15 +256,16 @@ func TestCreateOrEditBounty(t *testing.T) { t.Run("add bounty if not present", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.CreateOrEditBounty) - newBounty := db.Bounty{ - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - OwnerID: "test-key", + newBounty := db.NewBounty{ + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + WorkspaceUuid: "work-1", + OrgUuid: "org-1", + OwnerID: "test-key", } - mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.Bounty"), "assignee").Return(db.Bounty{Assignee: "test-key"}) - mockDb.On("CreateOrEditBounty", mock.AnythingOfType("db.Bounty")).Return(newBounty, nil).Once() + mockDb.On("UpdateBountyNullColumn", mock.AnythingOfType("db.NewBounty"), "assignee").Return(db.Bounty{Assignee: "test-key"}) + mockDb.On("CreateOrEditBounty", mock.AnythingOfType("db.NewBounty")).Return(newBounty, nil).Once() body, _ := json.Marshal(newBounty) req, err := http.NewRequestWithContext(ctx, http.MethodPost, "/", bytes.NewReader(body)) @@ -446,7 +447,7 @@ func TestDeleteBounty(t *testing.T) { t.Run("should return error if failed to delete from db", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.DeleteBounty) - mockDb.On("DeleteBounty", "pub-key", "1111").Return(db.Bounty{}, errors.New("some-error")).Once() + mockDb.On("DeleteBounty", "pub-key", "1111").Return(db.NewBounty{}, errors.New("some-error")).Once() rctx := chi.NewRouteContext() rctx.URLParams.Add("pubkey", "pub-key") @@ -464,7 +465,7 @@ func TestDeleteBounty(t *testing.T) { t.Run("should successfully delete bounty from db", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.DeleteBounty) - existingBounty := db.Bounty{ + existingBounty := db.NewBounty{ OwnerID: "pub-key", Created: 1111, } @@ -479,7 +480,7 @@ func TestDeleteBounty(t *testing.T) { } handler.ServeHTTP(rr, req) - var returnedBounty db.Bounty + var returnedBounty db.NewBounty _ = json.Unmarshal(rr.Body.Bytes(), &returnedBounty) assert.Equal(t, http.StatusOK, rr.Code) assert.EqualValues(t, existingBounty, returnedBounty) @@ -493,7 +494,7 @@ func TestGetBountyByCreated(t *testing.T) { bHandler := NewBountyHandler(mockHttpClient, mockDb) t.Run("Should return bounty by its created value", func(t *testing.T) { - mockGenerateBountyResponse := func(bounties []db.Bounty) []db.BountyResponse { + mockGenerateBountyResponse := func(bounties []db.NewBounty) []db.BountyResponse { var bountyResponses []db.BountyResponse for _, bounty := range bounties { @@ -503,7 +504,7 @@ func TestGetBountyByCreated(t *testing.T) { assignee := db.Person{ ID: 1, } - organization := db.OrganizationShort{ + workspace := db.WorkspaceShort{ Uuid: "uuid", } @@ -511,7 +512,8 @@ func TestGetBountyByCreated(t *testing.T) { Bounty: bounty, Assignee: assignee, Owner: owner, - Organization: organization, + Organization: workspace, + Workspace: workspace, } bountyResponses = append(bountyResponses, bountyResponse) } @@ -522,25 +524,26 @@ func TestGetBountyByCreated(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.GetBountyByCreated) - bounty := db.Bounty{ - ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - Assignee: "user1", - Created: 1707991475, - OwnerID: "owner-1", + bounty := db.NewBounty{ + ID: 1, + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + OrgUuid: "org-1", + WorkspaceUuid: "work-1", + Assignee: "user1", + Created: 1707991475, + OwnerID: "owner-1", } createdStr := strconv.FormatInt(bounty.Created, 10) rctx := chi.NewRouteContext() rctx.URLParams.Add("created", "1707991475") req, _ := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/created/1707991475", nil) - mockDb.On("GetBountyDataByCreated", createdStr).Return([]db.Bounty{bounty}, nil).Once() + mockDb.On("GetBountyDataByCreated", createdStr).Return([]db.NewBounty{bounty}, nil).Once() mockDb.On("GetPersonByPubkey", "owner-1").Return(db.Person{}).Once() mockDb.On("GetPersonByPubkey", "user1").Return(db.Person{}).Once() - mockDb.On("GetWorkspaceByUuid", "org-1").Return(db.Organization{}).Once() + mockDb.On("GetWorkspaceByUuid", "work-1").Return(db.Workspace{}).Once() handler.ServeHTTP(rr, req) var returnedBounty []db.BountyResponse @@ -559,7 +562,7 @@ func TestGetBountyByCreated(t *testing.T) { rctx.URLParams.Add("created", createdStr) req, _ := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/created/"+createdStr, nil) - mockDb.On("GetBountyDataByCreated", createdStr).Return([]db.Bounty{}, nil).Once() + mockDb.On("GetBountyDataByCreated", createdStr).Return([]db.NewBounty{}, nil).Once() handler.ServeHTTP(rr, req) assert.Equal(t, http.StatusNotFound, rr.Code, "Expected 404 Not Found for nonexistent bounty") @@ -576,15 +579,16 @@ func TestGetPersonAssignedBounties(t *testing.T) { t.Run("Should successfull Get Person Assigned Bounties", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.GetPersonAssignedBounties) - bounty := db.Bounty{ - ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - Assignee: "user1", - Created: 1707991475, - OwnerID: "owner-1", + bounty := db.NewBounty{ + ID: 1, + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + OrgUuid: "org-1", + WorkspaceUuid: "work-1", + Assignee: "user1", + Created: 1707991475, + OwnerID: "owner-1", } rctx := chi.NewRouteContext() @@ -595,10 +599,10 @@ func TestGetPersonAssignedBounties(t *testing.T) { rctx.URLParams.Add("search", "") req, _ := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/people/wanteds/assigned/clu80datu2rjujsmim40?sortBy=paid&page=1&limit=20&search=", nil) - mockDb.On("GetAssignedBounties", req).Return([]db.Bounty{bounty}, nil).Once() + mockDb.On("GetAssignedBounties", req).Return([]db.NewBounty{bounty}, nil).Once() mockDb.On("GetPersonByPubkey", "owner-1").Return(db.Person{}, nil).Once() mockDb.On("GetPersonByPubkey", "user1").Return(db.Person{}, nil).Once() - mockDb.On("GetWorkspaceByUuid", "org-1").Return(db.Organization{}, nil).Once() + mockDb.On("GetWorkspaceByUuid", "work-1").Return(db.Workspace{}, nil).Once() handler.ServeHTTP(rr, req) var returnedBounty []db.BountyResponse @@ -616,7 +620,7 @@ func TestGetPersonCreatedBounties(t *testing.T) { bHandler := NewBountyHandler(mockHttpClient, mockDb) t.Run("should return bounties created by the user", func(t *testing.T) { - mockGenerateBountyResponse := func(bounties []db.Bounty) []db.BountyResponse { + mockGenerateBountyResponse := func(bounties []db.NewBounty) []db.BountyResponse { var bountyResponses []db.BountyResponse for _, bounty := range bounties { @@ -626,7 +630,7 @@ func TestGetPersonCreatedBounties(t *testing.T) { assignee := db.Person{ ID: 1, } - organization := db.OrganizationShort{ + workspace := db.WorkspaceShort{ Uuid: "uuid", } @@ -634,7 +638,8 @@ func TestGetPersonCreatedBounties(t *testing.T) { Bounty: bounty, Assignee: assignee, Owner: owner, - Organization: organization, + Organization: workspace, + Workspace: workspace, } bountyResponses = append(bountyResponses, bountyResponse) } @@ -643,14 +648,14 @@ func TestGetPersonCreatedBounties(t *testing.T) { } bHandler.generateBountyResponse = mockGenerateBountyResponse - expectedBounties := []db.Bounty{ + expectedBounties := []db.NewBounty{ {ID: 1, OwnerID: "user1"}, {ID: 2, OwnerID: "user1"}, } mockDb.On("GetCreatedBounties", mock.Anything).Return(expectedBounties, nil).Once() mockDb.On("GetPersonByPubkey", mock.Anything).Return(db.Person{}, nil) - mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Organization{}, nil) + mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Workspace{}, nil) rr := httptest.NewRecorder() req, err := http.NewRequest("GET", "/people/wanteds/created/uuid", nil) req = req.WithContext(ctx) @@ -678,12 +683,12 @@ func TestGetPersonCreatedBounties(t *testing.T) { }) t.Run("should not return bounties created by other users", func(t *testing.T) { - mockGenerateBountyResponse := func(bounties []db.Bounty) []db.BountyResponse { + mockGenerateBountyResponse := func(bounties []db.NewBounty) []db.BountyResponse { return []db.BountyResponse{} } bHandler.generateBountyResponse = mockGenerateBountyResponse - mockDb.On("GetCreatedBounties", mock.Anything).Return([]db.Bounty{}, nil).Once() + mockDb.On("GetCreatedBounties", mock.Anything).Return([]db.NewBounty{}, nil).Once() rr := httptest.NewRecorder() req, err := http.NewRequest("GET", "/people/wanteds/created/uuid", nil) @@ -707,7 +712,7 @@ func TestGetPersonCreatedBounties(t *testing.T) { }) t.Run("should filter bounties by status and apply pagination", func(t *testing.T) { - mockGenerateBountyResponse := func(bounties []db.Bounty) []db.BountyResponse { + mockGenerateBountyResponse := func(bounties []db.NewBounty) []db.BountyResponse { var bountyResponses []db.BountyResponse for _, bounty := range bounties { @@ -717,7 +722,7 @@ func TestGetPersonCreatedBounties(t *testing.T) { assignee := db.Person{ ID: 1, } - organization := db.OrganizationShort{ + workspace := db.WorkspaceShort{ Uuid: "uuid", } @@ -725,7 +730,8 @@ func TestGetPersonCreatedBounties(t *testing.T) { Bounty: bounty, Assignee: assignee, Owner: owner, - Organization: organization, + Organization: workspace, + Workspace: workspace, } bountyResponses = append(bountyResponses, bountyResponse) } @@ -734,7 +740,7 @@ func TestGetPersonCreatedBounties(t *testing.T) { } bHandler.generateBountyResponse = mockGenerateBountyResponse - expectedBounties := []db.Bounty{ + expectedBounties := []db.NewBounty{ {ID: 1, OwnerID: "user1", Assignee: "assignee1"}, {ID: 2, OwnerID: "user1", Assignee: "assignee2", Paid: true}, {ID: 3, OwnerID: "user1", Assignee: "", Paid: true}, @@ -742,7 +748,7 @@ func TestGetPersonCreatedBounties(t *testing.T) { mockDb.On("GetCreatedBounties", mock.Anything).Return(expectedBounties, nil).Once() mockDb.On("GetPersonByPubkey", mock.Anything).Return(db.Person{}, nil) - mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Organization{}, nil) + mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Workspace{}, nil) rr := httptest.NewRecorder() req, err := http.NewRequest("GET", "/people/wanteds/created/uuid?Open=true&Assigned=true&Paid=true&offset=0&limit=2", nil) @@ -816,7 +822,7 @@ func TestGetWorkspaceNextBountyByCreated(t *testing.T) { mockHttpClient := mocks.NewHttpClient(t) bHandler := NewBountyHandler(mockHttpClient, mockDb) - t.Run("Should test that the next bounty on the organization bounties homepage can be gotten by its created value and the selected filters", func(t *testing.T) { + t.Run("Should test that the next bounty on the workspace bounties homepage can be gotten by its created value and the selected filters", func(t *testing.T) { mockDb.On("GetNextWorkspaceBountyByCreated", mock.AnythingOfType("*http.Request")).Return(uint(1), nil).Once() rr := httptest.NewRecorder() @@ -835,7 +841,7 @@ func TestGetWorkspacePreviousBountyByCreated(t *testing.T) { mockHttpClient := mocks.NewHttpClient(t) bHandler := NewBountyHandler(mockHttpClient, mockDb) - t.Run("Should test that the previous bounty on the organization bounties homepage can be gotten by its created value and the selected filters", func(t *testing.T) { + t.Run("Should test that the previous bounty on the workspace bounties homepage can be gotten by its created value and the selected filters", func(t *testing.T) { mockDb.On("GetPreviousWorkspaceBountyByCreated", mock.AnythingOfType("*http.Request")).Return(uint(1), nil).Once() rr := httptest.NewRecorder() @@ -859,7 +865,7 @@ func TestGetBountyById(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.GetBountyById) - bounty := db.Bounty{ + bounty := db.NewBounty{ ID: 1, OwnerID: "owner123", Paid: false, @@ -875,6 +881,7 @@ func TestGetBountyById(t *testing.T) { Assignee: "user1", TicketUrl: "http://example.com/issues/1", OrgUuid: "org-789", + WorkspaceUuid: "work-789", Description: "This bounty is for fixing a critical bug in the payment system that causes transactions to fail under certain conditions.", WantedType: "immediate", Deliverables: "A pull request with a fix, including tests", @@ -896,10 +903,10 @@ func TestGetBountyById(t *testing.T) { req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/bounty/1", nil) assert.NoError(t, err) - mockDb.On("GetBountyById", mock.Anything).Return([]db.Bounty{bounty}, nil).Once() + mockDb.On("GetBountyById", mock.Anything).Return([]db.NewBounty{bounty}, nil).Once() mockDb.On("GetPersonByPubkey", "owner123").Return(db.Person{}).Once() mockDb.On("GetPersonByPubkey", "user1").Return(db.Person{}).Once() - mockDb.On("GetWorkspaceByUuid", "org-789").Return(db.Organization{}).Once() + mockDb.On("GetWorkspaceByUuid", "work-789").Return(db.Workspace{}).Once() handler.ServeHTTP(rr, req) @@ -933,7 +940,7 @@ func GetPersonAssigned(t *testing.T) { mockHttpClient := mocks.NewHttpClient(t) bHandler := NewBountyHandler(mockHttpClient, mockDb) t.Run("should return bounties assigned to the user", func(t *testing.T) { - mockGenerateBountyResponse := func(bounties []db.Bounty) []db.BountyResponse { + mockGenerateBountyResponse := func(bounties []db.NewBounty) []db.BountyResponse { var bountyResponses []db.BountyResponse for _, bounty := range bounties { @@ -943,7 +950,7 @@ func GetPersonAssigned(t *testing.T) { assignee := db.Person{ ID: 1, } - organization := db.OrganizationShort{ + workspace := db.WorkspaceShort{ Uuid: "uuid", } @@ -951,7 +958,8 @@ func GetPersonAssigned(t *testing.T) { Bounty: bounty, Assignee: assignee, Owner: owner, - Organization: organization, + Organization: workspace, + Workspace: workspace, } bountyResponses = append(bountyResponses, bountyResponse) } @@ -960,7 +968,7 @@ func GetPersonAssigned(t *testing.T) { } bHandler.generateBountyResponse = mockGenerateBountyResponse - expectedBounties := []db.Bounty{ + expectedBounties := []db.NewBounty{ {ID: 1, Assignee: "user1"}, {ID: 2, Assignee: "user1"}, {ID: 3, OwnerID: "user2", Assignee: "user1"}, @@ -969,7 +977,7 @@ func GetPersonAssigned(t *testing.T) { mockDb.On("GetAssignedBounties", mock.Anything).Return(expectedBounties, nil).Once() mockDb.On("GetPersonByPubkey", mock.Anything).Return(db.Person{}, nil) - mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Organization{}, nil) + mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Workspace{}, nil) rr := httptest.NewRecorder() req, err := http.NewRequest("GET", "/wanteds/assigned/uuid?Assigned=true&Paid=true&offset=0&limit=4", nil) req = req.WithContext(ctx) @@ -997,12 +1005,12 @@ func GetPersonAssigned(t *testing.T) { }) t.Run("should not return bounties assigned to other users", func(t *testing.T) { - mockGenerateBountyResponse := func(bounties []db.Bounty) []db.BountyResponse { + mockGenerateBountyResponse := func(bounties []db.NewBounty) []db.BountyResponse { return []db.BountyResponse{} } bHandler.generateBountyResponse = mockGenerateBountyResponse - mockDb.On("GetAssignedBounties", mock.Anything).Return([]db.Bounty{}, nil).Once() + mockDb.On("GetAssignedBounties", mock.Anything).Return([]db.NewBounty{}, nil).Once() rr := httptest.NewRecorder() req, err := http.NewRequest("GET", "/wanteds/assigned/uuid", nil) @@ -1034,7 +1042,7 @@ func TestGetBountyIndexById(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.GetBountyIndexById) - bounty := db.Bounty{ + bounty := db.NewBounty{ ID: 1, } @@ -1084,15 +1092,16 @@ func TestGetAllBounties(t *testing.T) { t.Run("Should successfull All Bounties", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(bHandler.GetAllBounties) - bounties := []db.Bounty{ + bounties := []db.NewBounty{ {ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - Assignee: "user1", - Created: 1707991475, - OwnerID: "owner-1", + Type: "coding", + Title: "first bounty", + Description: "first bounty description", + OrgUuid: "org-1", + WorkspaceUuid: "work-1", + Assignee: "user1", + Created: 1707991475, + OwnerID: "owner-1", }, } @@ -1101,7 +1110,7 @@ func TestGetAllBounties(t *testing.T) { mockDb.On("GetAllBounties", req).Return(bounties) mockDb.On("GetPersonByPubkey", mock.Anything).Return(db.Person{}, nil) - mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Organization{}, nil) + mockDb.On("GetWorkspaceByUuid", mock.Anything).Return(db.Workspace{}, nil) handler.ServeHTTP(rr, req) var returnedBounty []db.BountyResponse @@ -1167,11 +1176,12 @@ func TestMakeBountyPayment(t *testing.T) { var processingTimes []time.Time bountyID := uint(1) - bounty := db.Bounty{ - ID: bountyID, - OrgUuid: "org-1", - Assignee: "assignee-1", - Price: uint(1000), + bounty := db.NewBounty{ + ID: bountyID, + OrgUuid: "org-1", + WorkspaceUuid: "work-1", + Assignee: "assignee-1", + Price: uint(1000), } t.Run("mutex lock ensures sequential access", func(t *testing.T) { @@ -1224,12 +1234,13 @@ func TestMakeBountyPayment(t *testing.T) { t.Run("405 when trying to pay an already-paid bounty", func(t *testing.T) { mockDb.ExpectedCalls = nil - mockDb.On("GetBounty", mock.AnythingOfType("uint")).Return(db.Bounty{ - ID: 1, - Price: 1000, - OrgUuid: "org-1", - Assignee: "assignee-1", - Paid: true, + mockDb.On("GetBounty", mock.AnythingOfType("uint")).Return(db.NewBounty{ + ID: 1, + Price: 1000, + OrgUuid: "org-1", + WorkspaceUuid: "work-1", + Assignee: "assignee-1", + Paid: true, }, nil) r := chi.NewRouter() @@ -1247,15 +1258,16 @@ func TestMakeBountyPayment(t *testing.T) { mockDb.AssertExpectations(t) }) - t.Run("401 error if user not organization admin or does not have PAY BOUNTY role", func(t *testing.T) { + t.Run("401 error if user not workspace admin or does not have PAY BOUNTY role", func(t *testing.T) { bHandler.userHasAccess = mockUserHasAccessFalse - mockDb.On("GetBounty", mock.AnythingOfType("uint")).Return(db.Bounty{ - ID: 1, - Price: 1000, - OrgUuid: "org-1", - Assignee: "assignee-1", - Paid: false, + mockDb.On("GetBounty", mock.AnythingOfType("uint")).Return(db.NewBounty{ + ID: 1, + Price: 1000, + OrgUuid: "org-1", + WorkspaceUuid: "work-1", + Assignee: "assignee-1", + Paid: false, }, nil) r := chi.NewRouter() @@ -1273,21 +1285,22 @@ func TestMakeBountyPayment(t *testing.T) { }) - t.Run("403 error when amount exceeds organization's budget balance", func(t *testing.T) { + t.Run("403 error when amount exceeds workspace's budget balance", func(t *testing.T) { ctx := context.WithValue(context.Background(), auth.ContextKey, "valid-key") mockDb := dbMocks.NewDatabase(t) mockHttpClient := mocks.NewHttpClient(t) bHandler := NewBountyHandler(mockHttpClient, mockDb) bHandler.userHasAccess = mockUserHasAccessTrue - mockDb.On("GetBounty", mock.AnythingOfType("uint")).Return(db.Bounty{ - ID: 1, - Price: 1000, - OrgUuid: "org-1", - Assignee: "assignee-1", - Paid: false, + mockDb.On("GetBounty", mock.AnythingOfType("uint")).Return(db.NewBounty{ + ID: 1, + Price: 1000, + OrgUuid: "org-1", + WorkspaceUuid: "work-1", + Assignee: "assignee-1", + Paid: false, }, nil) - mockDb.On("GetWorkspaceBudget", "org-1").Return(db.BountyBudget{ + mockDb.On("GetWorkspaceBudget", "work-1").Return(db.NewBountyBudget{ TotalBudget: 500, }, nil) @@ -1302,7 +1315,7 @@ func TestMakeBountyPayment(t *testing.T) { r.ServeHTTP(rr, req) - assert.Equal(t, http.StatusForbidden, rr.Code, "Expected 403 Forbidden when the payment exceeds the organization's budget") + assert.Equal(t, http.StatusForbidden, rr.Code, "Expected 403 Forbidden when the payment exceeds the workspace's budget") }) @@ -1312,9 +1325,10 @@ func TestMakeBountyPayment(t *testing.T) { bHandler.userHasAccess = mockUserHasAccessTrue now := time.Now() - expectedBounty := db.Bounty{ + expectedBounty := db.NewBounty{ ID: bountyID, OrgUuid: "org-1", + WorkspaceUuid: "work-1", Assignee: "assignee-1", Price: uint(1000), Paid: true, @@ -1323,11 +1337,11 @@ func TestMakeBountyPayment(t *testing.T) { } mockDb.On("GetBounty", bountyID).Return(bounty, nil) - mockDb.On("GetWorkspaceBudget", bounty.OrgUuid).Return(db.BountyBudget{TotalBudget: 2000}, nil) + mockDb.On("GetWorkspaceBudget", bounty.WorkspaceUuid).Return(db.NewBountyBudget{TotalBudget: 2000}, nil) mockDb.On("GetPersonByPubkey", bounty.Assignee).Return(db.Person{OwnerPubKey: "assignee-1", OwnerRouteHint: "OwnerRouteHint"}, nil) - mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.PaymentHistory")).Return(db.PaymentHistory{ID: 1}) - mockDb.On("UpdateBounty", mock.AnythingOfType("db.Bounty")).Run(func(args mock.Arguments) { - updatedBounty := args.Get(0).(db.Bounty) + mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.NewPaymentHistory")).Return(db.NewPaymentHistory{ID: 1}) + mockDb.On("UpdateBounty", mock.AnythingOfType("db.NewBounty")).Run(func(args mock.Arguments) { + updatedBounty := args.Get(0).(db.NewBounty) assert.True(t, updatedBounty.Paid) assert.NotNil(t, updatedBounty.PaidDate) assert.NotNil(t, updatedBounty.CompletionDate) @@ -1372,7 +1386,7 @@ func TestMakeBountyPayment(t *testing.T) { bHandler2.userHasAccess = mockUserHasAccessTrue mockDb2.On("GetBounty", bountyID).Return(bounty, nil) - mockDb2.On("GetWorkspaceBudget", bounty.OrgUuid).Return(db.BountyBudget{TotalBudget: 2000}, nil) + mockDb2.On("GetWorkspaceBudget", bounty.WorkspaceUuid).Return(db.NewBountyBudget{TotalBudget: 2000}, nil) mockDb2.On("GetPersonByPubkey", bounty.Assignee).Return(db.Person{OwnerPubKey: "assignee-1", OwnerRouteHint: "OwnerRouteHint"}, nil) expectedUrl := fmt.Sprintf("%s/payment", config.RelayUrl) @@ -1447,7 +1461,7 @@ func TestBountyBudgetWithdraw(t *testing.T) { assert.Equal(t, http.StatusNotAcceptable, rr.Code) }) - t.Run("401 error if user is not the organization admin or does not have WithdrawBudget role", func(t *testing.T) { + t.Run("401 error if user is not the workspace admin or does not have WithdrawBudget role", func(t *testing.T) { bHandler.userHasAccess = mockUserHasAccessFalse rr := httptest.NewRecorder() @@ -1465,14 +1479,14 @@ func TestBountyBudgetWithdraw(t *testing.T) { assert.Contains(t, rr.Body.String(), "You don't have appropriate permissions to withdraw bounty budget") }) - t.Run("403 error when amount exceeds organization's budget", func(t *testing.T) { + t.Run("403 error when amount exceeds workspace's budget", func(t *testing.T) { ctxs := context.WithValue(context.Background(), auth.ContextKey, "valid-key") mockDb := dbMocks.NewDatabase(t) mockHttpClient := mocks.NewHttpClient(t) bHandler := NewBountyHandler(mockHttpClient, mockDb) bHandler.userHasAccess = mockUserHasAccessTrue - mockDb.On("GetWorkspaceBudget", "org-1").Return(db.BountyBudget{ + mockDb.On("GetWorkspaceBudget", "org-1").Return(db.NewBountyBudget{ TotalBudget: 500, }, nil) invoice := "lnbc15u1p3xnhl2pp5jptserfk3zk4qy42tlucycrfwxhydvlemu9pqr93tuzlv9cc7g3sdqsvfhkcap3xyhx7un8cqzpgxqzjcsp5f8c52y2stc300gl6s4xswtjpc37hrnnr3c9wvtgjfuvqmpm35evq9qyyssqy4lgd8tj637qcjp05rdpxxykjenthxftej7a2zzmwrmrl70fyj9hvj0rewhzj7jfyuwkwcg9g2jpwtk3wkjtwnkdks84hsnu8xps5vsq4gj5hs" @@ -1491,11 +1505,11 @@ func TestBountyBudgetWithdraw(t *testing.T) { bHandler.BountyBudgetWithdraw(rr, req) - assert.Equal(t, http.StatusForbidden, rr.Code, "Expected 403 Forbidden when the payment exceeds the organization's budget") + assert.Equal(t, http.StatusForbidden, rr.Code, "Expected 403 Forbidden when the payment exceeds the workspace's budget") assert.Contains(t, rr.Body.String(), "Workspace budget is not enough to withdraw the amount", "Expected specific error message") }) - t.Run("budget invoices get paid if amount is lesser than organization's budget", func(t *testing.T) { + t.Run("budget invoices get paid if amount is lesser than workspace's budget", func(t *testing.T) { ctxs := context.WithValue(context.Background(), auth.ContextKey, "valid-key") mockDb := dbMocks.NewDatabase(t) mockHttpClient := mocks.NewHttpClient(t) @@ -1504,7 +1518,7 @@ func TestBountyBudgetWithdraw(t *testing.T) { paymentAmount := uint(1500) - mockDb.On("GetWorkspaceBudget", "org-1").Return(db.BountyBudget{ + mockDb.On("GetWorkspaceBudget", "org-1").Return(db.NewBountyBudget{ TotalBudget: 5000, }, nil) mockDb.On("WithdrawBudget", "valid-key", "org-1", paymentAmount).Return(nil) @@ -1541,7 +1555,7 @@ func TestBountyBudgetWithdraw(t *testing.T) { bHandler := NewBountyHandler(mockHttpClient, mockDb) bHandler.userHasAccess = mockUserHasAccessTrue - mockDb.On("GetWorkspaceBudget", "org-1").Return(db.BountyBudget{ + mockDb.On("GetWorkspaceBudget", "org-1").Return(db.NewBountyBudget{ TotalBudget: 5000, }, nil) mockHttpClient.On("Do", mock.AnythingOfType("*http.Request")).Return(&http.Response{ @@ -1590,7 +1604,7 @@ func TestBountyBudgetWithdraw(t *testing.T) { mockHttpClient.ExpectedCalls = nil mockHttpClient.Calls = nil - mockDb.On("GetWorkspaceBudget", "org-1").Return(db.BountyBudget{ + mockDb.On("GetWorkspaceBudget", "org-1").Return(db.NewBountyBudget{ TotalBudget: expectedFinalBudget, }, nil) mockDb.On("WithdrawBudget", "valid-key", "org-1", paymentAmount).Return(nil) @@ -1615,7 +1629,7 @@ func TestBountyBudgetWithdraw(t *testing.T) { assert.NoError(t, err) assert.True(t, response.Success, "Expected invoice payment to succeed") finalBudget := mockDb.GetWorkspaceBudget("org-1") - assert.Equal(t, expectedFinalBudget, finalBudget.TotalBudget, "The organization's final budget should reflect the deductions from the successful withdrawals") + assert.Equal(t, expectedFinalBudget, finalBudget.TotalBudget, "The workspace's final budget should reflect the deductions from the successful withdrawals") } }) @@ -1721,16 +1735,18 @@ func TestPollInvoice(t *testing.T) { }, nil).Once() bountyID := uint(1) - bounty := db.Bounty{ - ID: bountyID, - OrgUuid: "org-1", - Assignee: "assignee-1", - Price: uint(1000), + bounty := db.NewBounty{ + ID: bountyID, + WorkspaceUuid: "work-1", + OrgUuid: "org-1", + Assignee: "assignee-1", + Price: uint(1000), } now := time.Now() - expectedBounty := db.Bounty{ + expectedBounty := db.NewBounty{ ID: bountyID, + WorkspaceUuid: "work-1", OrgUuid: "org-1", Assignee: "assignee-1", Price: uint(1000), @@ -1739,15 +1755,15 @@ func TestPollInvoice(t *testing.T) { CompletionDate: &now, } - mockDb.On("GetInvoice", "1").Return(db.InvoiceList{Type: "KEYSEND"}) + mockDb.On("GetInvoice", "1").Return(db.NewInvoiceList{Type: "KEYSEND"}) mockDb.On("GetUserInvoiceData", "1").Return(db.UserInvoiceData{Amount: 1000, UserPubkey: "UserPubkey", RouteHint: "RouteHint", Created: 1234}) - mockDb.On("GetInvoice", "1").Return(db.InvoiceList{Status: false}) + mockDb.On("GetInvoice", "1").Return(db.NewInvoiceList{Status: false}) mockDb.On("GetBountyByCreated", uint(1234)).Return(bounty, nil) - mockDb.On("UpdateBounty", mock.AnythingOfType("db.Bounty")).Run(func(args mock.Arguments) { - updatedBounty := args.Get(0).(db.Bounty) + mockDb.On("UpdateBounty", mock.AnythingOfType("db.NewBounty")).Run(func(args mock.Arguments) { + updatedBounty := args.Get(0).(db.NewBounty) assert.True(t, updatedBounty.Paid) }).Return(expectedBounty, nil).Once() - mockDb.On("UpdateInvoice", "1").Return(db.InvoiceList{}).Once() + mockDb.On("UpdateInvoice", "1").Return(db.NewInvoiceList{}).Once() expectedPaymentUrl := fmt.Sprintf("%s/payment", config.RelayUrl) expectedPaymentBody := `{"amount": 1000, "destination_key": "UserPubkey", "route_hint": "RouteHint", "text": "memotext added for notification"}` @@ -1776,7 +1792,7 @@ func TestPollInvoice(t *testing.T) { mockHttpClient.AssertExpectations(t) }) - t.Run("If the invoice is settled and the invoice.Type is equal to BUDGET the invoice amount should be added to the organization budget and the payment status of the related invoice should be sent to true on the payment history table", func(t *testing.T) { + t.Run("If the invoice is settled and the invoice.Type is equal to BUDGET the invoice amount should be added to the workspace budget and the payment status of the related invoice should be sent to true on the payment history table", func(t *testing.T) { ctx := context.Background() mockDb := &dbMocks.Database{} mockHttpClient := &mocks.HttpClient{} @@ -1792,11 +1808,11 @@ func TestPollInvoice(t *testing.T) { Body: r, }, nil).Once() - mockDb.On("GetInvoice", "1").Return(db.InvoiceList{Type: "BUDGET"}) + mockDb.On("GetInvoice", "1").Return(db.NewInvoiceList{Type: "BUDGET"}) mockDb.On("GetUserInvoiceData", "1").Return(db.UserInvoiceData{Amount: 1000, UserPubkey: "UserPubkey", RouteHint: "RouteHint", Created: 1234}) - mockDb.On("GetInvoice", "1").Return(db.InvoiceList{Status: false}) - mockDb.On("AddAndUpdateBudget", mock.Anything).Return(db.PaymentHistory{}) - mockDb.On("UpdateInvoice", "1").Return(db.InvoiceList{}).Once() + mockDb.On("GetInvoice", "1").Return(db.NewInvoiceList{Status: false}) + mockDb.On("AddAndUpdateBudget", mock.Anything).Return(db.NewPaymentHistory{}) + mockDb.On("UpdateInvoice", "1").Return(db.NewInvoiceList{}).Once() ro := chi.NewRouter() ro.Post("/poll/invoice/{paymentRequest}", bHandler.PollInvoice) diff --git a/handlers/metrics_test.go b/handlers/metrics_test.go index 087101143..38695f8ac 100644 --- a/handlers/metrics_test.go +++ b/handlers/metrics_test.go @@ -161,7 +161,7 @@ func TestMetricsBounties(t *testing.T) { mockDb.On("GetBountiesByDateRange", dateRange, req).Return(bounties).Once() mockDb.On("GetPersonByPubkey", "owner-1").Return(db.Person{ID: 1}).Once() mockDb.On("GetPersonByPubkey", "").Return(db.Person{}).Once() - mockDb.On("GetWorkspaceByUuid", "").Return(db.Organization{}).Once() + mockDb.On("GetWorkspaceByUuid", "").Return(db.Workspace{}).Once() handler.ServeHTTP(rr, req) var res []db.BountyData @@ -216,10 +216,10 @@ func TestMetricsBounties(t *testing.T) { mockDb.On("GetBountiesByDateRange", dateRange, req).Return(bounties).Once() mockDb.On("GetPersonByPubkey", "provider1").Return(db.Person{ID: 1}).Once() mockDb.On("GetPersonByPubkey", "").Return(db.Person{}).Once() - mockDb.On("GetWorkspaceByUuid", "").Return(db.Organization{}).Once() + mockDb.On("GetWorkspaceByUuid", "").Return(db.Workspace{}).Once() mockDb.On("GetPersonByPubkey", "provider2").Return(db.Person{ID: 2}).Once() mockDb.On("GetPersonByPubkey", "").Return(db.Person{}).Once() - mockDb.On("GetWorkspaceByUuid", "").Return(db.Organization{}).Once() + mockDb.On("GetWorkspaceByUuid", "").Return(db.Workspace{}).Once() handler.ServeHTTP(rr, req) diff --git a/handlers/tribes.go b/handlers/tribes.go index 467feb60b..df66d6807 100644 --- a/handlers/tribes.go +++ b/handlers/tribes.go @@ -518,7 +518,7 @@ func GenerateInvoice(w http.ResponseWriter, r *http.Request) { paymentRequest := invoiceRes.Response.Invoice now := time.Now() - newInvoice := db.InvoiceList{ + newInvoice := db.NewInvoiceList{ PaymentRequest: paymentRequest, Type: db.InvoiceType(invoiceType), OwnerPubkey: owner_key, @@ -557,6 +557,10 @@ func (th *tribeHandler) GenerateBudgetInvoice(w http.ResponseWriter, r *http.Req return } + if invoice.WorkspaceUuid == "" && invoice.OrgUuid != "" { + invoice.WorkspaceUuid = invoice.OrgUuid + } + url := fmt.Sprintf("%s/invoices", config.RelayUrl) bodyData := fmt.Sprintf(`{"amount": %d, "memo": "%s"}`, invoice.Amount, "Budget Invoice") @@ -590,9 +594,9 @@ func (th *tribeHandler) GenerateBudgetInvoice(w http.ResponseWriter, r *http.Req } now := time.Now() - var paymentHistory = db.PaymentHistory{ + var paymentHistory = db.NewPaymentHistory{ Amount: invoice.Amount, - OrgUuid: invoice.OrgUuid, + WorkspaceUuid: invoice.WorkspaceUuid, PaymentType: invoice.PaymentType, SenderPubKey: invoice.SenderPubKey, ReceiverPubKey: "", @@ -602,11 +606,11 @@ func (th *tribeHandler) GenerateBudgetInvoice(w http.ResponseWriter, r *http.Req BountyId: 0, } - newInvoice := db.InvoiceList{ + newInvoice := db.NewInvoiceList{ PaymentRequest: invoiceRes.Response.Invoice, Type: db.InvoiceType("BUDGET"), OwnerPubkey: invoice.SenderPubKey, - OrgUuid: invoice.OrgUuid, + WorkspaceUuid: invoice.WorkspaceUuid, Created: &now, Updated: &now, Status: false, diff --git a/handlers/tribes_test.go b/handlers/tribes_test.go index 8b1a6e96a..fabe3cf7e 100644 --- a/handlers/tribes_test.go +++ b/handlers/tribes_test.go @@ -4,12 +4,13 @@ import ( "bytes" "context" "encoding/json" - "github.com/stakwork/sphinx-tribes/config" "net/http" "net/http/httptest" "strings" "testing" + "github.com/stakwork/sphinx-tribes/config" + "github.com/go-chi/chi" "github.com/lib/pq" "github.com/stakwork/sphinx-tribes/auth" @@ -636,8 +637,8 @@ func TestGenerateBudgetInvoice(t *testing.T) { t.Run("Should mock a call to relay /invoices with the correct body", func(t *testing.T) { - mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.PaymentHistory")).Return(db.PaymentHistory{}, nil) - mockDb.On("AddInvoice", mock.AnythingOfType("db.InvoiceList")).Return(db.InvoiceList{}, nil) + mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.NewPaymentHistory")).Return(db.NewPaymentHistory{}, nil) + mockDb.On("AddInvoice", mock.AnythingOfType("db.NewInvoiceList")).Return(db.NewInvoiceList{}, nil) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -672,8 +673,8 @@ func TestGenerateBudgetInvoice(t *testing.T) { userAmount := float64(1000) - mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.PaymentHistory")).Return(db.PaymentHistory{}, nil) - mockDb.On("AddInvoice", mock.AnythingOfType("db.InvoiceList")).Return(db.InvoiceList{}, nil) + mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.NewPaymentHistory")).Return(db.NewPaymentHistory{}, nil) + mockDb.On("AddInvoice", mock.AnythingOfType("db.NewInvoiceList")).Return(db.NewInvoiceList{}, nil) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var body map[string]interface{} @@ -703,11 +704,11 @@ func TestGenerateBudgetInvoice(t *testing.T) { }) t.Run("Should add payments to the payment history and invoice to the invoice list upon successful relay call", func(t *testing.T) { - expectedPaymentHistory := db.PaymentHistory{Amount: userAmount} - expectedInvoice := db.InvoiceList{PaymentRequest: invoiceResponse.Response.Invoice} + expectedPaymentHistory := db.NewPaymentHistory{Amount: userAmount} + expectedInvoice := db.NewInvoiceList{PaymentRequest: invoiceResponse.Response.Invoice} - mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.PaymentHistory")).Return(expectedPaymentHistory, nil) - mockDb.On("AddInvoice", mock.AnythingOfType("db.InvoiceList")).Return(expectedInvoice, nil) + mockDb.On("AddPaymentHistory", mock.AnythingOfType("db.NewPaymentHistory")).Return(expectedPaymentHistory, nil) + mockDb.On("AddInvoice", mock.AnythingOfType("db.NewInvoiceList")).Return(expectedInvoice, nil) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) @@ -734,7 +735,7 @@ func TestGenerateBudgetInvoice(t *testing.T) { assert.True(t, response.Succcess, "Invoice generation should be successful") assert.Equal(t, "example_invoice", response.Response.Invoice, "The invoice in the response should match the mock") - mockDb.AssertCalled(t, "AddPaymentHistory", mock.AnythingOfType("db.PaymentHistory")) - mockDb.AssertCalled(t, "AddInvoice", mock.AnythingOfType("db.InvoiceList")) + mockDb.AssertCalled(t, "AddPaymentHistory", mock.AnythingOfType("db.NewPaymentHistory")) + mockDb.AssertCalled(t, "AddInvoice", mock.AnythingOfType("db.NewInvoiceList")) }) } diff --git a/handlers/workspaces.go b/handlers/workspaces.go index 8922ce63f..01b310fa5 100644 --- a/handlers/workspaces.go +++ b/handlers/workspaces.go @@ -18,7 +18,7 @@ import ( type workspaceHandler struct { db db.Database - generateBountyHandler func(bounties []db.Bounty) []db.BountyResponse + generateBountyHandler func(bounties []db.NewBounty) []db.BountyResponse getLightningInvoice func(payment_request string) (db.InvoiceResult, db.InvoiceError) userHasAccess func(pubKeyFromAuth string, uuid string, role string) bool userHasManageBountyRoles func(pubKeyFromAuth string, uuid string) bool @@ -46,7 +46,7 @@ func (oh *workspaceHandler) CreateOrEditWorkspace(w http.ResponseWriter, r *http } now := time.Now() - workspace := db.Organization{} + workspace := db.Workspace{} body, _ := io.ReadAll(r.Body) r.Body.Close() err := json.Unmarshal(body, &workspace) @@ -60,16 +60,16 @@ func (oh *workspaceHandler) CreateOrEditWorkspace(w http.ResponseWriter, r *http workspace.Name = strings.TrimSpace(workspace.Name) if len(workspace.Name) == 0 || len(workspace.Name) > 20 { - fmt.Printf("invalid organization name %s\n", workspace.Name) + fmt.Printf("invalid workspace name %s\n", workspace.Name) w.WriteHeader(http.StatusBadRequest) - json.NewEncoder(w).Encode("Error: organization name must be present and should not exceed 20 character") + json.NewEncoder(w).Encode("Error: workspace name must be present and should not exceed 20 character") return } if len(workspace.Description) > 120 { - fmt.Printf("invalid organization name %s\n", workspace.Description) + fmt.Printf("invalid workspace name %s\n", workspace.Description) w.WriteHeader(http.StatusBadRequest) - json.NewEncoder(w).Encode("Error: organization description should not exceed 120 character") + json.NewEncoder(w).Encode("Error: workspace description should not exceed 120 character") return } @@ -111,7 +111,7 @@ func (oh *workspaceHandler) CreateOrEditWorkspace(w http.ResponseWriter, r *http name := workspace.Name - // check if the organization name already exists + // check if the workspace name already exists orgName := oh.db.GetWorkspaceByName(name) if orgName.Name == name { @@ -127,13 +127,13 @@ func (oh *workspaceHandler) CreateOrEditWorkspace(w http.ResponseWriter, r *http } else { if workspace.ID == 0 { // can't create that already exists - fmt.Println("can't create existing organization") + fmt.Println("can't create existing workspace") w.WriteHeader(http.StatusUnauthorized) return } if workspace.ID != existing.ID { // can't edit someone else's - fmt.Println("cant edit another organization") + fmt.Println("cant edit another workspace") w.WriteHeader(http.StatusUnauthorized) return } @@ -176,13 +176,17 @@ func CreateWorkspaceUser(w http.ResponseWriter, r *http.Request) { pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) now := time.Now() - orgUser := db.OrganizationUsers{} + workspaceUser := db.WorkspaceUsers{} body, err := io.ReadAll(r.Body) r.Body.Close() - err = json.Unmarshal(body, &orgUser) + err = json.Unmarshal(body, &workspaceUser) + + if workspaceUser.WorkspaceUuid == "" && workspaceUser.OrgUuid != "" { + workspaceUser.WorkspaceUuid = workspaceUser.OrgUuid + } // get orgnanization - workspace := db.DB.GetWorkspaceByUuid(orgUser.OrgUuid) + workspace := db.DB.GetWorkspaceByUuid(workspaceUser.WorkspaceUuid) if err != nil { fmt.Println(err) @@ -196,22 +200,22 @@ func CreateWorkspaceUser(w http.ResponseWriter, r *http.Request) { return } - // check if the user is the organization admin - if orgUser.OwnerPubKey == workspace.OwnerPubKey { + // check if the user is the workspace admin + if workspaceUser.OwnerPubKey == workspace.OwnerPubKey { w.WriteHeader(http.StatusUnauthorized) - json.NewEncoder(w).Encode("Cannot add organization admin as a user") + json.NewEncoder(w).Encode("Cannot add workspace admin as a user") return } // check if the user tries to add their self - if pubKeyFromAuth == orgUser.OwnerPubKey { + if pubKeyFromAuth == workspaceUser.OwnerPubKey { w.WriteHeader(http.StatusUnauthorized) json.NewEncoder(w).Encode("Cannot add userself as a user") return } // if not the orgnization admin - hasRole := db.UserHasAccess(pubKeyFromAuth, orgUser.OrgUuid, db.AddUser) + hasRole := db.UserHasAccess(pubKeyFromAuth, workspaceUser.WorkspaceUuid, db.AddUser) if !hasRole { w.WriteHeader(http.StatusUnauthorized) json.NewEncoder(w).Encode("Don't have access to add user") @@ -219,15 +223,15 @@ func CreateWorkspaceUser(w http.ResponseWriter, r *http.Request) { } // check if the user exists on peoples table - isUser := db.DB.GetPersonByPubkey(orgUser.OwnerPubKey) - if isUser.OwnerPubKey != orgUser.OwnerPubKey { + isUser := db.DB.GetPersonByPubkey(workspaceUser.OwnerPubKey) + if isUser.OwnerPubKey != workspaceUser.OwnerPubKey { w.WriteHeader(http.StatusUnauthorized) json.NewEncoder(w).Encode("User doesn't exists in people") return } // check if user already exists - userExists := db.DB.GetWorkspaceUser(orgUser.OwnerPubKey, orgUser.OrgUuid) + userExists := db.DB.GetWorkspaceUser(workspaceUser.OwnerPubKey, workspaceUser.WorkspaceUuid) if userExists.ID != 0 { w.WriteHeader(http.StatusUnauthorized) @@ -235,21 +239,21 @@ func CreateWorkspaceUser(w http.ResponseWriter, r *http.Request) { return } - orgUser.Created = &now - orgUser.Updated = &now + workspaceUser.Created = &now + workspaceUser.Updated = &now // create user - user := db.DB.CreateWorkspaceUser(orgUser) + user := db.DB.CreateWorkspaceUser(workspaceUser) w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(user) } func GetWorkspaceUsers(w http.ResponseWriter, r *http.Request) { uuid := chi.URLParam(r, "uuid") - orgUsers, _ := db.DB.GetWorkspaceUsers(uuid) + workspaceUsers, _ := db.DB.GetWorkspaceUsers(uuid) w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(orgUsers) + json.NewEncoder(w).Encode(workspaceUsers) } func GetWorkspaceUser(w http.ResponseWriter, r *http.Request) { @@ -263,10 +267,10 @@ func GetWorkspaceUser(w http.ResponseWriter, r *http.Request) { } uuid := chi.URLParam(r, "uuid") - orgUser := db.DB.GetWorkspaceUser(pubKeyFromAuth, uuid) + workspaceUser := db.DB.GetWorkspaceUser(pubKeyFromAuth, uuid) w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(orgUser) + json.NewEncoder(w).Encode(workspaceUser) } func GetWorkspaceUsersCount(w http.ResponseWriter, r *http.Request) { @@ -281,10 +285,14 @@ func DeleteWorkspaceUser(w http.ResponseWriter, r *http.Request) { ctx := r.Context() pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) - orgUser := db.OrganizationUsersData{} + workspaceUser := db.WorkspaceUsersData{} body, err := io.ReadAll(r.Body) r.Body.Close() - err = json.Unmarshal(body, &orgUser) + err = json.Unmarshal(body, &workspaceUser) + + if workspaceUser.WorkspaceUuid == "" && workspaceUser.OrgUuid != "" { + workspaceUser.WorkspaceUuid = workspaceUser.OrgUuid + } if err != nil { fmt.Println(err) @@ -298,25 +306,25 @@ func DeleteWorkspaceUser(w http.ResponseWriter, r *http.Request) { return } - workspace := db.DB.GetWorkspaceByUuid(orgUser.OrgUuid) + workspace := db.DB.GetWorkspaceByUuid(workspaceUser.WorkspaceUuid) - if orgUser.OwnerPubKey == workspace.OwnerPubKey { + if workspaceUser.OwnerPubKey == workspace.OwnerPubKey { w.WriteHeader(http.StatusUnauthorized) - json.NewEncoder(w).Encode("Cannot delete organization admin") + json.NewEncoder(w).Encode("Cannot delete workspace admin") return } - hasRole := db.UserHasAccess(pubKeyFromAuth, orgUser.OrgUuid, db.DeleteUser) + hasRole := db.UserHasAccess(pubKeyFromAuth, workspaceUser.WorkspaceUuid, db.DeleteUser) if !hasRole { w.WriteHeader(http.StatusUnauthorized) json.NewEncoder(w).Encode("Don't have access to delete user") return } - db.DB.DeleteWorkspaceUser(orgUser, orgUser.OrgUuid) + db.DB.DeleteWorkspaceUser(workspaceUser, workspaceUser.WorkspaceUuid) w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(orgUser) + json.NewEncoder(w).Encode(workspaceUser) } func GetBountyRoles(w http.ResponseWriter, r *http.Request) { @@ -339,7 +347,7 @@ func AddUserRoles(w http.ResponseWriter, r *http.Request) { return } - roles := []db.UserRoles{} + roles := []db.WorkspaceUserRoles{} body, err := io.ReadAll(r.Body) r.Body.Close() err = json.Unmarshal(body, &roles) @@ -380,8 +388,13 @@ func AddUserRoles(w http.ResponseWriter, r *http.Request) { } rolesMap := db.GetRolesMap() - insertRoles := []db.UserRoles{} + insertRoles := []db.WorkspaceUserRoles{} for _, role := range roles { + + if role.WorkspaceUuid == "" && role.OrgUuid != "" { + role.WorkspaceUuid = role.OrgUuid + } + _, ok := rolesMap[role.Role] // if any of the roles does not exists return an error if !ok { @@ -407,10 +420,10 @@ func AddUserRoles(w http.ResponseWriter, r *http.Request) { // check if user already exists userExists := db.DB.GetWorkspaceUser(user, uuid) - // if not the organization admin - if userExists.OwnerPubKey != user || userExists.OrgUuid != uuid { + // if not the workspace admin + if userExists.OwnerPubKey != user || userExists.WorkspaceUuid != uuid { w.WriteHeader(http.StatusUnauthorized) - json.NewEncoder(w).Encode("User does not exists in the organization") + json.NewEncoder(w).Encode("User does not exists in the workspace") return } @@ -443,27 +456,27 @@ func GetUserWorkspaces(w http.ResponseWriter, r *http.Request) { user := db.DB.GetPerson(userId) // get the workspaces created by the user, then get all the workspaces - // the user has been added to, loop through to get the organization + // the user has been added to, loop through to get the workspace workspaces := GetCreatedWorkspaces(user.OwnerPubKey) assignedWorkspaces := db.DB.GetUserAssignedWorkspaces(user.OwnerPubKey) for _, value := range assignedWorkspaces { - uuid := value.OrgUuid - organization := db.DB.GetWorkspaceByUuid(uuid) + uuid := value.WorkspaceUuid + workspace := db.DB.GetWorkspaceByUuid(uuid) bountyCount := db.DB.GetWorkspaceBountyCount(uuid) hasRole := db.UserHasAccess(user.OwnerPubKey, uuid, db.ViewReport) // don't add deleted workspaces to the list - if !organization.Deleted { + if !workspace.Deleted { if hasRole { budget := db.DB.GetWorkspaceBudget(uuid) - organization.Budget = budget.TotalBudget + workspace.Budget = budget.TotalBudget } else { - organization.Budget = 0 + workspace.Budget = 0 } - organization.BountyCount = bountyCount + workspace.BountyCount = bountyCount - workspaces = append(workspaces, organization) + workspaces = append(workspaces, workspace) } } @@ -484,28 +497,28 @@ func (oh *workspaceHandler) GetUserDropdownWorkspaces(w http.ResponseWriter, r * user := db.DB.GetPerson(userId) // get the workspaces created by the user, then get all the workspaces - // the user has been added to, loop through to get the organization + // the user has been added to, loop through to get the workspace workspaces := GetCreatedWorkspaces(user.OwnerPubKey) assignedWorkspaces := db.DB.GetUserAssignedWorkspaces(user.OwnerPubKey) for _, value := range assignedWorkspaces { - uuid := value.OrgUuid - organization := db.DB.GetWorkspaceByUuid(uuid) + uuid := value.WorkspaceUuid + workspace := db.DB.GetWorkspaceByUuid(uuid) bountyCount := db.DB.GetWorkspaceBountyCount(uuid) hasRole := db.UserHasAccess(user.OwnerPubKey, uuid, db.ViewReport) hasBountyRoles := oh.userHasManageBountyRoles(user.OwnerPubKey, uuid) // don't add deleted workspaces to the list - if !organization.Deleted && hasBountyRoles { + if !workspace.Deleted && hasBountyRoles { if hasRole { budget := db.DB.GetWorkspaceBudget(uuid) - organization.Budget = budget.TotalBudget + workspace.Budget = budget.TotalBudget } else { - organization.Budget = 0 + workspace.Budget = 0 } - organization.BountyCount = bountyCount + workspace.BountyCount = bountyCount - workspaces = append(workspaces, organization) + workspaces = append(workspaces, workspace) } } @@ -513,9 +526,9 @@ func (oh *workspaceHandler) GetUserDropdownWorkspaces(w http.ResponseWriter, r * json.NewEncoder(w).Encode(workspaces) } -func GetCreatedWorkspaces(pubkey string) []db.Organization { +func GetCreatedWorkspaces(pubkey string) []db.Workspace { workspaces := db.DB.GetUserCreatedWorkspaces(pubkey) - // add bounty count to the organization + // add bounty count to the workspace for index, value := range workspaces { uuid := value.Uuid bountyCount := db.DB.GetWorkspaceBountyCount(uuid) @@ -535,10 +548,10 @@ func GetCreatedWorkspaces(pubkey string) []db.Organization { func (oh *workspaceHandler) GetWorkspaceBounties(w http.ResponseWriter, r *http.Request) { uuid := chi.URLParam(r, "uuid") - // get the organization bounties - organizationBounties := oh.db.GetWorkspaceBounties(r, uuid) + // get the workspace bounties + workspaceBounties := oh.db.GetWorkspaceBounties(r, uuid) - var bountyResponse []db.BountyResponse = oh.generateBountyHandler(organizationBounties) + var bountyResponse []db.BountyResponse = oh.generateBountyHandler(workspaceBounties) w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(bountyResponse) } @@ -546,10 +559,10 @@ func (oh *workspaceHandler) GetWorkspaceBounties(w http.ResponseWriter, r *http. func (oh *workspaceHandler) GetWorkspaceBountiesCount(w http.ResponseWriter, r *http.Request) { uuid := chi.URLParam(r, "uuid") - organizationBountiesCount := oh.db.GetWorkspaceBountiesCount(r, uuid) + workspaceBountiesCount := oh.db.GetWorkspaceBountiesCount(r, uuid) w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(organizationBountiesCount) + json.NewEncoder(w).Encode(workspaceBountiesCount) } func (oh *workspaceHandler) GetWorkspaceBudget(w http.ResponseWriter, r *http.Request) { @@ -563,7 +576,7 @@ func (oh *workspaceHandler) GetWorkspaceBudget(w http.ResponseWriter, r *http.Re return } - // if not the organization admin + // if not the workspace admin hasRole := oh.userHasAccess(pubKeyFromAuth, uuid, db.ViewReport) if !hasRole { w.WriteHeader(http.StatusUnauthorized) @@ -571,11 +584,11 @@ func (oh *workspaceHandler) GetWorkspaceBudget(w http.ResponseWriter, r *http.Re return } - // get the organization budget - organizationBudget := oh.db.GetWorkspaceStatusBudget(uuid) + // get the workspace budget + workspaceBudget := oh.db.GetWorkspaceStatusBudget(uuid) w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(organizationBudget) + json.NewEncoder(w).Encode(workspaceBudget) } func (oh *workspaceHandler) GetWorkspaceBudgetHistory(w http.ResponseWriter, r *http.Request) { @@ -583,7 +596,7 @@ func (oh *workspaceHandler) GetWorkspaceBudgetHistory(w http.ResponseWriter, r * pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) uuid := chi.URLParam(r, "uuid") - // if not the organization admin + // if not the workspace admin hasRole := oh.userHasAccess(pubKeyFromAuth, uuid, db.ViewReport) if !hasRole { w.WriteHeader(http.StatusUnauthorized) @@ -591,11 +604,11 @@ func (oh *workspaceHandler) GetWorkspaceBudgetHistory(w http.ResponseWriter, r * return } - // get the organization budget - organizationBudget := oh.db.GetWorkspaceBudgetHistory(uuid) + // get the workspace budget + workspaceBudget := oh.db.GetWorkspaceBudgetHistory(uuid) w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(organizationBudget) + json.NewEncoder(w).Encode(workspaceBudget) } func GetPaymentHistory(w http.ResponseWriter, r *http.Request) { @@ -609,7 +622,7 @@ func GetPaymentHistory(w http.ResponseWriter, r *http.Request) { return } - // if not the organization admin + // if not the workspace admin hasRole := db.UserHasAccess(pubKeyFromAuth, uuid, db.ViewReport) if !hasRole { w.WriteHeader(http.StatusUnauthorized) @@ -617,7 +630,7 @@ func GetPaymentHistory(w http.ResponseWriter, r *http.Request) { return } - // get the organization payment history + // get the workspace payment history paymentHistory := db.DB.GetPaymentHistory(uuid, r) paymentHistoryData := []db.PaymentHistoryData{} @@ -700,32 +713,32 @@ func (oh *workspaceHandler) DeleteWorkspace(w http.ResponseWriter, r *http.Reque return } - organization := oh.db.GetWorkspaceByUuid(uuid) + workspace := oh.db.GetWorkspaceByUuid(uuid) - if pubKeyFromAuth != organization.OwnerPubKey { - msg := "only workspace admin can delete an organization" + if pubKeyFromAuth != workspace.OwnerPubKey { + msg := "only workspace admin can delete an workspace" fmt.Println(msg) w.WriteHeader(http.StatusUnauthorized) json.NewEncoder(w).Encode(msg) return } - // Update organization to hide and clear certain fields + // Update workspace to hide and clear certain fields if err := oh.db.UpdateWorkspaceForDeletion(uuid); err != nil { - fmt.Println("Error updating organization:", err) + fmt.Println("Error updating workspace:", err) w.WriteHeader(http.StatusInternalServerError) return } - // Delete all users from the organization + // Delete all users from the workspace if err := oh.db.DeleteAllUsersFromWorkspace(uuid); err != nil { - fmt.Println("Error removing users from organization:", err) + fmt.Println("Error removing users from workspace:", err) w.WriteHeader(http.StatusInternalServerError) return } - // soft delete organization - workspace := oh.db.ChangeWorkspaceDeleteStatus(uuid, true) + // soft delete workspace + workspace = oh.db.ChangeWorkspaceDeleteStatus(uuid, true) w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(workspace) } diff --git a/handlers/workspaces_test.go b/handlers/workspaces_test.go index 6917d2030..09f291a5a 100644 --- a/handlers/workspaces_test.go +++ b/handlers/workspaces_test.go @@ -101,15 +101,15 @@ func TestUnitCreateOrEditWorkspace(t *testing.T) { assert.Equal(t, http.StatusBadRequest, rr.Code) }) - t.Run("should trim spaces from organization name", func(t *testing.T) { + t.Run("should trim spaces from workspace name", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.CreateOrEditWorkspace) - mockDb.On("GetWorkspaceByUuid", mock.AnythingOfType("string")).Return(db.Organization{}).Once() - mockDb.On("GetWorkspaceByName", "Abdul").Return(db.Organization{}).Once() - mockDb.On("CreateOrEditWorkspace", mock.MatchedBy(func(org db.Organization) bool { + mockDb.On("GetWorkspaceByUuid", mock.AnythingOfType("string")).Return(db.Workspace{}).Once() + mockDb.On("GetWorkspaceByName", "Abdul").Return(db.Workspace{}).Once() + mockDb.On("CreateOrEditWorkspace", mock.MatchedBy(func(org db.Workspace) bool { return org.Name == "Abdul" && org.Uuid != "" && org.Updated != nil && org.Created != nil - })).Return(db.Organization{Name: "Abdul"}, nil).Once() + })).Return(db.Workspace{Name: "Abdul"}, nil).Once() jsonInput := []byte(`{"name": " Abdul ", "owner_pubkey": "test-key" ,"description": "Test"}`) req, err := http.NewRequestWithContext(ctx, http.MethodPost, "/", bytes.NewReader(jsonInput)) @@ -121,7 +121,7 @@ func TestUnitCreateOrEditWorkspace(t *testing.T) { assert.Equal(t, http.StatusOK, rr.Code) - var responseOrg db.Organization + var responseOrg db.Workspace err = json.Unmarshal(rr.Body.Bytes(), &responseOrg) if err != nil { t.Fatal(err) @@ -130,15 +130,15 @@ func TestUnitCreateOrEditWorkspace(t *testing.T) { assert.Equal(t, "Abdul", responseOrg.Name) }) - t.Run("should successfully add organization if request is valid", func(t *testing.T) { + t.Run("should successfully add workspace if request is valid", func(t *testing.T) { rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.CreateOrEditWorkspace) - mockDb.On("GetWorkspaceByUuid", mock.AnythingOfType("string")).Return(db.Organization{}).Once() - mockDb.On("GetWorkspaceByName", "TestWorkspace").Return(db.Organization{}).Once() - mockDb.On("CreateOrEditWorkspace", mock.MatchedBy(func(org db.Organization) bool { + mockDb.On("GetWorkspaceByUuid", mock.AnythingOfType("string")).Return(db.Workspace{}).Once() + mockDb.On("GetWorkspaceByName", "TestWorkspace").Return(db.Workspace{}).Once() + mockDb.On("CreateOrEditWorkspace", mock.MatchedBy(func(org db.Workspace) bool { return org.Name == "TestWorkspace" && org.Uuid != "" && org.Updated != nil && org.Created != nil - })).Return(db.Organization{}, nil).Once() + })).Return(db.Workspace{}, nil).Once() invalidJson := []byte(`{"name": "TestWorkspace", "owner_pubkey": "test-key" ,"description": "Test"}`) req, err := http.NewRequestWithContext(ctx, http.MethodPost, "/", bytes.NewReader(invalidJson)) @@ -184,13 +184,13 @@ func TestDeleteWorkspace(t *testing.T) { oHandler := NewWorkspaceHandler(mockDb) t.Run("should return error if not authorized", func(t *testing.T) { - orgUUID := "org-uuid" + workspaceUUID := "org-uuid" rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.DeleteWorkspace) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -200,21 +200,21 @@ func TestDeleteWorkspace(t *testing.T) { assert.Equal(t, http.StatusUnauthorized, rr.Code) }) - t.Run("should set organization fields to null and delete users on successful delete", func(t *testing.T) { - orgUUID := "org-uuid" + t.Run("should set workspace fields to null and delete users on successful delete", func(t *testing.T) { + workspaceUUID := "org-uuid" // Mock expected database interactions - mockDb.On("GetWorkspaceByUuid", orgUUID).Return(db.Organization{OwnerPubKey: "test-key"}).Once() - mockDb.On("UpdateWorkspaceForDeletion", orgUUID).Return(nil).Once() - mockDb.On("DeleteAllUsersFromWorkspace", orgUUID).Return(nil).Once() - mockDb.On("ChangeWorkspaceDeleteStatus", orgUUID, true).Return(db.Organization{Uuid: orgUUID, Deleted: true}).Once() + mockDb.On("GetWorkspaceByUuid", workspaceUUID).Return(db.Workspace{OwnerPubKey: "test-key"}).Once() + mockDb.On("UpdateWorkspaceForDeletion", workspaceUUID).Return(nil).Once() + mockDb.On("DeleteAllUsersFromWorkspace", workspaceUUID).Return(nil).Once() + mockDb.On("ChangeWorkspaceDeleteStatus", workspaceUUID, true).Return(db.Workspace{Uuid: workspaceUUID, Deleted: true}).Once() rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.DeleteWorkspace) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -226,18 +226,18 @@ func TestDeleteWorkspace(t *testing.T) { }) t.Run("should handle failures in database updates", func(t *testing.T) { - orgUUID := "org-uuid" + workspaceUUID := "org-uuid" // Mock database interactions with error - mockDb.On("GetWorkspaceByUuid", orgUUID).Return(db.Organization{OwnerPubKey: "test-key"}).Once() - mockDb.On("UpdateWorkspaceForDeletion", orgUUID).Return(errors.New("update error")).Once() + mockDb.On("GetWorkspaceByUuid", workspaceUUID).Return(db.Workspace{OwnerPubKey: "test-key"}).Once() + mockDb.On("UpdateWorkspaceForDeletion", workspaceUUID).Return(errors.New("update error")).Once() rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.DeleteWorkspace) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -248,21 +248,21 @@ func TestDeleteWorkspace(t *testing.T) { mockDb.AssertExpectations(t) }) - t.Run("should set organization's deleted column to true", func(t *testing.T) { - orgUUID := "org-uuid" + t.Run("should set workspace's deleted column to true", func(t *testing.T) { + workspaceUUID := "org-uuid" // Mock the database interactions - mockDb.On("GetWorkspaceByUuid", orgUUID).Return(db.Organization{OwnerPubKey: "test-key"}).Once() - mockDb.On("UpdateWorkspaceForDeletion", orgUUID).Return(nil).Once() - mockDb.On("DeleteAllUsersFromWorkspace", orgUUID).Return(nil).Once() - mockDb.On("ChangeWorkspaceDeleteStatus", orgUUID, true).Return(db.Organization{Uuid: orgUUID, Deleted: true}).Once() + mockDb.On("GetWorkspaceByUuid", workspaceUUID).Return(db.Workspace{OwnerPubKey: "test-key"}).Once() + mockDb.On("UpdateWorkspaceForDeletion", workspaceUUID).Return(nil).Once() + mockDb.On("DeleteAllUsersFromWorkspace", workspaceUUID).Return(nil).Once() + mockDb.On("ChangeWorkspaceDeleteStatus", workspaceUUID, true).Return(db.Workspace{Uuid: workspaceUUID, Deleted: true}).Once() rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.DeleteWorkspace) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -273,7 +273,7 @@ func TestDeleteWorkspace(t *testing.T) { assert.Equal(t, http.StatusOK, rr.Code) // Decoding the response to check if Deleted field is true - var updatedOrg db.Organization + var updatedOrg db.Workspace err = json.Unmarshal(rr.Body.Bytes(), &updatedOrg) if err != nil { t.Fatal(err) @@ -284,27 +284,27 @@ func TestDeleteWorkspace(t *testing.T) { }) t.Run("should set Website, Github, and Description to empty strings", func(t *testing.T) { - orgUUID := "org-uuid" + workspaceUUID := "org-uuid" - updatedOrg := db.Organization{ - Uuid: orgUUID, + updatedOrg := db.Workspace{ + Uuid: workspaceUUID, OwnerPubKey: "test-key", Website: "", Github: "", Description: "", } - mockDb.On("GetWorkspaceByUuid", orgUUID).Return(db.Organization{OwnerPubKey: "test-key"}).Once() - mockDb.On("UpdateWorkspaceForDeletion", orgUUID).Return(nil).Once() - mockDb.On("DeleteAllUsersFromWorkspace", orgUUID).Return(nil).Once() - mockDb.On("ChangeWorkspaceDeleteStatus", orgUUID, true).Return(updatedOrg).Once() + mockDb.On("GetWorkspaceByUuid", workspaceUUID).Return(db.Workspace{OwnerPubKey: "test-key"}).Once() + mockDb.On("UpdateWorkspaceForDeletion", workspaceUUID).Return(nil).Once() + mockDb.On("DeleteAllUsersFromWorkspace", workspaceUUID).Return(nil).Once() + mockDb.On("ChangeWorkspaceDeleteStatus", workspaceUUID, true).Return(updatedOrg).Once() rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.DeleteWorkspace) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -312,7 +312,7 @@ func TestDeleteWorkspace(t *testing.T) { handler.ServeHTTP(rr, req) assert.Equal(t, http.StatusOK, rr.Code) - var returnedOrg db.Organization + var returnedOrg db.Workspace err = json.Unmarshal(rr.Body.Bytes(), &returnedOrg) if err != nil { t.Fatal(err) @@ -324,21 +324,21 @@ func TestDeleteWorkspace(t *testing.T) { mockDb.AssertExpectations(t) }) - t.Run("should delete all users from the organization", func(t *testing.T) { - orgUUID := "org-uuid" + t.Run("should delete all users from the workspace", func(t *testing.T) { + workspaceUUID := "org-uuid" // Setting up the expected behavior of the mock database - mockDb.On("GetWorkspaceByUuid", orgUUID).Return(db.Organization{OwnerPubKey: "test-key"}).Once() - mockDb.On("UpdateWorkspaceForDeletion", orgUUID).Return(nil).Once() - mockDb.On("DeleteAllUsersFromWorkspace", orgUUID).Return(nil).Run(func(args mock.Arguments) {}).Once() - mockDb.On("ChangeWorkspaceDeleteStatus", orgUUID, true).Return(db.Organization{Uuid: orgUUID, Deleted: true}).Once() + mockDb.On("GetWorkspaceByUuid", workspaceUUID).Return(db.Workspace{OwnerPubKey: "test-key"}).Once() + mockDb.On("UpdateWorkspaceForDeletion", workspaceUUID).Return(nil).Once() + mockDb.On("DeleteAllUsersFromWorkspace", workspaceUUID).Return(nil).Run(func(args mock.Arguments) {}).Once() + mockDb.On("ChangeWorkspaceDeleteStatus", workspaceUUID, true).Return(db.Workspace{Uuid: workspaceUUID, Deleted: true}).Once() rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.DeleteWorkspace) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodDelete, "/delete/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -354,24 +354,24 @@ func TestDeleteWorkspace(t *testing.T) { func TestGetWorkspaceBounties(t *testing.T) { ctx := context.WithValue(context.Background(), auth.ContextKey, "test-key") mockDb := mocks.NewDatabase(t) - mockGenerateBountyHandler := func(bounties []db.Bounty) []db.BountyResponse { + mockGenerateBountyHandler := func(bounties []db.NewBounty) []db.BountyResponse { return []db.BountyResponse{} // Mocked response } oHandler := NewWorkspaceHandler(mockDb) - t.Run("Should test that an organization's bounties can be listed without authentication", func(t *testing.T) { - orgUUID := "valid-uuid" + t.Run("Should test that a workspace's bounties can be listed without authentication", func(t *testing.T) { + workspaceUUID := "valid-uuid" oHandler.generateBountyHandler = mockGenerateBountyHandler - expectedBounties := []db.Bounty{{}, {}} // Mocked response - mockDb.On("GetWorkspaceBounties", mock.AnythingOfType("*http.Request"), orgUUID).Return(expectedBounties).Once() + expectedBounties := []db.NewBounty{{}, {}} // Mocked response + mockDb.On("GetWorkspaceBounties", mock.AnythingOfType("*http.Request"), workspaceUUID).Return(expectedBounties).Once() rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.GetWorkspaceBounties) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/bounties/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/bounties/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -381,17 +381,17 @@ func TestGetWorkspaceBounties(t *testing.T) { assert.Equal(t, http.StatusOK, rr.Code) }) - t.Run("should return empty array when wrong organization UUID is passed", func(t *testing.T) { - orgUUID := "wrong-uuid" + t.Run("should return empty array when wrong workspace UUID is passed", func(t *testing.T) { + workspaceUUID := "wrong-uuid" - mockDb.On("GetWorkspaceBounties", mock.AnythingOfType("*http.Request"), orgUUID).Return([]db.Bounty{}).Once() + mockDb.On("GetWorkspaceBounties", mock.AnythingOfType("*http.Request"), workspaceUUID).Return([]db.NewBounty{}).Once() rr := httptest.NewRecorder() handler := http.HandlerFunc(oHandler.GetWorkspaceBounties) rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/bounties/"+orgUUID+"?limit=10&sortBy=created&search=test&page=1&resetPage=true", nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/bounties/"+workspaceUUID+"?limit=10&sortBy=created&search=test&page=1&resetPage=true", nil) if err != nil { t.Fatal(err) } @@ -414,12 +414,12 @@ func TestGetWorkspaceBudget(t *testing.T) { } oHandler := NewWorkspaceHandler(mockDb) - t.Run("Should test that a 401 is returned when trying to view an organization's budget without a token", func(t *testing.T) { - orgUUID := "valid-uuid" + t.Run("Should test that a 401 is returned when trying to view an workspace's budget without a token", func(t *testing.T) { + workspaceUUID := "valid-uuid" rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/budget/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/budget/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -430,10 +430,10 @@ func TestGetWorkspaceBudget(t *testing.T) { assert.Equal(t, http.StatusUnauthorized, rr.Code) }) - t.Run("Should test that the right workspace budget is returned, if the user is the organization admin or has the ViewReport role", func(t *testing.T) { - orgUUID := "valid-uuid" + t.Run("Should test that the right workspace budget is returned, if the user is the workspace admin or has the ViewReport role", func(t *testing.T) { + workspaceUUID := "valid-uuid" statusBudget := db.StatusBudget{ - OrgUuid: orgUUID, + OrgUuid: workspaceUUID, CurrentBudget: 10000, OpenBudget: 1000, OpenCount: 10, @@ -444,11 +444,11 @@ func TestGetWorkspaceBudget(t *testing.T) { } oHandler.userHasAccess = mockUserHasAccess - mockDb.On("GetWorkspaceStatusBudget", orgUUID).Return(statusBudget).Once() + mockDb.On("GetWorkspaceStatusBudget", workspaceUUID).Return(statusBudget).Once() rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/budget/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/budget/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -473,8 +473,8 @@ func TestGetWorkspaceBudgetHistory(t *testing.T) { mockDb := mocks.NewDatabase(t) oHandler := NewWorkspaceHandler(mockDb) - t.Run("Should test that a 401 is returned when trying to view an organization's budget history without a token", func(t *testing.T) { - orgUUID := "valid-uuid" + t.Run("Should test that a 401 is returned when trying to view an workspace's budget history without a token", func(t *testing.T) { + workspaceUUID := "valid-uuid" mockUserHasAccess := func(pubKeyFromAuth string, uuid string, role string) bool { return false @@ -482,8 +482,8 @@ func TestGetWorkspaceBudgetHistory(t *testing.T) { oHandler.userHasAccess = mockUserHasAccess rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/budget/history/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "/budget/history/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -494,11 +494,11 @@ func TestGetWorkspaceBudgetHistory(t *testing.T) { assert.Equal(t, http.StatusUnauthorized, rr.Code) }) - t.Run("Should test that the right budget history is returned, if the user is the organization admin or has the ViewReport role", func(t *testing.T) { - orgUUID := "valid-uuid" + t.Run("Should test that the right budget history is returned, if the user is the workspace admin or has the ViewReport role", func(t *testing.T) { + workspaceUUID := "valid-uuid" expectedBudgetHistory := []db.BudgetHistoryData{ - {BudgetHistory: db.BudgetHistory{ID: 1, OrgUuid: orgUUID, Created: nil, Updated: nil}, SenderName: "Sender1"}, - {BudgetHistory: db.BudgetHistory{ID: 2, OrgUuid: orgUUID, Created: nil, Updated: nil}, SenderName: "Sender2"}, + {BudgetHistory: db.BudgetHistory{ID: 1, OrgUuid: workspaceUUID, Created: nil, Updated: nil}, SenderName: "Sender1"}, + {BudgetHistory: db.BudgetHistory{ID: 2, OrgUuid: workspaceUUID, Created: nil, Updated: nil}, SenderName: "Sender2"}, } mockUserHasAccess := func(pubKeyFromAuth string, uuid string, role string) bool { @@ -506,11 +506,11 @@ func TestGetWorkspaceBudgetHistory(t *testing.T) { } oHandler.userHasAccess = mockUserHasAccess - mockDb.On("GetWorkspaceBudgetHistory", orgUUID).Return(expectedBudgetHistory).Once() + mockDb.On("GetWorkspaceBudgetHistory", workspaceUUID).Return(expectedBudgetHistory).Once() rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/budget/history/"+orgUUID, nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/budget/history/"+workspaceUUID, nil) if err != nil { t.Fatal(err) } @@ -535,15 +535,15 @@ func TestGetWorkspaceBountiesCount(t *testing.T) { mockDb := mocks.NewDatabase(t) oHandler := NewWorkspaceHandler(mockDb) - t.Run("should return the count of organization bounties", func(t *testing.T) { - orgUUID := "valid-uuid" + t.Run("should return the count of workspace bounties", func(t *testing.T) { + workspaceUUID := "valid-uuid" expectedCount := int64(5) - mockDb.On("GetWorkspaceBountiesCount", mock.AnythingOfType("*http.Request"), orgUUID).Return(expectedCount).Once() + mockDb.On("GetWorkspaceBountiesCount", mock.AnythingOfType("*http.Request"), workspaceUUID).Return(expectedCount).Once() rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", orgUUID) - req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/bounties/"+orgUUID+"/count/", nil) + rctx.URLParams.Add("uuid", workspaceUUID) + req, err := http.NewRequestWithContext(context.WithValue(ctx, chi.RouteCtxKey, rctx), http.MethodGet, "/bounties/"+workspaceUUID+"/count/", nil) if err != nil { t.Fatal(err) } diff --git a/mocks/Database.go b/mocks/Database.go index c55befc41..784a2492a 100644 --- a/mocks/Database.go +++ b/mocks/Database.go @@ -26,18 +26,18 @@ func (_m *Database) EXPECT() *Database_Expecter { } // AddAndUpdateBudget provides a mock function with given fields: invoice -func (_m *Database) AddAndUpdateBudget(invoice db.InvoiceList) db.PaymentHistory { +func (_m *Database) AddAndUpdateBudget(invoice db.NewInvoiceList) db.NewPaymentHistory { ret := _m.Called(invoice) if len(ret) == 0 { panic("no return value specified for AddAndUpdateBudget") } - var r0 db.PaymentHistory - if rf, ok := ret.Get(0).(func(db.InvoiceList) db.PaymentHistory); ok { + var r0 db.NewPaymentHistory + if rf, ok := ret.Get(0).(func(db.NewInvoiceList) db.NewPaymentHistory); ok { r0 = rf(invoice) } else { - r0 = ret.Get(0).(db.PaymentHistory) + r0 = ret.Get(0).(db.NewPaymentHistory) } return r0 @@ -49,24 +49,24 @@ type Database_AddAndUpdateBudget_Call struct { } // AddAndUpdateBudget is a helper method to define mock.On call -// - invoice db.InvoiceList +// - invoice db.NewInvoiceList func (_e *Database_Expecter) AddAndUpdateBudget(invoice interface{}) *Database_AddAndUpdateBudget_Call { return &Database_AddAndUpdateBudget_Call{Call: _e.mock.On("AddAndUpdateBudget", invoice)} } -func (_c *Database_AddAndUpdateBudget_Call) Run(run func(invoice db.InvoiceList)) *Database_AddAndUpdateBudget_Call { +func (_c *Database_AddAndUpdateBudget_Call) Run(run func(invoice db.NewInvoiceList)) *Database_AddAndUpdateBudget_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.InvoiceList)) + run(args[0].(db.NewInvoiceList)) }) return _c } -func (_c *Database_AddAndUpdateBudget_Call) Return(_a0 db.PaymentHistory) *Database_AddAndUpdateBudget_Call { +func (_c *Database_AddAndUpdateBudget_Call) Return(_a0 db.NewPaymentHistory) *Database_AddAndUpdateBudget_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_AddAndUpdateBudget_Call) RunAndReturn(run func(db.InvoiceList) db.PaymentHistory) *Database_AddAndUpdateBudget_Call { +func (_c *Database_AddAndUpdateBudget_Call) RunAndReturn(run func(db.NewInvoiceList) db.NewPaymentHistory) *Database_AddAndUpdateBudget_Call { _c.Call.Return(run) return _c } @@ -174,18 +174,18 @@ func (_c *Database_AddBudgetHistory_Call) RunAndReturn(run func(db.BudgetHistory } // AddInvoice provides a mock function with given fields: invoice -func (_m *Database) AddInvoice(invoice db.InvoiceList) db.InvoiceList { +func (_m *Database) AddInvoice(invoice db.NewInvoiceList) db.NewInvoiceList { ret := _m.Called(invoice) if len(ret) == 0 { panic("no return value specified for AddInvoice") } - var r0 db.InvoiceList - if rf, ok := ret.Get(0).(func(db.InvoiceList) db.InvoiceList); ok { + var r0 db.NewInvoiceList + if rf, ok := ret.Get(0).(func(db.NewInvoiceList) db.NewInvoiceList); ok { r0 = rf(invoice) } else { - r0 = ret.Get(0).(db.InvoiceList) + r0 = ret.Get(0).(db.NewInvoiceList) } return r0 @@ -197,41 +197,41 @@ type Database_AddInvoice_Call struct { } // AddInvoice is a helper method to define mock.On call -// - invoice db.InvoiceList +// - invoice db.NewInvoiceList func (_e *Database_Expecter) AddInvoice(invoice interface{}) *Database_AddInvoice_Call { return &Database_AddInvoice_Call{Call: _e.mock.On("AddInvoice", invoice)} } -func (_c *Database_AddInvoice_Call) Run(run func(invoice db.InvoiceList)) *Database_AddInvoice_Call { +func (_c *Database_AddInvoice_Call) Run(run func(invoice db.NewInvoiceList)) *Database_AddInvoice_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.InvoiceList)) + run(args[0].(db.NewInvoiceList)) }) return _c } -func (_c *Database_AddInvoice_Call) Return(_a0 db.InvoiceList) *Database_AddInvoice_Call { +func (_c *Database_AddInvoice_Call) Return(_a0 db.NewInvoiceList) *Database_AddInvoice_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_AddInvoice_Call) RunAndReturn(run func(db.InvoiceList) db.InvoiceList) *Database_AddInvoice_Call { +func (_c *Database_AddInvoice_Call) RunAndReturn(run func(db.NewInvoiceList) db.NewInvoiceList) *Database_AddInvoice_Call { _c.Call.Return(run) return _c } // AddPaymentHistory provides a mock function with given fields: payment -func (_m *Database) AddPaymentHistory(payment db.PaymentHistory) db.PaymentHistory { +func (_m *Database) AddPaymentHistory(payment db.NewPaymentHistory) db.NewPaymentHistory { ret := _m.Called(payment) if len(ret) == 0 { panic("no return value specified for AddPaymentHistory") } - var r0 db.PaymentHistory - if rf, ok := ret.Get(0).(func(db.PaymentHistory) db.PaymentHistory); ok { + var r0 db.NewPaymentHistory + if rf, ok := ret.Get(0).(func(db.NewPaymentHistory) db.NewPaymentHistory); ok { r0 = rf(payment) } else { - r0 = ret.Get(0).(db.PaymentHistory) + r0 = ret.Get(0).(db.NewPaymentHistory) } return r0 @@ -243,24 +243,24 @@ type Database_AddPaymentHistory_Call struct { } // AddPaymentHistory is a helper method to define mock.On call -// - payment db.PaymentHistory +// - payment db.NewPaymentHistory func (_e *Database_Expecter) AddPaymentHistory(payment interface{}) *Database_AddPaymentHistory_Call { return &Database_AddPaymentHistory_Call{Call: _e.mock.On("AddPaymentHistory", payment)} } -func (_c *Database_AddPaymentHistory_Call) Run(run func(payment db.PaymentHistory)) *Database_AddPaymentHistory_Call { +func (_c *Database_AddPaymentHistory_Call) Run(run func(payment db.NewPaymentHistory)) *Database_AddPaymentHistory_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.PaymentHistory)) + run(args[0].(db.NewPaymentHistory)) }) return _c } -func (_c *Database_AddPaymentHistory_Call) Return(_a0 db.PaymentHistory) *Database_AddPaymentHistory_Call { +func (_c *Database_AddPaymentHistory_Call) Return(_a0 db.NewPaymentHistory) *Database_AddPaymentHistory_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_AddPaymentHistory_Call) RunAndReturn(run func(db.PaymentHistory) db.PaymentHistory) *Database_AddPaymentHistory_Call { +func (_c *Database_AddPaymentHistory_Call) RunAndReturn(run func(db.NewPaymentHistory) db.NewPaymentHistory) *Database_AddPaymentHistory_Call { _c.Call.Return(run) return _c } @@ -449,19 +449,19 @@ func (_c *Database_BountiesPaidPercentage_Call) RunAndReturn(run func(db.Payment return _c } -// ChangeWorkspaceDeleteStatus provides a mock function with given fields: org_uuid, status -func (_m *Database) ChangeWorkspaceDeleteStatus(org_uuid string, status bool) db.Organization { - ret := _m.Called(org_uuid, status) +// ChangeWorkspaceDeleteStatus provides a mock function with given fields: workspace_uuid, status +func (_m *Database) ChangeWorkspaceDeleteStatus(workspace_uuid string, status bool) db.Workspace { + ret := _m.Called(workspace_uuid, status) if len(ret) == 0 { panic("no return value specified for ChangeWorkspaceDeleteStatus") } - var r0 db.Organization - if rf, ok := ret.Get(0).(func(string, bool) db.Organization); ok { - r0 = rf(org_uuid, status) + var r0 db.Workspace + if rf, ok := ret.Get(0).(func(string, bool) db.Workspace); ok { + r0 = rf(workspace_uuid, status) } else { - r0 = ret.Get(0).(db.Organization) + r0 = ret.Get(0).(db.Workspace) } return r0 @@ -473,25 +473,25 @@ type Database_ChangeWorkspaceDeleteStatus_Call struct { } // ChangeWorkspaceDeleteStatus is a helper method to define mock.On call -// - org_uuid string +// - workspace_uuid string // - status bool -func (_e *Database_Expecter) ChangeWorkspaceDeleteStatus(org_uuid interface{}, status interface{}) *Database_ChangeWorkspaceDeleteStatus_Call { - return &Database_ChangeWorkspaceDeleteStatus_Call{Call: _e.mock.On("ChangeWorkspaceDeleteStatus", org_uuid, status)} +func (_e *Database_Expecter) ChangeWorkspaceDeleteStatus(workspace_uuid interface{}, status interface{}) *Database_ChangeWorkspaceDeleteStatus_Call { + return &Database_ChangeWorkspaceDeleteStatus_Call{Call: _e.mock.On("ChangeWorkspaceDeleteStatus", workspace_uuid, status)} } -func (_c *Database_ChangeWorkspaceDeleteStatus_Call) Run(run func(org_uuid string, status bool)) *Database_ChangeWorkspaceDeleteStatus_Call { +func (_c *Database_ChangeWorkspaceDeleteStatus_Call) Run(run func(workspace_uuid string, status bool)) *Database_ChangeWorkspaceDeleteStatus_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string), args[1].(bool)) }) return _c } -func (_c *Database_ChangeWorkspaceDeleteStatus_Call) Return(_a0 db.Organization) *Database_ChangeWorkspaceDeleteStatus_Call { +func (_c *Database_ChangeWorkspaceDeleteStatus_Call) Return(_a0 db.Workspace) *Database_ChangeWorkspaceDeleteStatus_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_ChangeWorkspaceDeleteStatus_Call) RunAndReturn(run func(string, bool) db.Organization) *Database_ChangeWorkspaceDeleteStatus_Call { +func (_c *Database_ChangeWorkspaceDeleteStatus_Call) RunAndReturn(run func(string, bool) db.Workspace) *Database_ChangeWorkspaceDeleteStatus_Call { _c.Call.Return(run) return _c } @@ -872,25 +872,25 @@ func (_c *Database_CreateOrEditBot_Call) RunAndReturn(run func(db.Bot) (db.Bot, } // CreateOrEditBounty provides a mock function with given fields: b -func (_m *Database) CreateOrEditBounty(b db.Bounty) (db.Bounty, error) { +func (_m *Database) CreateOrEditBounty(b db.NewBounty) (db.NewBounty, error) { ret := _m.Called(b) if len(ret) == 0 { panic("no return value specified for CreateOrEditBounty") } - var r0 db.Bounty + var r0 db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(db.Bounty) (db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(db.NewBounty) (db.NewBounty, error)); ok { return rf(b) } - if rf, ok := ret.Get(0).(func(db.Bounty) db.Bounty); ok { + if rf, ok := ret.Get(0).(func(db.NewBounty) db.NewBounty); ok { r0 = rf(b) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } - if rf, ok := ret.Get(1).(func(db.Bounty) error); ok { + if rf, ok := ret.Get(1).(func(db.NewBounty) error); ok { r1 = rf(b) } else { r1 = ret.Error(1) @@ -905,24 +905,24 @@ type Database_CreateOrEditBounty_Call struct { } // CreateOrEditBounty is a helper method to define mock.On call -// - b db.Bounty +// - b db.NewBounty func (_e *Database_Expecter) CreateOrEditBounty(b interface{}) *Database_CreateOrEditBounty_Call { return &Database_CreateOrEditBounty_Call{Call: _e.mock.On("CreateOrEditBounty", b)} } -func (_c *Database_CreateOrEditBounty_Call) Run(run func(b db.Bounty)) *Database_CreateOrEditBounty_Call { +func (_c *Database_CreateOrEditBounty_Call) Run(run func(b db.NewBounty)) *Database_CreateOrEditBounty_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.Bounty)) + run(args[0].(db.NewBounty)) }) return _c } -func (_c *Database_CreateOrEditBounty_Call) Return(_a0 db.Bounty, _a1 error) *Database_CreateOrEditBounty_Call { +func (_c *Database_CreateOrEditBounty_Call) Return(_a0 db.NewBounty, _a1 error) *Database_CreateOrEditBounty_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_CreateOrEditBounty_Call) RunAndReturn(run func(db.Bounty) (db.Bounty, error)) *Database_CreateOrEditBounty_Call { +func (_c *Database_CreateOrEditBounty_Call) RunAndReturn(run func(db.NewBounty) (db.NewBounty, error)) *Database_CreateOrEditBounty_Call { _c.Call.Return(run) return _c } @@ -1040,25 +1040,25 @@ func (_c *Database_CreateOrEditTribe_Call) RunAndReturn(run func(db.Tribe) (db.T } // CreateOrEditWorkspace provides a mock function with given fields: m -func (_m *Database) CreateOrEditWorkspace(m db.Organization) (db.Organization, error) { +func (_m *Database) CreateOrEditWorkspace(m db.Workspace) (db.Workspace, error) { ret := _m.Called(m) if len(ret) == 0 { panic("no return value specified for CreateOrEditWorkspace") } - var r0 db.Organization + var r0 db.Workspace var r1 error - if rf, ok := ret.Get(0).(func(db.Organization) (db.Organization, error)); ok { + if rf, ok := ret.Get(0).(func(db.Workspace) (db.Workspace, error)); ok { return rf(m) } - if rf, ok := ret.Get(0).(func(db.Organization) db.Organization); ok { + if rf, ok := ret.Get(0).(func(db.Workspace) db.Workspace); ok { r0 = rf(m) } else { - r0 = ret.Get(0).(db.Organization) + r0 = ret.Get(0).(db.Workspace) } - if rf, ok := ret.Get(1).(func(db.Organization) error); ok { + if rf, ok := ret.Get(1).(func(db.Workspace) error); ok { r1 = rf(m) } else { r1 = ret.Error(1) @@ -1073,42 +1073,42 @@ type Database_CreateOrEditWorkspace_Call struct { } // CreateOrEditWorkspace is a helper method to define mock.On call -// - m db.Organization +// - m db.Workspace func (_e *Database_Expecter) CreateOrEditWorkspace(m interface{}) *Database_CreateOrEditWorkspace_Call { return &Database_CreateOrEditWorkspace_Call{Call: _e.mock.On("CreateOrEditWorkspace", m)} } -func (_c *Database_CreateOrEditWorkspace_Call) Run(run func(m db.Organization)) *Database_CreateOrEditWorkspace_Call { +func (_c *Database_CreateOrEditWorkspace_Call) Run(run func(m db.Workspace)) *Database_CreateOrEditWorkspace_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.Organization)) + run(args[0].(db.Workspace)) }) return _c } -func (_c *Database_CreateOrEditWorkspace_Call) Return(_a0 db.Organization, _a1 error) *Database_CreateOrEditWorkspace_Call { +func (_c *Database_CreateOrEditWorkspace_Call) Return(_a0 db.Workspace, _a1 error) *Database_CreateOrEditWorkspace_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_CreateOrEditWorkspace_Call) RunAndReturn(run func(db.Organization) (db.Organization, error)) *Database_CreateOrEditWorkspace_Call { +func (_c *Database_CreateOrEditWorkspace_Call) RunAndReturn(run func(db.Workspace) (db.Workspace, error)) *Database_CreateOrEditWorkspace_Call { _c.Call.Return(run) return _c } // CreateUserRoles provides a mock function with given fields: roles, uuid, pubkey -func (_m *Database) CreateUserRoles(roles []db.UserRoles, uuid string, pubkey string) []db.UserRoles { +func (_m *Database) CreateUserRoles(roles []db.WorkspaceUserRoles, uuid string, pubkey string) []db.WorkspaceUserRoles { ret := _m.Called(roles, uuid, pubkey) if len(ret) == 0 { panic("no return value specified for CreateUserRoles") } - var r0 []db.UserRoles - if rf, ok := ret.Get(0).(func([]db.UserRoles, string, string) []db.UserRoles); ok { + var r0 []db.WorkspaceUserRoles + if rf, ok := ret.Get(0).(func([]db.WorkspaceUserRoles, string, string) []db.WorkspaceUserRoles); ok { r0 = rf(roles, uuid, pubkey) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.UserRoles) + r0 = ret.Get(0).([]db.WorkspaceUserRoles) } } @@ -1121,43 +1121,43 @@ type Database_CreateUserRoles_Call struct { } // CreateUserRoles is a helper method to define mock.On call -// - roles []db.UserRoles +// - roles []db.WorkspaceUserRoles // - uuid string // - pubkey string func (_e *Database_Expecter) CreateUserRoles(roles interface{}, uuid interface{}, pubkey interface{}) *Database_CreateUserRoles_Call { return &Database_CreateUserRoles_Call{Call: _e.mock.On("CreateUserRoles", roles, uuid, pubkey)} } -func (_c *Database_CreateUserRoles_Call) Run(run func(roles []db.UserRoles, uuid string, pubkey string)) *Database_CreateUserRoles_Call { +func (_c *Database_CreateUserRoles_Call) Run(run func(roles []db.WorkspaceUserRoles, uuid string, pubkey string)) *Database_CreateUserRoles_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]db.UserRoles), args[1].(string), args[2].(string)) + run(args[0].([]db.WorkspaceUserRoles), args[1].(string), args[2].(string)) }) return _c } -func (_c *Database_CreateUserRoles_Call) Return(_a0 []db.UserRoles) *Database_CreateUserRoles_Call { +func (_c *Database_CreateUserRoles_Call) Return(_a0 []db.WorkspaceUserRoles) *Database_CreateUserRoles_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_CreateUserRoles_Call) RunAndReturn(run func([]db.UserRoles, string, string) []db.UserRoles) *Database_CreateUserRoles_Call { +func (_c *Database_CreateUserRoles_Call) RunAndReturn(run func([]db.WorkspaceUserRoles, string, string) []db.WorkspaceUserRoles) *Database_CreateUserRoles_Call { _c.Call.Return(run) return _c } // CreateWorkspaceBudget provides a mock function with given fields: budget -func (_m *Database) CreateWorkspaceBudget(budget db.BountyBudget) db.BountyBudget { +func (_m *Database) CreateWorkspaceBudget(budget db.NewBountyBudget) db.NewBountyBudget { ret := _m.Called(budget) if len(ret) == 0 { panic("no return value specified for CreateWorkspaceBudget") } - var r0 db.BountyBudget - if rf, ok := ret.Get(0).(func(db.BountyBudget) db.BountyBudget); ok { + var r0 db.NewBountyBudget + if rf, ok := ret.Get(0).(func(db.NewBountyBudget) db.NewBountyBudget); ok { r0 = rf(budget) } else { - r0 = ret.Get(0).(db.BountyBudget) + r0 = ret.Get(0).(db.NewBountyBudget) } return r0 @@ -1169,41 +1169,41 @@ type Database_CreateWorkspaceBudget_Call struct { } // CreateWorkspaceBudget is a helper method to define mock.On call -// - budget db.BountyBudget +// - budget db.NewBountyBudget func (_e *Database_Expecter) CreateWorkspaceBudget(budget interface{}) *Database_CreateWorkspaceBudget_Call { return &Database_CreateWorkspaceBudget_Call{Call: _e.mock.On("CreateWorkspaceBudget", budget)} } -func (_c *Database_CreateWorkspaceBudget_Call) Run(run func(budget db.BountyBudget)) *Database_CreateWorkspaceBudget_Call { +func (_c *Database_CreateWorkspaceBudget_Call) Run(run func(budget db.NewBountyBudget)) *Database_CreateWorkspaceBudget_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.BountyBudget)) + run(args[0].(db.NewBountyBudget)) }) return _c } -func (_c *Database_CreateWorkspaceBudget_Call) Return(_a0 db.BountyBudget) *Database_CreateWorkspaceBudget_Call { +func (_c *Database_CreateWorkspaceBudget_Call) Return(_a0 db.NewBountyBudget) *Database_CreateWorkspaceBudget_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_CreateWorkspaceBudget_Call) RunAndReturn(run func(db.BountyBudget) db.BountyBudget) *Database_CreateWorkspaceBudget_Call { +func (_c *Database_CreateWorkspaceBudget_Call) RunAndReturn(run func(db.NewBountyBudget) db.NewBountyBudget) *Database_CreateWorkspaceBudget_Call { _c.Call.Return(run) return _c } // CreateWorkspaceUser provides a mock function with given fields: orgUser -func (_m *Database) CreateWorkspaceUser(orgUser db.OrganizationUsers) db.OrganizationUsers { +func (_m *Database) CreateWorkspaceUser(orgUser db.WorkspaceUsers) db.WorkspaceUsers { ret := _m.Called(orgUser) if len(ret) == 0 { panic("no return value specified for CreateWorkspaceUser") } - var r0 db.OrganizationUsers - if rf, ok := ret.Get(0).(func(db.OrganizationUsers) db.OrganizationUsers); ok { + var r0 db.WorkspaceUsers + if rf, ok := ret.Get(0).(func(db.WorkspaceUsers) db.WorkspaceUsers); ok { r0 = rf(orgUser) } else { - r0 = ret.Get(0).(db.OrganizationUsers) + r0 = ret.Get(0).(db.WorkspaceUsers) } return r0 @@ -1215,24 +1215,24 @@ type Database_CreateWorkspaceUser_Call struct { } // CreateWorkspaceUser is a helper method to define mock.On call -// - orgUser db.OrganizationUsers +// - orgUser db.WorkspaceUsers func (_e *Database_Expecter) CreateWorkspaceUser(orgUser interface{}) *Database_CreateWorkspaceUser_Call { return &Database_CreateWorkspaceUser_Call{Call: _e.mock.On("CreateWorkspaceUser", orgUser)} } -func (_c *Database_CreateWorkspaceUser_Call) Run(run func(orgUser db.OrganizationUsers)) *Database_CreateWorkspaceUser_Call { +func (_c *Database_CreateWorkspaceUser_Call) Run(run func(orgUser db.WorkspaceUsers)) *Database_CreateWorkspaceUser_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.OrganizationUsers)) + run(args[0].(db.WorkspaceUsers)) }) return _c } -func (_c *Database_CreateWorkspaceUser_Call) Return(_a0 db.OrganizationUsers) *Database_CreateWorkspaceUser_Call { +func (_c *Database_CreateWorkspaceUser_Call) Return(_a0 db.WorkspaceUsers) *Database_CreateWorkspaceUser_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_CreateWorkspaceUser_Call) RunAndReturn(run func(db.OrganizationUsers) db.OrganizationUsers) *Database_CreateWorkspaceUser_Call { +func (_c *Database_CreateWorkspaceUser_Call) RunAndReturn(run func(db.WorkspaceUsers) db.WorkspaceUsers) *Database_CreateWorkspaceUser_Call { _c.Call.Return(run) return _c } @@ -1284,22 +1284,22 @@ func (_c *Database_DeleteAllUsersFromWorkspace_Call) RunAndReturn(run func(strin } // DeleteBounty provides a mock function with given fields: pubkey, created -func (_m *Database) DeleteBounty(pubkey string, created string) (db.Bounty, error) { +func (_m *Database) DeleteBounty(pubkey string, created string) (db.NewBounty, error) { ret := _m.Called(pubkey, created) if len(ret) == 0 { panic("no return value specified for DeleteBounty") } - var r0 db.Bounty + var r0 db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(string, string) (db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(string, string) (db.NewBounty, error)); ok { return rf(pubkey, created) } - if rf, ok := ret.Get(0).(func(string, string) db.Bounty); ok { + if rf, ok := ret.Get(0).(func(string, string) db.NewBounty); ok { r0 = rf(pubkey, created) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } if rf, ok := ret.Get(1).(func(string, string) error); ok { @@ -1330,12 +1330,12 @@ func (_c *Database_DeleteBounty_Call) Run(run func(pubkey string, created string return _c } -func (_c *Database_DeleteBounty_Call) Return(_a0 db.Bounty, _a1 error) *Database_DeleteBounty_Call { +func (_c *Database_DeleteBounty_Call) Return(_a0 db.NewBounty, _a1 error) *Database_DeleteBounty_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_DeleteBounty_Call) RunAndReturn(run func(string, string) (db.Bounty, error)) *Database_DeleteBounty_Call { +func (_c *Database_DeleteBounty_Call) RunAndReturn(run func(string, string) (db.NewBounty, error)) *Database_DeleteBounty_Call { _c.Call.Return(run) return _c } @@ -1387,18 +1387,18 @@ func (_c *Database_DeleteUserInvoiceData_Call) RunAndReturn(run func(string) db. } // DeleteWorkspaceUser provides a mock function with given fields: orgUser, org -func (_m *Database) DeleteWorkspaceUser(orgUser db.OrganizationUsersData, org string) db.OrganizationUsersData { +func (_m *Database) DeleteWorkspaceUser(orgUser db.WorkspaceUsersData, org string) db.WorkspaceUsersData { ret := _m.Called(orgUser, org) if len(ret) == 0 { panic("no return value specified for DeleteWorkspaceUser") } - var r0 db.OrganizationUsersData - if rf, ok := ret.Get(0).(func(db.OrganizationUsersData, string) db.OrganizationUsersData); ok { + var r0 db.WorkspaceUsersData + if rf, ok := ret.Get(0).(func(db.WorkspaceUsersData, string) db.WorkspaceUsersData); ok { r0 = rf(orgUser, org) } else { - r0 = ret.Get(0).(db.OrganizationUsersData) + r0 = ret.Get(0).(db.WorkspaceUsersData) } return r0 @@ -1410,43 +1410,43 @@ type Database_DeleteWorkspaceUser_Call struct { } // DeleteWorkspaceUser is a helper method to define mock.On call -// - orgUser db.OrganizationUsersData +// - orgUser db.WorkspaceUsersData // - org string func (_e *Database_Expecter) DeleteWorkspaceUser(orgUser interface{}, org interface{}) *Database_DeleteWorkspaceUser_Call { return &Database_DeleteWorkspaceUser_Call{Call: _e.mock.On("DeleteWorkspaceUser", orgUser, org)} } -func (_c *Database_DeleteWorkspaceUser_Call) Run(run func(orgUser db.OrganizationUsersData, org string)) *Database_DeleteWorkspaceUser_Call { +func (_c *Database_DeleteWorkspaceUser_Call) Run(run func(orgUser db.WorkspaceUsersData, org string)) *Database_DeleteWorkspaceUser_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.OrganizationUsersData), args[1].(string)) + run(args[0].(db.WorkspaceUsersData), args[1].(string)) }) return _c } -func (_c *Database_DeleteWorkspaceUser_Call) Return(_a0 db.OrganizationUsersData) *Database_DeleteWorkspaceUser_Call { +func (_c *Database_DeleteWorkspaceUser_Call) Return(_a0 db.WorkspaceUsersData) *Database_DeleteWorkspaceUser_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_DeleteWorkspaceUser_Call) RunAndReturn(run func(db.OrganizationUsersData, string) db.OrganizationUsersData) *Database_DeleteWorkspaceUser_Call { +func (_c *Database_DeleteWorkspaceUser_Call) RunAndReturn(run func(db.WorkspaceUsersData, string) db.WorkspaceUsersData) *Database_DeleteWorkspaceUser_Call { _c.Call.Return(run) return _c } // GetAllBounties provides a mock function with given fields: r -func (_m *Database) GetAllBounties(r *http.Request) []db.Bounty { +func (_m *Database) GetAllBounties(r *http.Request) []db.NewBounty { ret := _m.Called(r) if len(ret) == 0 { panic("no return value specified for GetAllBounties") } - var r0 []db.Bounty - if rf, ok := ret.Get(0).(func(*http.Request) []db.Bounty); ok { + var r0 []db.NewBounty + if rf, ok := ret.Get(0).(func(*http.Request) []db.NewBounty); ok { r0 = rf(r) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Bounty) + r0 = ret.Get(0).([]db.NewBounty) } } @@ -1471,12 +1471,12 @@ func (_c *Database_GetAllBounties_Call) Run(run func(r *http.Request)) *Database return _c } -func (_c *Database_GetAllBounties_Call) Return(_a0 []db.Bounty) *Database_GetAllBounties_Call { +func (_c *Database_GetAllBounties_Call) Return(_a0 []db.NewBounty) *Database_GetAllBounties_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetAllBounties_Call) RunAndReturn(run func(*http.Request) []db.Bounty) *Database_GetAllBounties_Call { +func (_c *Database_GetAllBounties_Call) RunAndReturn(run func(*http.Request) []db.NewBounty) *Database_GetAllBounties_Call { _c.Call.Return(run) return _c } @@ -1577,23 +1577,23 @@ func (_c *Database_GetAllTribesByOwner_Call) RunAndReturn(run func(string) []db. } // GetAssignedBounties provides a mock function with given fields: r -func (_m *Database) GetAssignedBounties(r *http.Request) ([]db.Bounty, error) { +func (_m *Database) GetAssignedBounties(r *http.Request) ([]db.NewBounty, error) { ret := _m.Called(r) if len(ret) == 0 { panic("no return value specified for GetAssignedBounties") } - var r0 []db.Bounty + var r0 []db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(*http.Request) ([]db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(*http.Request) ([]db.NewBounty, error)); ok { return rf(r) } - if rf, ok := ret.Get(0).(func(*http.Request) []db.Bounty); ok { + if rf, ok := ret.Get(0).(func(*http.Request) []db.NewBounty); ok { r0 = rf(r) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Bounty) + r0 = ret.Get(0).([]db.NewBounty) } } @@ -1624,12 +1624,12 @@ func (_c *Database_GetAssignedBounties_Call) Run(run func(r *http.Request)) *Dat return _c } -func (_c *Database_GetAssignedBounties_Call) Return(_a0 []db.Bounty, _a1 error) *Database_GetAssignedBounties_Call { +func (_c *Database_GetAssignedBounties_Call) Return(_a0 []db.NewBounty, _a1 error) *Database_GetAssignedBounties_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_GetAssignedBounties_Call) RunAndReturn(run func(*http.Request) ([]db.Bounty, error)) *Database_GetAssignedBounties_Call { +func (_c *Database_GetAssignedBounties_Call) RunAndReturn(run func(*http.Request) ([]db.NewBounty, error)) *Database_GetAssignedBounties_Call { _c.Call.Return(run) return _c } @@ -2013,18 +2013,18 @@ func (_c *Database_GetBountiesProviders_Call) RunAndReturn(run func(db.PaymentDa } // GetBounty provides a mock function with given fields: id -func (_m *Database) GetBounty(id uint) db.Bounty { +func (_m *Database) GetBounty(id uint) db.NewBounty { ret := _m.Called(id) if len(ret) == 0 { panic("no return value specified for GetBounty") } - var r0 db.Bounty - if rf, ok := ret.Get(0).(func(uint) db.Bounty); ok { + var r0 db.NewBounty + if rf, ok := ret.Get(0).(func(uint) db.NewBounty); ok { r0 = rf(id) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } return r0 @@ -2048,33 +2048,33 @@ func (_c *Database_GetBounty_Call) Run(run func(id uint)) *Database_GetBounty_Ca return _c } -func (_c *Database_GetBounty_Call) Return(_a0 db.Bounty) *Database_GetBounty_Call { +func (_c *Database_GetBounty_Call) Return(_a0 db.NewBounty) *Database_GetBounty_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetBounty_Call) RunAndReturn(run func(uint) db.Bounty) *Database_GetBounty_Call { +func (_c *Database_GetBounty_Call) RunAndReturn(run func(uint) db.NewBounty) *Database_GetBounty_Call { _c.Call.Return(run) return _c } // GetBountyByCreated provides a mock function with given fields: created -func (_m *Database) GetBountyByCreated(created uint) (db.Bounty, error) { +func (_m *Database) GetBountyByCreated(created uint) (db.NewBounty, error) { ret := _m.Called(created) if len(ret) == 0 { panic("no return value specified for GetBountyByCreated") } - var r0 db.Bounty + var r0 db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(uint) (db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(uint) (db.NewBounty, error)); ok { return rf(created) } - if rf, ok := ret.Get(0).(func(uint) db.Bounty); ok { + if rf, ok := ret.Get(0).(func(uint) db.NewBounty); ok { r0 = rf(created) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } if rf, ok := ret.Get(1).(func(uint) error); ok { @@ -2104,34 +2104,34 @@ func (_c *Database_GetBountyByCreated_Call) Run(run func(created uint)) *Databas return _c } -func (_c *Database_GetBountyByCreated_Call) Return(_a0 db.Bounty, _a1 error) *Database_GetBountyByCreated_Call { +func (_c *Database_GetBountyByCreated_Call) Return(_a0 db.NewBounty, _a1 error) *Database_GetBountyByCreated_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_GetBountyByCreated_Call) RunAndReturn(run func(uint) (db.Bounty, error)) *Database_GetBountyByCreated_Call { +func (_c *Database_GetBountyByCreated_Call) RunAndReturn(run func(uint) (db.NewBounty, error)) *Database_GetBountyByCreated_Call { _c.Call.Return(run) return _c } // GetBountyById provides a mock function with given fields: id -func (_m *Database) GetBountyById(id string) ([]db.Bounty, error) { +func (_m *Database) GetBountyById(id string) ([]db.NewBounty, error) { ret := _m.Called(id) if len(ret) == 0 { panic("no return value specified for GetBountyById") } - var r0 []db.Bounty + var r0 []db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(string) ([]db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(string) ([]db.NewBounty, error)); ok { return rf(id) } - if rf, ok := ret.Get(0).(func(string) []db.Bounty); ok { + if rf, ok := ret.Get(0).(func(string) []db.NewBounty); ok { r0 = rf(id) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Bounty) + r0 = ret.Get(0).([]db.NewBounty) } } @@ -2162,34 +2162,34 @@ func (_c *Database_GetBountyById_Call) Run(run func(id string)) *Database_GetBou return _c } -func (_c *Database_GetBountyById_Call) Return(_a0 []db.Bounty, _a1 error) *Database_GetBountyById_Call { +func (_c *Database_GetBountyById_Call) Return(_a0 []db.NewBounty, _a1 error) *Database_GetBountyById_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_GetBountyById_Call) RunAndReturn(run func(string) ([]db.Bounty, error)) *Database_GetBountyById_Call { +func (_c *Database_GetBountyById_Call) RunAndReturn(run func(string) ([]db.NewBounty, error)) *Database_GetBountyById_Call { _c.Call.Return(run) return _c } // GetBountyDataByCreated provides a mock function with given fields: created -func (_m *Database) GetBountyDataByCreated(created string) ([]db.Bounty, error) { +func (_m *Database) GetBountyDataByCreated(created string) ([]db.NewBounty, error) { ret := _m.Called(created) if len(ret) == 0 { panic("no return value specified for GetBountyDataByCreated") } - var r0 []db.Bounty + var r0 []db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(string) ([]db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(string) ([]db.NewBounty, error)); ok { return rf(created) } - if rf, ok := ret.Get(0).(func(string) []db.Bounty); ok { + if rf, ok := ret.Get(0).(func(string) []db.NewBounty); ok { r0 = rf(created) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Bounty) + r0 = ret.Get(0).([]db.NewBounty) } } @@ -2220,12 +2220,12 @@ func (_c *Database_GetBountyDataByCreated_Call) Run(run func(created string)) *D return _c } -func (_c *Database_GetBountyDataByCreated_Call) Return(_a0 []db.Bounty, _a1 error) *Database_GetBountyDataByCreated_Call { +func (_c *Database_GetBountyDataByCreated_Call) Return(_a0 []db.NewBounty, _a1 error) *Database_GetBountyDataByCreated_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_GetBountyDataByCreated_Call) RunAndReturn(run func(string) ([]db.Bounty, error)) *Database_GetBountyDataByCreated_Call { +func (_c *Database_GetBountyDataByCreated_Call) RunAndReturn(run func(string) ([]db.NewBounty, error)) *Database_GetBountyDataByCreated_Call { _c.Call.Return(run) return _c } @@ -2463,23 +2463,23 @@ func (_c *Database_GetConnectionCode_Call) RunAndReturn(run func() db.Connection } // GetCreatedBounties provides a mock function with given fields: r -func (_m *Database) GetCreatedBounties(r *http.Request) ([]db.Bounty, error) { +func (_m *Database) GetCreatedBounties(r *http.Request) ([]db.NewBounty, error) { ret := _m.Called(r) if len(ret) == 0 { panic("no return value specified for GetCreatedBounties") } - var r0 []db.Bounty + var r0 []db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(*http.Request) ([]db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(*http.Request) ([]db.NewBounty, error)); ok { return rf(r) } - if rf, ok := ret.Get(0).(func(*http.Request) []db.Bounty); ok { + if rf, ok := ret.Get(0).(func(*http.Request) []db.NewBounty); ok { r0 = rf(r) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Bounty) + r0 = ret.Get(0).([]db.NewBounty) } } @@ -2510,12 +2510,12 @@ func (_c *Database_GetCreatedBounties_Call) Run(run func(r *http.Request)) *Data return _c } -func (_c *Database_GetCreatedBounties_Call) Return(_a0 []db.Bounty, _a1 error) *Database_GetCreatedBounties_Call { +func (_c *Database_GetCreatedBounties_Call) Return(_a0 []db.NewBounty, _a1 error) *Database_GetCreatedBounties_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_GetCreatedBounties_Call) RunAndReturn(run func(*http.Request) ([]db.Bounty, error)) *Database_GetCreatedBounties_Call { +func (_c *Database_GetCreatedBounties_Call) RunAndReturn(run func(*http.Request) ([]db.NewBounty, error)) *Database_GetCreatedBounties_Call { _c.Call.Return(run) return _c } @@ -2612,18 +2612,18 @@ func (_c *Database_GetFirstTribeByFeedURL_Call) RunAndReturn(run func(string) db } // GetInvoice provides a mock function with given fields: payment_request -func (_m *Database) GetInvoice(payment_request string) db.InvoiceList { +func (_m *Database) GetInvoice(payment_request string) db.NewInvoiceList { ret := _m.Called(payment_request) if len(ret) == 0 { panic("no return value specified for GetInvoice") } - var r0 db.InvoiceList - if rf, ok := ret.Get(0).(func(string) db.InvoiceList); ok { + var r0 db.NewInvoiceList + if rf, ok := ret.Get(0).(func(string) db.NewInvoiceList); ok { r0 = rf(payment_request) } else { - r0 = ret.Get(0).(db.InvoiceList) + r0 = ret.Get(0).(db.NewInvoiceList) } return r0 @@ -2647,12 +2647,12 @@ func (_c *Database_GetInvoice_Call) Run(run func(payment_request string)) *Datab return _c } -func (_c *Database_GetInvoice_Call) Return(_a0 db.InvoiceList) *Database_GetInvoice_Call { +func (_c *Database_GetInvoice_Call) Return(_a0 db.NewInvoiceList) *Database_GetInvoice_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetInvoice_Call) RunAndReturn(run func(string) db.InvoiceList) *Database_GetInvoice_Call { +func (_c *Database_GetInvoice_Call) RunAndReturn(run func(string) db.NewInvoiceList) *Database_GetInvoice_Call { _c.Call.Return(run) return _c } @@ -3226,20 +3226,20 @@ func (_c *Database_GetOpenGithubIssues_Call) RunAndReturn(run func(*http.Request return _c } -// GetPaymentHistory provides a mock function with given fields: org_uuid, r -func (_m *Database) GetPaymentHistory(org_uuid string, r *http.Request) []db.PaymentHistory { - ret := _m.Called(org_uuid, r) +// GetPaymentHistory provides a mock function with given fields: workspace_uuid, r +func (_m *Database) GetPaymentHistory(workspace_uuid string, r *http.Request) []db.NewPaymentHistory { + ret := _m.Called(workspace_uuid, r) if len(ret) == 0 { panic("no return value specified for GetPaymentHistory") } - var r0 []db.PaymentHistory - if rf, ok := ret.Get(0).(func(string, *http.Request) []db.PaymentHistory); ok { - r0 = rf(org_uuid, r) + var r0 []db.NewPaymentHistory + if rf, ok := ret.Get(0).(func(string, *http.Request) []db.NewPaymentHistory); ok { + r0 = rf(workspace_uuid, r) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.PaymentHistory) + r0 = ret.Get(0).([]db.NewPaymentHistory) } } @@ -3252,42 +3252,42 @@ type Database_GetPaymentHistory_Call struct { } // GetPaymentHistory is a helper method to define mock.On call -// - org_uuid string +// - workspace_uuid string // - r *http.Request -func (_e *Database_Expecter) GetPaymentHistory(org_uuid interface{}, r interface{}) *Database_GetPaymentHistory_Call { - return &Database_GetPaymentHistory_Call{Call: _e.mock.On("GetPaymentHistory", org_uuid, r)} +func (_e *Database_Expecter) GetPaymentHistory(workspace_uuid interface{}, r interface{}) *Database_GetPaymentHistory_Call { + return &Database_GetPaymentHistory_Call{Call: _e.mock.On("GetPaymentHistory", workspace_uuid, r)} } -func (_c *Database_GetPaymentHistory_Call) Run(run func(org_uuid string, r *http.Request)) *Database_GetPaymentHistory_Call { +func (_c *Database_GetPaymentHistory_Call) Run(run func(workspace_uuid string, r *http.Request)) *Database_GetPaymentHistory_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string), args[1].(*http.Request)) }) return _c } -func (_c *Database_GetPaymentHistory_Call) Return(_a0 []db.PaymentHistory) *Database_GetPaymentHistory_Call { +func (_c *Database_GetPaymentHistory_Call) Return(_a0 []db.NewPaymentHistory) *Database_GetPaymentHistory_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetPaymentHistory_Call) RunAndReturn(run func(string, *http.Request) []db.PaymentHistory) *Database_GetPaymentHistory_Call { +func (_c *Database_GetPaymentHistory_Call) RunAndReturn(run func(string, *http.Request) []db.NewPaymentHistory) *Database_GetPaymentHistory_Call { _c.Call.Return(run) return _c } -// GetPaymentHistoryByCreated provides a mock function with given fields: created, org_uuid -func (_m *Database) GetPaymentHistoryByCreated(created *time.Time, org_uuid string) db.PaymentHistory { - ret := _m.Called(created, org_uuid) +// GetPaymentHistoryByCreated provides a mock function with given fields: created, workspace_uuid +func (_m *Database) GetPaymentHistoryByCreated(created *time.Time, workspace_uuid string) db.NewPaymentHistory { + ret := _m.Called(created, workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetPaymentHistoryByCreated") } - var r0 db.PaymentHistory - if rf, ok := ret.Get(0).(func(*time.Time, string) db.PaymentHistory); ok { - r0 = rf(created, org_uuid) + var r0 db.NewPaymentHistory + if rf, ok := ret.Get(0).(func(*time.Time, string) db.NewPaymentHistory); ok { + r0 = rf(created, workspace_uuid) } else { - r0 = ret.Get(0).(db.PaymentHistory) + r0 = ret.Get(0).(db.NewPaymentHistory) } return r0 @@ -3300,24 +3300,24 @@ type Database_GetPaymentHistoryByCreated_Call struct { // GetPaymentHistoryByCreated is a helper method to define mock.On call // - created *time.Time -// - org_uuid string -func (_e *Database_Expecter) GetPaymentHistoryByCreated(created interface{}, org_uuid interface{}) *Database_GetPaymentHistoryByCreated_Call { - return &Database_GetPaymentHistoryByCreated_Call{Call: _e.mock.On("GetPaymentHistoryByCreated", created, org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetPaymentHistoryByCreated(created interface{}, workspace_uuid interface{}) *Database_GetPaymentHistoryByCreated_Call { + return &Database_GetPaymentHistoryByCreated_Call{Call: _e.mock.On("GetPaymentHistoryByCreated", created, workspace_uuid)} } -func (_c *Database_GetPaymentHistoryByCreated_Call) Run(run func(created *time.Time, org_uuid string)) *Database_GetPaymentHistoryByCreated_Call { +func (_c *Database_GetPaymentHistoryByCreated_Call) Run(run func(created *time.Time, workspace_uuid string)) *Database_GetPaymentHistoryByCreated_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(*time.Time), args[1].(string)) }) return _c } -func (_c *Database_GetPaymentHistoryByCreated_Call) Return(_a0 db.PaymentHistory) *Database_GetPaymentHistoryByCreated_Call { +func (_c *Database_GetPaymentHistoryByCreated_Call) Return(_a0 db.NewPaymentHistory) *Database_GetPaymentHistoryByCreated_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetPaymentHistoryByCreated_Call) RunAndReturn(run func(*time.Time, string) db.PaymentHistory) *Database_GetPaymentHistoryByCreated_Call { +func (_c *Database_GetPaymentHistoryByCreated_Call) RunAndReturn(run func(*time.Time, string) db.NewPaymentHistory) *Database_GetPaymentHistoryByCreated_Call { _c.Call.Return(run) return _c } @@ -4135,19 +4135,19 @@ func (_c *Database_GetUnconfirmedTwitter_Call) RunAndReturn(run func() []db.Pers } // GetUserAssignedWorkspaces provides a mock function with given fields: pubkey -func (_m *Database) GetUserAssignedWorkspaces(pubkey string) []db.OrganizationUsers { +func (_m *Database) GetUserAssignedWorkspaces(pubkey string) []db.WorkspaceUsers { ret := _m.Called(pubkey) if len(ret) == 0 { panic("no return value specified for GetUserAssignedWorkspaces") } - var r0 []db.OrganizationUsers - if rf, ok := ret.Get(0).(func(string) []db.OrganizationUsers); ok { + var r0 []db.WorkspaceUsers + if rf, ok := ret.Get(0).(func(string) []db.WorkspaceUsers); ok { r0 = rf(pubkey) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.OrganizationUsers) + r0 = ret.Get(0).([]db.WorkspaceUsers) } } @@ -4172,12 +4172,12 @@ func (_c *Database_GetUserAssignedWorkspaces_Call) Run(run func(pubkey string)) return _c } -func (_c *Database_GetUserAssignedWorkspaces_Call) Return(_a0 []db.OrganizationUsers) *Database_GetUserAssignedWorkspaces_Call { +func (_c *Database_GetUserAssignedWorkspaces_Call) Return(_a0 []db.WorkspaceUsers) *Database_GetUserAssignedWorkspaces_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetUserAssignedWorkspaces_Call) RunAndReturn(run func(string) []db.OrganizationUsers) *Database_GetUserAssignedWorkspaces_Call { +func (_c *Database_GetUserAssignedWorkspaces_Call) RunAndReturn(run func(string) []db.WorkspaceUsers) *Database_GetUserAssignedWorkspaces_Call { _c.Call.Return(run) return _c } @@ -4230,19 +4230,19 @@ func (_c *Database_GetUserBountiesCount_Call) RunAndReturn(run func(string, stri } // GetUserCreatedWorkspaces provides a mock function with given fields: pubkey -func (_m *Database) GetUserCreatedWorkspaces(pubkey string) []db.Organization { +func (_m *Database) GetUserCreatedWorkspaces(pubkey string) []db.Workspace { ret := _m.Called(pubkey) if len(ret) == 0 { panic("no return value specified for GetUserCreatedWorkspaces") } - var r0 []db.Organization - if rf, ok := ret.Get(0).(func(string) []db.Organization); ok { + var r0 []db.Workspace + if rf, ok := ret.Get(0).(func(string) []db.Workspace); ok { r0 = rf(pubkey) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Organization) + r0 = ret.Get(0).([]db.Workspace) } } @@ -4267,12 +4267,12 @@ func (_c *Database_GetUserCreatedWorkspaces_Call) Run(run func(pubkey string)) * return _c } -func (_c *Database_GetUserCreatedWorkspaces_Call) Return(_a0 []db.Organization) *Database_GetUserCreatedWorkspaces_Call { +func (_c *Database_GetUserCreatedWorkspaces_Call) Return(_a0 []db.Workspace) *Database_GetUserCreatedWorkspaces_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetUserCreatedWorkspaces_Call) RunAndReturn(run func(string) []db.Organization) *Database_GetUserCreatedWorkspaces_Call { +func (_c *Database_GetUserCreatedWorkspaces_Call) RunAndReturn(run func(string) []db.Workspace) *Database_GetUserCreatedWorkspaces_Call { _c.Call.Return(run) return _c } @@ -4323,20 +4323,20 @@ func (_c *Database_GetUserInvoiceData_Call) RunAndReturn(run func(string) db.Use return _c } -// GetWorkspaceBounties provides a mock function with given fields: r, org_uuid -func (_m *Database) GetWorkspaceBounties(r *http.Request, org_uuid string) []db.Bounty { - ret := _m.Called(r, org_uuid) +// GetWorkspaceBounties provides a mock function with given fields: r, workspace_uuid +func (_m *Database) GetWorkspaceBounties(r *http.Request, workspace_uuid string) []db.NewBounty { + ret := _m.Called(r, workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceBounties") } - var r0 []db.Bounty - if rf, ok := ret.Get(0).(func(*http.Request, string) []db.Bounty); ok { - r0 = rf(r, org_uuid) + var r0 []db.NewBounty + if rf, ok := ret.Get(0).(func(*http.Request, string) []db.NewBounty); ok { + r0 = rf(r, workspace_uuid) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Bounty) + r0 = ret.Get(0).([]db.NewBounty) } } @@ -4350,31 +4350,31 @@ type Database_GetWorkspaceBounties_Call struct { // GetWorkspaceBounties is a helper method to define mock.On call // - r *http.Request -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceBounties(r interface{}, org_uuid interface{}) *Database_GetWorkspaceBounties_Call { - return &Database_GetWorkspaceBounties_Call{Call: _e.mock.On("GetWorkspaceBounties", r, org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceBounties(r interface{}, workspace_uuid interface{}) *Database_GetWorkspaceBounties_Call { + return &Database_GetWorkspaceBounties_Call{Call: _e.mock.On("GetWorkspaceBounties", r, workspace_uuid)} } -func (_c *Database_GetWorkspaceBounties_Call) Run(run func(r *http.Request, org_uuid string)) *Database_GetWorkspaceBounties_Call { +func (_c *Database_GetWorkspaceBounties_Call) Run(run func(r *http.Request, workspace_uuid string)) *Database_GetWorkspaceBounties_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(*http.Request), args[1].(string)) }) return _c } -func (_c *Database_GetWorkspaceBounties_Call) Return(_a0 []db.Bounty) *Database_GetWorkspaceBounties_Call { +func (_c *Database_GetWorkspaceBounties_Call) Return(_a0 []db.NewBounty) *Database_GetWorkspaceBounties_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetWorkspaceBounties_Call) RunAndReturn(run func(*http.Request, string) []db.Bounty) *Database_GetWorkspaceBounties_Call { +func (_c *Database_GetWorkspaceBounties_Call) RunAndReturn(run func(*http.Request, string) []db.NewBounty) *Database_GetWorkspaceBounties_Call { _c.Call.Return(run) return _c } -// GetWorkspaceBountiesCount provides a mock function with given fields: r, org_uuid -func (_m *Database) GetWorkspaceBountiesCount(r *http.Request, org_uuid string) int64 { - ret := _m.Called(r, org_uuid) +// GetWorkspaceBountiesCount provides a mock function with given fields: r, workspace_uuid +func (_m *Database) GetWorkspaceBountiesCount(r *http.Request, workspace_uuid string) int64 { + ret := _m.Called(r, workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceBountiesCount") @@ -4382,7 +4382,7 @@ func (_m *Database) GetWorkspaceBountiesCount(r *http.Request, org_uuid string) var r0 int64 if rf, ok := ret.Get(0).(func(*http.Request, string) int64); ok { - r0 = rf(r, org_uuid) + r0 = rf(r, workspace_uuid) } else { r0 = ret.Get(0).(int64) } @@ -4397,12 +4397,12 @@ type Database_GetWorkspaceBountiesCount_Call struct { // GetWorkspaceBountiesCount is a helper method to define mock.On call // - r *http.Request -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceBountiesCount(r interface{}, org_uuid interface{}) *Database_GetWorkspaceBountiesCount_Call { - return &Database_GetWorkspaceBountiesCount_Call{Call: _e.mock.On("GetWorkspaceBountiesCount", r, org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceBountiesCount(r interface{}, workspace_uuid interface{}) *Database_GetWorkspaceBountiesCount_Call { + return &Database_GetWorkspaceBountiesCount_Call{Call: _e.mock.On("GetWorkspaceBountiesCount", r, workspace_uuid)} } -func (_c *Database_GetWorkspaceBountiesCount_Call) Run(run func(r *http.Request, org_uuid string)) *Database_GetWorkspaceBountiesCount_Call { +func (_c *Database_GetWorkspaceBountiesCount_Call) Run(run func(r *http.Request, workspace_uuid string)) *Database_GetWorkspaceBountiesCount_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(*http.Request), args[1].(string)) }) @@ -4465,19 +4465,19 @@ func (_c *Database_GetWorkspaceBountyCount_Call) RunAndReturn(run func(string) i return _c } -// GetWorkspaceBudget provides a mock function with given fields: org_uuid -func (_m *Database) GetWorkspaceBudget(org_uuid string) db.BountyBudget { - ret := _m.Called(org_uuid) +// GetWorkspaceBudget provides a mock function with given fields: workspace_uuid +func (_m *Database) GetWorkspaceBudget(workspace_uuid string) db.NewBountyBudget { + ret := _m.Called(workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceBudget") } - var r0 db.BountyBudget - if rf, ok := ret.Get(0).(func(string) db.BountyBudget); ok { - r0 = rf(org_uuid) + var r0 db.NewBountyBudget + if rf, ok := ret.Get(0).(func(string) db.NewBountyBudget); ok { + r0 = rf(workspace_uuid) } else { - r0 = ret.Get(0).(db.BountyBudget) + r0 = ret.Get(0).(db.NewBountyBudget) } return r0 @@ -4489,31 +4489,31 @@ type Database_GetWorkspaceBudget_Call struct { } // GetWorkspaceBudget is a helper method to define mock.On call -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceBudget(org_uuid interface{}) *Database_GetWorkspaceBudget_Call { - return &Database_GetWorkspaceBudget_Call{Call: _e.mock.On("GetWorkspaceBudget", org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceBudget(workspace_uuid interface{}) *Database_GetWorkspaceBudget_Call { + return &Database_GetWorkspaceBudget_Call{Call: _e.mock.On("GetWorkspaceBudget", workspace_uuid)} } -func (_c *Database_GetWorkspaceBudget_Call) Run(run func(org_uuid string)) *Database_GetWorkspaceBudget_Call { +func (_c *Database_GetWorkspaceBudget_Call) Run(run func(workspace_uuid string)) *Database_GetWorkspaceBudget_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string)) }) return _c } -func (_c *Database_GetWorkspaceBudget_Call) Return(_a0 db.BountyBudget) *Database_GetWorkspaceBudget_Call { +func (_c *Database_GetWorkspaceBudget_Call) Return(_a0 db.NewBountyBudget) *Database_GetWorkspaceBudget_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetWorkspaceBudget_Call) RunAndReturn(run func(string) db.BountyBudget) *Database_GetWorkspaceBudget_Call { +func (_c *Database_GetWorkspaceBudget_Call) RunAndReturn(run func(string) db.NewBountyBudget) *Database_GetWorkspaceBudget_Call { _c.Call.Return(run) return _c } -// GetWorkspaceBudgetHistory provides a mock function with given fields: org_uuid -func (_m *Database) GetWorkspaceBudgetHistory(org_uuid string) []db.BudgetHistoryData { - ret := _m.Called(org_uuid) +// GetWorkspaceBudgetHistory provides a mock function with given fields: workspace_uuid +func (_m *Database) GetWorkspaceBudgetHistory(workspace_uuid string) []db.BudgetHistoryData { + ret := _m.Called(workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceBudgetHistory") @@ -4521,7 +4521,7 @@ func (_m *Database) GetWorkspaceBudgetHistory(org_uuid string) []db.BudgetHistor var r0 []db.BudgetHistoryData if rf, ok := ret.Get(0).(func(string) []db.BudgetHistoryData); ok { - r0 = rf(org_uuid) + r0 = rf(workspace_uuid) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]db.BudgetHistoryData) @@ -4537,12 +4537,12 @@ type Database_GetWorkspaceBudgetHistory_Call struct { } // GetWorkspaceBudgetHistory is a helper method to define mock.On call -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceBudgetHistory(org_uuid interface{}) *Database_GetWorkspaceBudgetHistory_Call { - return &Database_GetWorkspaceBudgetHistory_Call{Call: _e.mock.On("GetWorkspaceBudgetHistory", org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceBudgetHistory(workspace_uuid interface{}) *Database_GetWorkspaceBudgetHistory_Call { + return &Database_GetWorkspaceBudgetHistory_Call{Call: _e.mock.On("GetWorkspaceBudgetHistory", workspace_uuid)} } -func (_c *Database_GetWorkspaceBudgetHistory_Call) Run(run func(org_uuid string)) *Database_GetWorkspaceBudgetHistory_Call { +func (_c *Database_GetWorkspaceBudgetHistory_Call) Run(run func(workspace_uuid string)) *Database_GetWorkspaceBudgetHistory_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string)) }) @@ -4560,18 +4560,18 @@ func (_c *Database_GetWorkspaceBudgetHistory_Call) RunAndReturn(run func(string) } // GetWorkspaceByName provides a mock function with given fields: name -func (_m *Database) GetWorkspaceByName(name string) db.Organization { +func (_m *Database) GetWorkspaceByName(name string) db.Workspace { ret := _m.Called(name) if len(ret) == 0 { panic("no return value specified for GetWorkspaceByName") } - var r0 db.Organization - if rf, ok := ret.Get(0).(func(string) db.Organization); ok { + var r0 db.Workspace + if rf, ok := ret.Get(0).(func(string) db.Workspace); ok { r0 = rf(name) } else { - r0 = ret.Get(0).(db.Organization) + r0 = ret.Get(0).(db.Workspace) } return r0 @@ -4595,29 +4595,29 @@ func (_c *Database_GetWorkspaceByName_Call) Run(run func(name string)) *Database return _c } -func (_c *Database_GetWorkspaceByName_Call) Return(_a0 db.Organization) *Database_GetWorkspaceByName_Call { +func (_c *Database_GetWorkspaceByName_Call) Return(_a0 db.Workspace) *Database_GetWorkspaceByName_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetWorkspaceByName_Call) RunAndReturn(run func(string) db.Organization) *Database_GetWorkspaceByName_Call { +func (_c *Database_GetWorkspaceByName_Call) RunAndReturn(run func(string) db.Workspace) *Database_GetWorkspaceByName_Call { _c.Call.Return(run) return _c } // GetWorkspaceByUuid provides a mock function with given fields: uuid -func (_m *Database) GetWorkspaceByUuid(uuid string) db.Organization { +func (_m *Database) GetWorkspaceByUuid(uuid string) db.Workspace { ret := _m.Called(uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceByUuid") } - var r0 db.Organization - if rf, ok := ret.Get(0).(func(string) db.Organization); ok { + var r0 db.Workspace + if rf, ok := ret.Get(0).(func(string) db.Workspace); ok { r0 = rf(uuid) } else { - r0 = ret.Get(0).(db.Organization) + r0 = ret.Get(0).(db.Workspace) } return r0 @@ -4641,30 +4641,30 @@ func (_c *Database_GetWorkspaceByUuid_Call) Run(run func(uuid string)) *Database return _c } -func (_c *Database_GetWorkspaceByUuid_Call) Return(_a0 db.Organization) *Database_GetWorkspaceByUuid_Call { +func (_c *Database_GetWorkspaceByUuid_Call) Return(_a0 db.Workspace) *Database_GetWorkspaceByUuid_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetWorkspaceByUuid_Call) RunAndReturn(run func(string) db.Organization) *Database_GetWorkspaceByUuid_Call { +func (_c *Database_GetWorkspaceByUuid_Call) RunAndReturn(run func(string) db.Workspace) *Database_GetWorkspaceByUuid_Call { _c.Call.Return(run) return _c } -// GetWorkspaceInvoices provides a mock function with given fields: org_uuid -func (_m *Database) GetWorkspaceInvoices(org_uuid string) []db.InvoiceList { - ret := _m.Called(org_uuid) +// GetWorkspaceInvoices provides a mock function with given fields: workspace_uuid +func (_m *Database) GetWorkspaceInvoices(workspace_uuid string) []db.NewInvoiceList { + ret := _m.Called(workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceInvoices") } - var r0 []db.InvoiceList - if rf, ok := ret.Get(0).(func(string) []db.InvoiceList); ok { - r0 = rf(org_uuid) + var r0 []db.NewInvoiceList + if rf, ok := ret.Get(0).(func(string) []db.NewInvoiceList); ok { + r0 = rf(workspace_uuid) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.InvoiceList) + r0 = ret.Get(0).([]db.NewInvoiceList) } } @@ -4677,31 +4677,31 @@ type Database_GetWorkspaceInvoices_Call struct { } // GetWorkspaceInvoices is a helper method to define mock.On call -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceInvoices(org_uuid interface{}) *Database_GetWorkspaceInvoices_Call { - return &Database_GetWorkspaceInvoices_Call{Call: _e.mock.On("GetWorkspaceInvoices", org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceInvoices(workspace_uuid interface{}) *Database_GetWorkspaceInvoices_Call { + return &Database_GetWorkspaceInvoices_Call{Call: _e.mock.On("GetWorkspaceInvoices", workspace_uuid)} } -func (_c *Database_GetWorkspaceInvoices_Call) Run(run func(org_uuid string)) *Database_GetWorkspaceInvoices_Call { +func (_c *Database_GetWorkspaceInvoices_Call) Run(run func(workspace_uuid string)) *Database_GetWorkspaceInvoices_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string)) }) return _c } -func (_c *Database_GetWorkspaceInvoices_Call) Return(_a0 []db.InvoiceList) *Database_GetWorkspaceInvoices_Call { +func (_c *Database_GetWorkspaceInvoices_Call) Return(_a0 []db.NewInvoiceList) *Database_GetWorkspaceInvoices_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetWorkspaceInvoices_Call) RunAndReturn(run func(string) []db.InvoiceList) *Database_GetWorkspaceInvoices_Call { +func (_c *Database_GetWorkspaceInvoices_Call) RunAndReturn(run func(string) []db.NewInvoiceList) *Database_GetWorkspaceInvoices_Call { _c.Call.Return(run) return _c } -// GetWorkspaceInvoicesCount provides a mock function with given fields: org_uuid -func (_m *Database) GetWorkspaceInvoicesCount(org_uuid string) int64 { - ret := _m.Called(org_uuid) +// GetWorkspaceInvoicesCount provides a mock function with given fields: workspace_uuid +func (_m *Database) GetWorkspaceInvoicesCount(workspace_uuid string) int64 { + ret := _m.Called(workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceInvoicesCount") @@ -4709,7 +4709,7 @@ func (_m *Database) GetWorkspaceInvoicesCount(org_uuid string) int64 { var r0 int64 if rf, ok := ret.Get(0).(func(string) int64); ok { - r0 = rf(org_uuid) + r0 = rf(workspace_uuid) } else { r0 = ret.Get(0).(int64) } @@ -4723,12 +4723,12 @@ type Database_GetWorkspaceInvoicesCount_Call struct { } // GetWorkspaceInvoicesCount is a helper method to define mock.On call -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceInvoicesCount(org_uuid interface{}) *Database_GetWorkspaceInvoicesCount_Call { - return &Database_GetWorkspaceInvoicesCount_Call{Call: _e.mock.On("GetWorkspaceInvoicesCount", org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceInvoicesCount(workspace_uuid interface{}) *Database_GetWorkspaceInvoicesCount_Call { + return &Database_GetWorkspaceInvoicesCount_Call{Call: _e.mock.On("GetWorkspaceInvoicesCount", workspace_uuid)} } -func (_c *Database_GetWorkspaceInvoicesCount_Call) Run(run func(org_uuid string)) *Database_GetWorkspaceInvoicesCount_Call { +func (_c *Database_GetWorkspaceInvoicesCount_Call) Run(run func(workspace_uuid string)) *Database_GetWorkspaceInvoicesCount_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string)) }) @@ -4745,9 +4745,9 @@ func (_c *Database_GetWorkspaceInvoicesCount_Call) RunAndReturn(run func(string) return _c } -// GetWorkspaceStatusBudget provides a mock function with given fields: org_uuid -func (_m *Database) GetWorkspaceStatusBudget(org_uuid string) db.StatusBudget { - ret := _m.Called(org_uuid) +// GetWorkspaceStatusBudget provides a mock function with given fields: workspace_uuid +func (_m *Database) GetWorkspaceStatusBudget(workspace_uuid string) db.StatusBudget { + ret := _m.Called(workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceStatusBudget") @@ -4755,7 +4755,7 @@ func (_m *Database) GetWorkspaceStatusBudget(org_uuid string) db.StatusBudget { var r0 db.StatusBudget if rf, ok := ret.Get(0).(func(string) db.StatusBudget); ok { - r0 = rf(org_uuid) + r0 = rf(workspace_uuid) } else { r0 = ret.Get(0).(db.StatusBudget) } @@ -4769,12 +4769,12 @@ type Database_GetWorkspaceStatusBudget_Call struct { } // GetWorkspaceStatusBudget is a helper method to define mock.On call -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceStatusBudget(org_uuid interface{}) *Database_GetWorkspaceStatusBudget_Call { - return &Database_GetWorkspaceStatusBudget_Call{Call: _e.mock.On("GetWorkspaceStatusBudget", org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceStatusBudget(workspace_uuid interface{}) *Database_GetWorkspaceStatusBudget_Call { + return &Database_GetWorkspaceStatusBudget_Call{Call: _e.mock.On("GetWorkspaceStatusBudget", workspace_uuid)} } -func (_c *Database_GetWorkspaceStatusBudget_Call) Run(run func(org_uuid string)) *Database_GetWorkspaceStatusBudget_Call { +func (_c *Database_GetWorkspaceStatusBudget_Call) Run(run func(workspace_uuid string)) *Database_GetWorkspaceStatusBudget_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string)) }) @@ -4791,19 +4791,19 @@ func (_c *Database_GetWorkspaceStatusBudget_Call) RunAndReturn(run func(string) return _c } -// GetWorkspaceUser provides a mock function with given fields: pubkey, org_uuid -func (_m *Database) GetWorkspaceUser(pubkey string, org_uuid string) db.OrganizationUsers { - ret := _m.Called(pubkey, org_uuid) +// GetWorkspaceUser provides a mock function with given fields: pubkey, workspace_uuid +func (_m *Database) GetWorkspaceUser(pubkey string, workspace_uuid string) db.WorkspaceUsers { + ret := _m.Called(pubkey, workspace_uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceUser") } - var r0 db.OrganizationUsers - if rf, ok := ret.Get(0).(func(string, string) db.OrganizationUsers); ok { - r0 = rf(pubkey, org_uuid) + var r0 db.WorkspaceUsers + if rf, ok := ret.Get(0).(func(string, string) db.WorkspaceUsers); ok { + r0 = rf(pubkey, workspace_uuid) } else { - r0 = ret.Get(0).(db.OrganizationUsers) + r0 = ret.Get(0).(db.WorkspaceUsers) } return r0 @@ -4816,46 +4816,46 @@ type Database_GetWorkspaceUser_Call struct { // GetWorkspaceUser is a helper method to define mock.On call // - pubkey string -// - org_uuid string -func (_e *Database_Expecter) GetWorkspaceUser(pubkey interface{}, org_uuid interface{}) *Database_GetWorkspaceUser_Call { - return &Database_GetWorkspaceUser_Call{Call: _e.mock.On("GetWorkspaceUser", pubkey, org_uuid)} +// - workspace_uuid string +func (_e *Database_Expecter) GetWorkspaceUser(pubkey interface{}, workspace_uuid interface{}) *Database_GetWorkspaceUser_Call { + return &Database_GetWorkspaceUser_Call{Call: _e.mock.On("GetWorkspaceUser", pubkey, workspace_uuid)} } -func (_c *Database_GetWorkspaceUser_Call) Run(run func(pubkey string, org_uuid string)) *Database_GetWorkspaceUser_Call { +func (_c *Database_GetWorkspaceUser_Call) Run(run func(pubkey string, workspace_uuid string)) *Database_GetWorkspaceUser_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string), args[1].(string)) }) return _c } -func (_c *Database_GetWorkspaceUser_Call) Return(_a0 db.OrganizationUsers) *Database_GetWorkspaceUser_Call { +func (_c *Database_GetWorkspaceUser_Call) Return(_a0 db.WorkspaceUsers) *Database_GetWorkspaceUser_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetWorkspaceUser_Call) RunAndReturn(run func(string, string) db.OrganizationUsers) *Database_GetWorkspaceUser_Call { +func (_c *Database_GetWorkspaceUser_Call) RunAndReturn(run func(string, string) db.WorkspaceUsers) *Database_GetWorkspaceUser_Call { _c.Call.Return(run) return _c } // GetWorkspaceUsers provides a mock function with given fields: uuid -func (_m *Database) GetWorkspaceUsers(uuid string) ([]db.OrganizationUsersData, error) { +func (_m *Database) GetWorkspaceUsers(uuid string) ([]db.WorkspaceUsersData, error) { ret := _m.Called(uuid) if len(ret) == 0 { panic("no return value specified for GetWorkspaceUsers") } - var r0 []db.OrganizationUsersData + var r0 []db.WorkspaceUsersData var r1 error - if rf, ok := ret.Get(0).(func(string) ([]db.OrganizationUsersData, error)); ok { + if rf, ok := ret.Get(0).(func(string) ([]db.WorkspaceUsersData, error)); ok { return rf(uuid) } - if rf, ok := ret.Get(0).(func(string) []db.OrganizationUsersData); ok { + if rf, ok := ret.Get(0).(func(string) []db.WorkspaceUsersData); ok { r0 = rf(uuid) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.OrganizationUsersData) + r0 = ret.Get(0).([]db.WorkspaceUsersData) } } @@ -4886,12 +4886,12 @@ func (_c *Database_GetWorkspaceUsers_Call) Run(run func(uuid string)) *Database_ return _c } -func (_c *Database_GetWorkspaceUsers_Call) Return(_a0 []db.OrganizationUsersData, _a1 error) *Database_GetWorkspaceUsers_Call { +func (_c *Database_GetWorkspaceUsers_Call) Return(_a0 []db.WorkspaceUsersData, _a1 error) *Database_GetWorkspaceUsers_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_GetWorkspaceUsers_Call) RunAndReturn(run func(string) ([]db.OrganizationUsersData, error)) *Database_GetWorkspaceUsers_Call { +func (_c *Database_GetWorkspaceUsers_Call) RunAndReturn(run func(string) ([]db.WorkspaceUsersData, error)) *Database_GetWorkspaceUsers_Call { _c.Call.Return(run) return _c } @@ -4943,19 +4943,19 @@ func (_c *Database_GetWorkspaceUsersCount_Call) RunAndReturn(run func(string) in } // GetWorkspaces provides a mock function with given fields: r -func (_m *Database) GetWorkspaces(r *http.Request) []db.Organization { +func (_m *Database) GetWorkspaces(r *http.Request) []db.Workspace { ret := _m.Called(r) if len(ret) == 0 { panic("no return value specified for GetWorkspaces") } - var r0 []db.Organization - if rf, ok := ret.Get(0).(func(*http.Request) []db.Organization); ok { + var r0 []db.Workspace + if rf, ok := ret.Get(0).(func(*http.Request) []db.Workspace); ok { r0 = rf(r) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]db.Organization) + r0 = ret.Get(0).([]db.Workspace) } } @@ -4980,12 +4980,12 @@ func (_c *Database_GetWorkspaces_Call) Run(run func(r *http.Request)) *Database_ return _c } -func (_c *Database_GetWorkspaces_Call) Return(_a0 []db.Organization) *Database_GetWorkspaces_Call { +func (_c *Database_GetWorkspaces_Call) Return(_a0 []db.Workspace) *Database_GetWorkspaces_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_GetWorkspaces_Call) RunAndReturn(run func(*http.Request) []db.Organization) *Database_GetWorkspaces_Call { +func (_c *Database_GetWorkspaces_Call) RunAndReturn(run func(*http.Request) []db.Workspace) *Database_GetWorkspaces_Call { _c.Call.Return(run) return _c } @@ -5642,25 +5642,25 @@ func (_c *Database_UpdateBot_Call) RunAndReturn(run func(string, map[string]inte } // UpdateBounty provides a mock function with given fields: b -func (_m *Database) UpdateBounty(b db.Bounty) (db.Bounty, error) { +func (_m *Database) UpdateBounty(b db.NewBounty) (db.NewBounty, error) { ret := _m.Called(b) if len(ret) == 0 { panic("no return value specified for UpdateBounty") } - var r0 db.Bounty + var r0 db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(db.Bounty) (db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(db.NewBounty) (db.NewBounty, error)); ok { return rf(b) } - if rf, ok := ret.Get(0).(func(db.Bounty) db.Bounty); ok { + if rf, ok := ret.Get(0).(func(db.NewBounty) db.NewBounty); ok { r0 = rf(b) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } - if rf, ok := ret.Get(1).(func(db.Bounty) error); ok { + if rf, ok := ret.Get(1).(func(db.NewBounty) error); ok { r1 = rf(b) } else { r1 = ret.Error(1) @@ -5675,41 +5675,41 @@ type Database_UpdateBounty_Call struct { } // UpdateBounty is a helper method to define mock.On call -// - b db.Bounty +// - b db.NewBounty func (_e *Database_Expecter) UpdateBounty(b interface{}) *Database_UpdateBounty_Call { return &Database_UpdateBounty_Call{Call: _e.mock.On("UpdateBounty", b)} } -func (_c *Database_UpdateBounty_Call) Run(run func(b db.Bounty)) *Database_UpdateBounty_Call { +func (_c *Database_UpdateBounty_Call) Run(run func(b db.NewBounty)) *Database_UpdateBounty_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.Bounty)) + run(args[0].(db.NewBounty)) }) return _c } -func (_c *Database_UpdateBounty_Call) Return(_a0 db.Bounty, _a1 error) *Database_UpdateBounty_Call { +func (_c *Database_UpdateBounty_Call) Return(_a0 db.NewBounty, _a1 error) *Database_UpdateBounty_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_UpdateBounty_Call) RunAndReturn(run func(db.Bounty) (db.Bounty, error)) *Database_UpdateBounty_Call { +func (_c *Database_UpdateBounty_Call) RunAndReturn(run func(db.NewBounty) (db.NewBounty, error)) *Database_UpdateBounty_Call { _c.Call.Return(run) return _c } // UpdateBountyBoolColumn provides a mock function with given fields: b, column -func (_m *Database) UpdateBountyBoolColumn(b db.Bounty, column string) db.Bounty { +func (_m *Database) UpdateBountyBoolColumn(b db.NewBounty, column string) db.NewBounty { ret := _m.Called(b, column) if len(ret) == 0 { panic("no return value specified for UpdateBountyBoolColumn") } - var r0 db.Bounty - if rf, ok := ret.Get(0).(func(db.Bounty, string) db.Bounty); ok { + var r0 db.NewBounty + if rf, ok := ret.Get(0).(func(db.NewBounty, string) db.NewBounty); ok { r0 = rf(b, column) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } return r0 @@ -5721,42 +5721,42 @@ type Database_UpdateBountyBoolColumn_Call struct { } // UpdateBountyBoolColumn is a helper method to define mock.On call -// - b db.Bounty +// - b db.NewBounty // - column string func (_e *Database_Expecter) UpdateBountyBoolColumn(b interface{}, column interface{}) *Database_UpdateBountyBoolColumn_Call { return &Database_UpdateBountyBoolColumn_Call{Call: _e.mock.On("UpdateBountyBoolColumn", b, column)} } -func (_c *Database_UpdateBountyBoolColumn_Call) Run(run func(b db.Bounty, column string)) *Database_UpdateBountyBoolColumn_Call { +func (_c *Database_UpdateBountyBoolColumn_Call) Run(run func(b db.NewBounty, column string)) *Database_UpdateBountyBoolColumn_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.Bounty), args[1].(string)) + run(args[0].(db.NewBounty), args[1].(string)) }) return _c } -func (_c *Database_UpdateBountyBoolColumn_Call) Return(_a0 db.Bounty) *Database_UpdateBountyBoolColumn_Call { +func (_c *Database_UpdateBountyBoolColumn_Call) Return(_a0 db.NewBounty) *Database_UpdateBountyBoolColumn_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_UpdateBountyBoolColumn_Call) RunAndReturn(run func(db.Bounty, string) db.Bounty) *Database_UpdateBountyBoolColumn_Call { +func (_c *Database_UpdateBountyBoolColumn_Call) RunAndReturn(run func(db.NewBounty, string) db.NewBounty) *Database_UpdateBountyBoolColumn_Call { _c.Call.Return(run) return _c } // UpdateBountyNullColumn provides a mock function with given fields: b, column -func (_m *Database) UpdateBountyNullColumn(b db.Bounty, column string) db.Bounty { +func (_m *Database) UpdateBountyNullColumn(b db.NewBounty, column string) db.NewBounty { ret := _m.Called(b, column) if len(ret) == 0 { panic("no return value specified for UpdateBountyNullColumn") } - var r0 db.Bounty - if rf, ok := ret.Get(0).(func(db.Bounty, string) db.Bounty); ok { + var r0 db.NewBounty + if rf, ok := ret.Get(0).(func(db.NewBounty, string) db.NewBounty); ok { r0 = rf(b, column) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } return r0 @@ -5768,49 +5768,49 @@ type Database_UpdateBountyNullColumn_Call struct { } // UpdateBountyNullColumn is a helper method to define mock.On call -// - b db.Bounty +// - b db.NewBounty // - column string func (_e *Database_Expecter) UpdateBountyNullColumn(b interface{}, column interface{}) *Database_UpdateBountyNullColumn_Call { return &Database_UpdateBountyNullColumn_Call{Call: _e.mock.On("UpdateBountyNullColumn", b, column)} } -func (_c *Database_UpdateBountyNullColumn_Call) Run(run func(b db.Bounty, column string)) *Database_UpdateBountyNullColumn_Call { +func (_c *Database_UpdateBountyNullColumn_Call) Run(run func(b db.NewBounty, column string)) *Database_UpdateBountyNullColumn_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.Bounty), args[1].(string)) + run(args[0].(db.NewBounty), args[1].(string)) }) return _c } -func (_c *Database_UpdateBountyNullColumn_Call) Return(_a0 db.Bounty) *Database_UpdateBountyNullColumn_Call { +func (_c *Database_UpdateBountyNullColumn_Call) Return(_a0 db.NewBounty) *Database_UpdateBountyNullColumn_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_UpdateBountyNullColumn_Call) RunAndReturn(run func(db.Bounty, string) db.Bounty) *Database_UpdateBountyNullColumn_Call { +func (_c *Database_UpdateBountyNullColumn_Call) RunAndReturn(run func(db.NewBounty, string) db.NewBounty) *Database_UpdateBountyNullColumn_Call { _c.Call.Return(run) return _c } // UpdateBountyPayment provides a mock function with given fields: b -func (_m *Database) UpdateBountyPayment(b db.Bounty) (db.Bounty, error) { +func (_m *Database) UpdateBountyPayment(b db.NewBounty) (db.NewBounty, error) { ret := _m.Called(b) if len(ret) == 0 { panic("no return value specified for UpdateBountyPayment") } - var r0 db.Bounty + var r0 db.NewBounty var r1 error - if rf, ok := ret.Get(0).(func(db.Bounty) (db.Bounty, error)); ok { + if rf, ok := ret.Get(0).(func(db.NewBounty) (db.NewBounty, error)); ok { return rf(b) } - if rf, ok := ret.Get(0).(func(db.Bounty) db.Bounty); ok { + if rf, ok := ret.Get(0).(func(db.NewBounty) db.NewBounty); ok { r0 = rf(b) } else { - r0 = ret.Get(0).(db.Bounty) + r0 = ret.Get(0).(db.NewBounty) } - if rf, ok := ret.Get(1).(func(db.Bounty) error); ok { + if rf, ok := ret.Get(1).(func(db.NewBounty) error); ok { r1 = rf(b) } else { r1 = ret.Error(1) @@ -5825,24 +5825,24 @@ type Database_UpdateBountyPayment_Call struct { } // UpdateBountyPayment is a helper method to define mock.On call -// - b db.Bounty +// - b db.NewBounty func (_e *Database_Expecter) UpdateBountyPayment(b interface{}) *Database_UpdateBountyPayment_Call { return &Database_UpdateBountyPayment_Call{Call: _e.mock.On("UpdateBountyPayment", b)} } -func (_c *Database_UpdateBountyPayment_Call) Run(run func(b db.Bounty)) *Database_UpdateBountyPayment_Call { +func (_c *Database_UpdateBountyPayment_Call) Run(run func(b db.NewBounty)) *Database_UpdateBountyPayment_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.Bounty)) + run(args[0].(db.NewBounty)) }) return _c } -func (_c *Database_UpdateBountyPayment_Call) Return(_a0 db.Bounty, _a1 error) *Database_UpdateBountyPayment_Call { +func (_c *Database_UpdateBountyPayment_Call) Return(_a0 db.NewBounty, _a1 error) *Database_UpdateBountyPayment_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Database_UpdateBountyPayment_Call) RunAndReturn(run func(db.Bounty) (db.Bounty, error)) *Database_UpdateBountyPayment_Call { +func (_c *Database_UpdateBountyPayment_Call) RunAndReturn(run func(db.NewBounty) (db.NewBounty, error)) *Database_UpdateBountyPayment_Call { _c.Call.Return(run) return _c } @@ -5963,18 +5963,18 @@ func (_c *Database_UpdateGithubIssues_Call) RunAndReturn(run func(uint, map[stri } // UpdateInvoice provides a mock function with given fields: payment_request -func (_m *Database) UpdateInvoice(payment_request string) db.InvoiceList { +func (_m *Database) UpdateInvoice(payment_request string) db.NewInvoiceList { ret := _m.Called(payment_request) if len(ret) == 0 { panic("no return value specified for UpdateInvoice") } - var r0 db.InvoiceList - if rf, ok := ret.Get(0).(func(string) db.InvoiceList); ok { + var r0 db.NewInvoiceList + if rf, ok := ret.Get(0).(func(string) db.NewInvoiceList); ok { r0 = rf(payment_request) } else { - r0 = ret.Get(0).(db.InvoiceList) + r0 = ret.Get(0).(db.NewInvoiceList) } return r0 @@ -5998,12 +5998,12 @@ func (_c *Database_UpdateInvoice_Call) Run(run func(payment_request string)) *Da return _c } -func (_c *Database_UpdateInvoice_Call) Return(_a0 db.InvoiceList) *Database_UpdateInvoice_Call { +func (_c *Database_UpdateInvoice_Call) Return(_a0 db.NewInvoiceList) *Database_UpdateInvoice_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_UpdateInvoice_Call) RunAndReturn(run func(string) db.InvoiceList) *Database_UpdateInvoice_Call { +func (_c *Database_UpdateInvoice_Call) RunAndReturn(run func(string) db.NewInvoiceList) *Database_UpdateInvoice_Call { _c.Call.Return(run) return _c } @@ -6219,18 +6219,18 @@ func (_c *Database_UpdateTwitterConfirmed_Call) RunAndReturn(run func(uint, bool } // UpdateWorkspaceBudget provides a mock function with given fields: budget -func (_m *Database) UpdateWorkspaceBudget(budget db.BountyBudget) db.BountyBudget { +func (_m *Database) UpdateWorkspaceBudget(budget db.NewBountyBudget) db.NewBountyBudget { ret := _m.Called(budget) if len(ret) == 0 { panic("no return value specified for UpdateWorkspaceBudget") } - var r0 db.BountyBudget - if rf, ok := ret.Get(0).(func(db.BountyBudget) db.BountyBudget); ok { + var r0 db.NewBountyBudget + if rf, ok := ret.Get(0).(func(db.NewBountyBudget) db.NewBountyBudget); ok { r0 = rf(budget) } else { - r0 = ret.Get(0).(db.BountyBudget) + r0 = ret.Get(0).(db.NewBountyBudget) } return r0 @@ -6242,24 +6242,24 @@ type Database_UpdateWorkspaceBudget_Call struct { } // UpdateWorkspaceBudget is a helper method to define mock.On call -// - budget db.BountyBudget +// - budget db.NewBountyBudget func (_e *Database_Expecter) UpdateWorkspaceBudget(budget interface{}) *Database_UpdateWorkspaceBudget_Call { return &Database_UpdateWorkspaceBudget_Call{Call: _e.mock.On("UpdateWorkspaceBudget", budget)} } -func (_c *Database_UpdateWorkspaceBudget_Call) Run(run func(budget db.BountyBudget)) *Database_UpdateWorkspaceBudget_Call { +func (_c *Database_UpdateWorkspaceBudget_Call) Run(run func(budget db.NewBountyBudget)) *Database_UpdateWorkspaceBudget_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(db.BountyBudget)) + run(args[0].(db.NewBountyBudget)) }) return _c } -func (_c *Database_UpdateWorkspaceBudget_Call) Return(_a0 db.BountyBudget) *Database_UpdateWorkspaceBudget_Call { +func (_c *Database_UpdateWorkspaceBudget_Call) Return(_a0 db.NewBountyBudget) *Database_UpdateWorkspaceBudget_Call { _c.Call.Return(_a0) return _c } -func (_c *Database_UpdateWorkspaceBudget_Call) RunAndReturn(run func(db.BountyBudget) db.BountyBudget) *Database_UpdateWorkspaceBudget_Call { +func (_c *Database_UpdateWorkspaceBudget_Call) RunAndReturn(run func(db.NewBountyBudget) db.NewBountyBudget) *Database_UpdateWorkspaceBudget_Call { _c.Call.Return(run) return _c } @@ -6405,9 +6405,9 @@ func (_c *Database_UserHasManageBountyRoles_Call) RunAndReturn(run func(string, return _c } -// WithdrawBudget provides a mock function with given fields: sender_pubkey, org_uuid, amount -func (_m *Database) WithdrawBudget(sender_pubkey string, org_uuid string, amount uint) { - _m.Called(sender_pubkey, org_uuid, amount) +// WithdrawBudget provides a mock function with given fields: sender_pubkey, workspace_uuid, amount +func (_m *Database) WithdrawBudget(sender_pubkey string, workspace_uuid string, amount uint) { + _m.Called(sender_pubkey, workspace_uuid, amount) } // Database_WithdrawBudget_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithdrawBudget' @@ -6417,13 +6417,13 @@ type Database_WithdrawBudget_Call struct { // WithdrawBudget is a helper method to define mock.On call // - sender_pubkey string -// - org_uuid string +// - workspace_uuid string // - amount uint -func (_e *Database_Expecter) WithdrawBudget(sender_pubkey interface{}, org_uuid interface{}, amount interface{}) *Database_WithdrawBudget_Call { - return &Database_WithdrawBudget_Call{Call: _e.mock.On("WithdrawBudget", sender_pubkey, org_uuid, amount)} +func (_e *Database_Expecter) WithdrawBudget(sender_pubkey interface{}, workspace_uuid interface{}, amount interface{}) *Database_WithdrawBudget_Call { + return &Database_WithdrawBudget_Call{Call: _e.mock.On("WithdrawBudget", sender_pubkey, workspace_uuid, amount)} } -func (_c *Database_WithdrawBudget_Call) Run(run func(sender_pubkey string, org_uuid string, amount uint)) *Database_WithdrawBudget_Call { +func (_c *Database_WithdrawBudget_Call) Run(run func(sender_pubkey string, workspace_uuid string, amount uint)) *Database_WithdrawBudget_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string), args[1].(string), args[2].(uint)) }) diff --git a/routes/bounty.go b/routes/bounty.go index 6f743d479..a4a82ef9e 100644 --- a/routes/bounty.go +++ b/routes/bounty.go @@ -35,6 +35,7 @@ func BountyRoutes() chi.Router { r.Use(auth.PubKeyContext) r.Post("/pay/{id}", bountyHandler.MakeBountyPayment) r.Post("/budget/withdraw", bountyHandler.BountyBudgetWithdraw) + r.Post("/budget_workspace/withdraw", bountyHandler.NewBountyBudgetWithdraw) r.Post("/", bountyHandler.CreateOrEditBounty) r.Delete("/assignee", handlers.DeleteBountyAssignee) diff --git a/routes/workspaces.go b/routes/workspaces.go index 8a0c8b6ef..54b740c9f 100644 --- a/routes/workspaces.go +++ b/routes/workspaces.go @@ -9,22 +9,22 @@ import ( func WorkspaceRoutes() chi.Router { r := chi.NewRouter() - organizationHandlers := handlers.NewWorkspaceHandler(db.DB) + workspaceHandlers := handlers.NewWorkspaceHandler(db.DB) r.Group(func(r chi.Router) { r.Get("/", handlers.GetWorkspaces) r.Get("/count", handlers.GetWorkspacesCount) r.Get("/{uuid}", handlers.GetWorkspaceByUuid) r.Get("/users/{uuid}", handlers.GetWorkspaceUsers) r.Get("/users/{uuid}/count", handlers.GetWorkspaceUsersCount) - r.Get("/bounties/{uuid}", organizationHandlers.GetWorkspaceBounties) - r.Get("/bounties/{uuid}/count", organizationHandlers.GetWorkspaceBountiesCount) + r.Get("/bounties/{uuid}", workspaceHandlers.GetWorkspaceBounties) + r.Get("/bounties/{uuid}/count", workspaceHandlers.GetWorkspaceBountiesCount) r.Get("/user/{userId}", handlers.GetUserWorkspaces) - r.Get("/user/dropdown/{userId}", organizationHandlers.GetUserDropdownWorkspaces) + r.Get("/user/dropdown/{userId}", workspaceHandlers.GetUserDropdownWorkspaces) }) r.Group(func(r chi.Router) { r.Use(auth.PubKeyContext) - r.Post("/", organizationHandlers.CreateOrEditWorkspace) + r.Post("/", workspaceHandlers.CreateOrEditWorkspace) r.Post("/users/{uuid}", handlers.CreateWorkspaceUser) r.Delete("/users/{uuid}", handlers.DeleteWorkspaceUser) r.Post("/users/role/{uuid}/{user}", handlers.AddUserRoles) @@ -32,12 +32,12 @@ func WorkspaceRoutes() chi.Router { r.Get("/foruser/{uuid}", handlers.GetWorkspaceUser) r.Get("/bounty/roles", handlers.GetBountyRoles) r.Get("/users/role/{uuid}/{user}", handlers.GetUserRoles) - r.Get("/budget/{uuid}", organizationHandlers.GetWorkspaceBudget) - r.Get("/budget/history/{uuid}", organizationHandlers.GetWorkspaceBudgetHistory) + r.Get("/budget/{uuid}", workspaceHandlers.GetWorkspaceBudget) + r.Get("/budget/history/{uuid}", workspaceHandlers.GetWorkspaceBudgetHistory) r.Get("/payments/{uuid}", handlers.GetPaymentHistory) - r.Get("/poll/invoices/{uuid}", organizationHandlers.PollBudgetInvoices) + r.Get("/poll/invoices/{uuid}", workspaceHandlers.PollBudgetInvoices) r.Get("/invoices/count/{uuid}", handlers.GetInvoicesCount) - r.Delete("/delete/{uuid}", organizationHandlers.DeleteWorkspace) + r.Delete("/delete/{uuid}", workspaceHandlers.DeleteWorkspace) }) return r } diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 000000000..9656c772b --- /dev/null +++ b/yarn.lock @@ -0,0 +1,1215 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@colors/colors@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" + integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== + +"@cypress/request@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@cypress/request/-/request-3.0.1.tgz#72d7d5425236a2413bd3d8bb66d02d9dc3168960" + integrity sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + http-signature "~1.3.6" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + performance-now "^2.1.0" + qs "6.10.4" + safe-buffer "^5.1.2" + tough-cookie "^4.1.3" + tunnel-agent "^0.6.0" + uuid "^8.3.2" + +"@cypress/xvfb@^1.2.4": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@cypress/xvfb/-/xvfb-1.2.4.tgz#2daf42e8275b39f4aa53c14214e557bd14e7748a" + integrity sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q== + dependencies: + debug "^3.1.0" + lodash.once "^4.1.1" + +"@types/dotenv@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@types/dotenv/-/dotenv-8.2.0.tgz#5cd64710c3c98e82d9d15844375a33bf1b45d053" + integrity sha512-ylSC9GhfRH7m1EUXBXofhgx4lUWmFeQDINW5oLuS+gxWdfUeW4zJdeVTYVkexEW+e2VUvlZR2kGnGGipAWR7kw== + dependencies: + dotenv "*" + +"@types/node@*": + version "20.12.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384" + integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== + dependencies: + undici-types "~5.26.4" + +"@types/sinonjs__fake-timers@8.1.1": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz#b49c2c70150141a15e0fa7e79cf1f92a72934ce3" + integrity sha512-0kSuKjAS0TrGLJ0M/+8MaFkGsQhZpB6pxOmvS3K8FYI72K//YmdfoW9X2qPsAKh1mkwxGD5zib9s1FIFed6E8g== + +"@types/sizzle@^2.3.2": + version "2.3.8" + resolved "https://registry.yarnpkg.com/@types/sizzle/-/sizzle-2.3.8.tgz#518609aefb797da19bf222feb199e8f653ff7627" + integrity sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg== + +"@types/yauzl@^2.9.1": + version "2.10.3" + resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.3.tgz#e9b2808b4f109504a03cda958259876f61017999" + integrity sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q== + dependencies: + "@types/node" "*" + +aggregate-error@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" + integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== + dependencies: + clean-stack "^2.0.0" + indent-string "^4.0.0" + +ansi-colors@^4.1.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== + +ansi-escapes@^4.3.0: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +arch@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/arch/-/arch-2.2.0.tgz#1bc47818f305764f23ab3306b0bfc086c5a29d11" + integrity sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ== + +asn1@~0.2.3: + version "0.2.6" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" + integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== + +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + +async@^3.2.0: + version "3.2.5" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" + integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== + +aws4@^1.8.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" + integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== + dependencies: + tweetnacl "^0.14.3" + +blob-util@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/blob-util/-/blob-util-2.0.2.tgz#3b4e3c281111bb7f11128518006cdc60b403a1eb" + integrity sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ== + +bluebird@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + +buffer-crc32@~0.2.3: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== + +buffer@^5.7.1: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +cachedir@^2.3.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-2.4.0.tgz#7fef9cf7367233d7c88068fe6e34ed0d355a610d" + integrity sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ== + +call-bind@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== + +chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +check-more-types@^2.24.0: + version "2.24.0" + resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" + integrity sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA== + +ci-info@^3.2.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== + +clean-stack@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== + +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + +cli-table3@~0.6.1: + version "0.6.4" + resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.4.tgz#d1c536b8a3f2e7bec58f67ac9e5769b1b30088b0" + integrity sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw== + dependencies: + string-width "^4.2.0" + optionalDependencies: + "@colors/colors" "1.5.0" + +cli-truncate@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-2.1.0.tgz#c39e28bf05edcde5be3b98992a22deed5a2b93c7" + integrity sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg== + dependencies: + slice-ansi "^3.0.0" + string-width "^4.2.0" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +colorette@^2.0.16: + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" + integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== + +common-tags@^1.8.0: + version "1.8.2" + resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" + integrity sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA== + +core-util-is@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== + +cross-spawn@^7.0.0: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +cypress@^13.8.0: + version "13.8.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.8.0.tgz#118e94161334e03841714c9b9b3600ae853c11f9" + integrity sha512-Qau//mtrwEGOU9cn2YjavECKyDUwBh8J2tit+y9s1wsv6C3BX+rlv6I9afmQnL8PmEEzJ6be7nppMHacFzZkTw== + dependencies: + "@cypress/request" "^3.0.0" + "@cypress/xvfb" "^1.2.4" + "@types/sinonjs__fake-timers" "8.1.1" + "@types/sizzle" "^2.3.2" + arch "^2.2.0" + blob-util "^2.0.2" + bluebird "^3.7.2" + buffer "^5.7.1" + cachedir "^2.3.0" + chalk "^4.1.0" + check-more-types "^2.24.0" + cli-cursor "^3.1.0" + cli-table3 "~0.6.1" + commander "^6.2.1" + common-tags "^1.8.0" + dayjs "^1.10.4" + debug "^4.3.4" + enquirer "^2.3.6" + eventemitter2 "6.4.7" + execa "4.1.0" + executable "^4.1.1" + extract-zip "2.0.1" + figures "^3.2.0" + fs-extra "^9.1.0" + getos "^3.2.1" + is-ci "^3.0.1" + is-installed-globally "~0.4.0" + lazy-ass "^1.6.0" + listr2 "^3.8.3" + lodash "^4.17.21" + log-symbols "^4.0.0" + minimist "^1.2.8" + ospath "^1.2.2" + pretty-bytes "^5.6.0" + process "^0.11.10" + proxy-from-env "1.0.0" + request-progress "^3.0.0" + semver "^7.5.3" + supports-color "^8.1.1" + tmp "~0.2.1" + untildify "^4.0.0" + yauzl "^2.10.0" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== + dependencies: + assert-plus "^1.0.0" + +dayjs@^1.10.4: + version "1.11.10" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0" + integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ== + +debug@^3.1.0: + version "3.2.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" + integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== + dependencies: + ms "^2.1.1" + +debug@^4.1.1, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +define-data-property@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +dotenv@*, dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +enquirer@^2.3.6: + version "2.4.1" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.4.1.tgz#93334b3fbd74fc7097b224ab4a8fb7e40bf4ae56" + integrity sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ== + dependencies: + ansi-colors "^4.1.1" + strip-ansi "^6.0.1" + +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +eventemitter2@6.4.7: + version "6.4.7" + resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d" + integrity sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg== + +execa@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" + integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +executable@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/executable/-/executable-4.1.1.tgz#41532bff361d3e57af4d763b70582db18f5d133c" + integrity sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg== + dependencies: + pify "^2.2.0" + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extract-zip@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a" + integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg== + dependencies: + debug "^4.1.1" + get-stream "^5.1.0" + yauzl "^2.10.0" + optionalDependencies: + "@types/yauzl" "^2.9.1" + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== + +extsprintf@^1.2.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" + integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== + +fd-slicer@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" + integrity sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g== + dependencies: + pend "~1.2.0" + +figures@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" + integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== + dependencies: + escape-string-regexp "^1.0.5" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +fs-extra@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +get-intrinsic@^1.1.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + +get-stream@^5.0.0, get-stream@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" + integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== + dependencies: + pump "^3.0.0" + +getos@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/getos/-/getos-3.2.1.tgz#0134d1f4e00eb46144c5a9c0ac4dc087cbb27dc5" + integrity sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q== + dependencies: + async "^3.2.0" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== + dependencies: + assert-plus "^1.0.0" + +global-dirs@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.1.tgz#0c488971f066baceda21447aecb1a8b911d22485" + integrity sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA== + dependencies: + ini "2.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + +graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + +has-proto@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" + integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== + +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +hasown@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +http-signature@~1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9" + integrity sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw== + dependencies: + assert-plus "^1.0.0" + jsprim "^2.0.2" + sshpk "^1.14.1" + +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== + +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + +ini@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" + integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== + +is-ci@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.1.tgz#db6ecbed1bd659c43dac0f45661e7674103d1867" + integrity sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ== + dependencies: + ci-info "^3.2.0" + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-installed-globally@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.4.0.tgz#9a0fd407949c30f86eb6959ef1b7994ed0b7b520" + integrity sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ== + dependencies: + global-dirs "^3.0.0" + is-path-inside "^3.0.2" + +is-path-inside@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== + +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== + +json-schema@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" + integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== + +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jsprim@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d" + integrity sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ== + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.4.0" + verror "1.10.0" + +lazy-ass@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513" + integrity sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw== + +listr2@^3.8.3: + version "3.14.0" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.14.0.tgz#23101cc62e1375fd5836b248276d1d2b51fdbe9e" + integrity sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g== + dependencies: + cli-truncate "^2.1.0" + colorette "^2.0.16" + log-update "^4.0.0" + p-map "^4.0.0" + rfdc "^1.3.0" + rxjs "^7.5.1" + through "^2.3.8" + wrap-ansi "^7.0.0" + +lodash.once@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" + integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg== + +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +log-symbols@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== + dependencies: + chalk "^4.1.0" + is-unicode-supported "^0.1.0" + +log-update@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1" + integrity sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg== + dependencies: + ansi-escapes "^4.3.0" + cli-cursor "^3.1.0" + slice-ansi "^4.0.0" + wrap-ansi "^6.2.0" + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimist@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@^2.1.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +npm-run-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +object-inspect@^1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + +once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +onetime@^5.1.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +ospath@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/ospath/-/ospath-1.2.2.tgz#1276639774a3f8ef2572f7fe4280e0ea4550c07b" + integrity sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA== + +p-map@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" + integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== + dependencies: + aggregate-error "^3.0.0" + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +pend@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== + +pify@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== + +pretty-bytes@^5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" + integrity sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + +proxy-from-env@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" + integrity sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A== + +psl@^1.1.33: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@^2.1.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + +qs@6.10.4: + version "6.10.4" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.4.tgz#6a3003755add91c0ec9eacdc5f878b034e73f9e7" + integrity sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g== + dependencies: + side-channel "^1.0.4" + +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + +request-progress@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/request-progress/-/request-progress-3.0.0.tgz#4ca754081c7fec63f505e4faa825aa06cd669dbe" + integrity sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg== + dependencies: + throttleit "^1.0.0" + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + +rfdc@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.1.tgz#2b6d4df52dffe8bb346992a10ea9451f24373a8f" + integrity sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg== + +rxjs@^7.5.1: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +semver@^7.5.3: + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== + dependencies: + lru-cache "^6.0.0" + +set-function-length@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +side-channel@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" + integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + object-inspect "^1.13.1" + +signal-exit@^3.0.2: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +slice-ansi@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" + integrity sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +sshpk@^1.14.1: + version "1.18.0" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.18.0.tgz#1663e55cddf4d688b86a46b77f0d5fe363aba028" + integrity sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +throttleit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.1.tgz#304ec51631c3b770c65c6c6f76938b384000f4d5" + integrity sha512-vDZpf9Chs9mAdfY046mcPt8fg5QSZr37hEH4TXYBnDF+izxgrbRGUAAaBvIk/fJm9aOFCGFd1EsNg5AZCbnQCQ== + +through@^2.3.8: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== + +tmp@~0.2.1: + version "0.2.3" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae" + integrity sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w== + +tough-cookie@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" + integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" + +tslib@^2.1.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +typescript@^5.4.5: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + +universalify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" + integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== + +untildify@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" + integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== + +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yauzl@^2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" + integrity sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g== + dependencies: + buffer-crc32 "~0.2.3" + fd-slicer "~1.1.0"