diff --git a/README.md b/README.md index 08e73770..5ca71941 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,14 @@ 5. Set up local development for supabase ```sh https://supabase.com/docs/guides/cli/local-development + + Enable webhooks in the supabase dashboard or create a "supabase_functions" schema manually. + Update environment variables (supabaseProjectUrl, supabaseAnonKey, supabaseRoleLevelSecurityKeys VAPID_Keys ) in + - src/environments/environment.ts + - supabase/migrations/ + - the .bat files + + Optional: Set up a remote environment on supabase.com ``` 6. Start Angular dev server ```sh diff --git a/copy_sql_files_to_migration_folder.bat b/copy_sql_files_to_migration_folder.bat index 553ae230..dffd6db0 100644 --- a/copy_sql_files_to_migration_folder.bat +++ b/copy_sql_files_to_migration_folder.bat @@ -35,10 +35,13 @@ if errorlevel 1 ( supabase db push --include-all pause + supabase functions deploy + pause + @REM Generate types from remote (requires to click apply editor config to work locally, else wise type errors @REM occure) - supabase gen types typescript --project-id "abcwkgkiztruxwvfwabf" --schema public > supabase/types/supabase.ts - supabase gen types typescript --project-id "abcwkgkiztruxwvfwabf" --schema authenticated_access > supabase/types/supabase_authenticated_access.ts + supabase gen types typescript --project-id "rjljgqxktntquuftngcf" --schema public > supabase/types/supabase.ts + supabase gen types typescript --project-id "rjljgqxktntquuftngcf" --schema authenticated_access > supabase/types/supabase_authenticated_access.ts @REM Start angular client and run tests @REM pause diff --git a/cypress.config.ts b/cypress.config.ts index 14f16207..06525b44 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -2,10 +2,9 @@ import {defineConfig} from "cypress"; export default defineConfig({ e2e: { - setupNodeEvents(on: any, config: any) { - // implement node event listeners here - }, baseUrl: 'http://localhost:4200', - defaultCommandTimeout: 10000 + defaultCommandTimeout: 10000, + requestTimeout: 10000, + retries: 0 } }); diff --git a/cypress/e2e/00.1 landing-navigation.cy.ts b/cypress/e2e/00.1 landing-navigation.cy.ts index 4206387f..8851a14d 100644 --- a/cypress/e2e/00.1 landing-navigation.cy.ts +++ b/cypress/e2e/00.1 landing-navigation.cy.ts @@ -1,7 +1,9 @@ import {Size, Sizes} from "../fixtures/size"; Sizes.forEach((size: Size): void => { - describe(`Landing page tests with screen size ${size.width} show that users can `, () => { + describe(`Landing page tests with screen size ${size.width} show that users can `, (): void => { + before((): void => { + }) beforeEach((): void => { cy.viewport(size.width, size.height) diff --git a/cypress/e2e/01.1 auth.cy.ts b/cypress/e2e/01.1 auth.cy.ts index 16b2b225..aca75a47 100644 --- a/cypress/e2e/01.1 auth.cy.ts +++ b/cypress/e2e/01.1 auth.cy.ts @@ -1,10 +1,14 @@ -import {ProfileTest} from "../fixtures/profile"; import {Size, Sizes} from "../fixtures/size"; -import {userCreatedByCypress} from "../fixtures/user"; +import {userCreatedByCypress} from "../../seed_and_test_data/user_created_by_cypress"; +import {AuthData} from "../../seed_and_test_data/01_test_auth"; -const newUser: ProfileTest = userCreatedByCypress; +const newUser: AuthData = userCreatedByCypress; Sizes.forEach((size: Size): void => { - describe(`Auth tests with screen size ${size.width} show that users can `, () => { + describe(`Auth tests with screen size ${size.width} show that users can `, (): void => { + before((): void => { + cy.resetSupabase() + }) + beforeEach((): void => { cy.viewport(size.width, size.height) cy.clearLocalStorage() diff --git a/cypress/e2e/01.2 app-navigation.cy.ts b/cypress/e2e/01.2 app-navigation.cy.ts index 308157fd..3cdd75b0 100644 --- a/cypress/e2e/01.2 app-navigation.cy.ts +++ b/cypress/e2e/01.2 app-navigation.cy.ts @@ -1,11 +1,12 @@ import {Size, Sizes} from "../fixtures/size"; -import {ProfileTest} from "../fixtures/profile"; -import {seedReadUser2} from "../fixtures/user"; +import {AUTH_DATA1, AuthData} from "../../seed_and_test_data/01_test_auth"; -const profile1: ProfileTest = seedReadUser2; +const profile1: AuthData = AUTH_DATA1; Sizes.forEach((size: Size): void => { - describe(`App navigation tests with screen size ${size.width} show that users can `, () => { + describe(`App navigation tests with screen size ${size.width} show that users can `, (): void => { + before(() => { + }) beforeEach((): void => { cy.viewport(size.width, size.height) diff --git a/cypress/e2e/02.1 profile.cy.ts b/cypress/e2e/02.1 profile.cy.ts index bc7bce6e..e7cbb5c3 100644 --- a/cypress/e2e/02.1 profile.cy.ts +++ b/cypress/e2e/02.1 profile.cy.ts @@ -1,22 +1,28 @@ -import {ProfileTest} from "../fixtures/profile"; -import {seedReadUser3, seedWriteUser} from "../fixtures/user"; import {Size, Sizes} from "../fixtures/size"; +import {AUTH_DATA1, AuthData} from "../../seed_and_test_data/01_test_auth"; +import {Profile, PROFILE1, PROFILE2} from "../../seed_and_test_data/02_test_profiles"; -const seedUser2: ProfileTest = seedReadUser3; +const userWhoEditsItsProfileAuthData: AuthData = AUTH_DATA1; +const userWhoEditsItsProfileProfileData: Profile = PROFILE1; +const userWhosProfileIsChecked: Profile = PROFILE2; Sizes.forEach((size: Size): void => { - describe(`Profile tests with screen size ${size.width} show that users can `, () => { + describe(`Profile tests with screen size ${size.width} show that users can `, (): void => { + + before((): void => { + cy.resetSupabase() + }) beforeEach((): void => { cy.viewport(size.width, size.height) cy.visit('landing/sign-in'); - cy.signIn(seedWriteUser); + cy.signIn(userWhoEditsItsProfileAuthData); }) - const newFirstName = seedWriteUser.first_name as string + Math.random(); - const newLastName = seedWriteUser.last_name as string + Math.random(); + const newFirstName: string = userWhoEditsItsProfileProfileData.first_name as string + Math.random(); + const newLastName: string = userWhoEditsItsProfileProfileData.last_name as string + Math.random(); - it('edit its own profile data.', () => { + it('edit its own profile data.', (): void => { cy.getDataCy('nav-profile-edit', 'nav-profile-edit-desktop') .filter(':visible') .first() @@ -24,7 +30,6 @@ Sizes.forEach((size: Size): void => { cy.getDataCy('edit-instruction') .shouldBeVisible() - // cy.intercept('POST', 'https://abcwkgkiztruxwvfwabf.supabase.co/rest/v1/profiles'). cy.interceptSupabaseCall('update_user').as('updateProfile') cy.getDataCy('firstName').clear() cy.getDataCy('firstName').type(newFirstName) @@ -37,14 +42,14 @@ Sizes.forEach((size: Size): void => { cy.wait('@updateProfile') }) - it('view its own profile.', () => { + it('view its own profile.', (): void => { cy.getDataCy('first-name') .shouldBeVisible() .contains(newFirstName) .contains(newLastName) }) - it('change its profile image.', () => { + it('change its profile image.', (): void => { cy.getDataCy('nav-profile-edit', 'nav-profile-edit-desktop') .filter(':visible') .first() @@ -74,27 +79,27 @@ Sizes.forEach((size: Size): void => { it('view other user profiles', (): void => { cy.openSearchTab() - cy.getDataCy('search').type(seedUser2.first_name as string) + cy.getDataCy('search').type(userWhosProfileIsChecked.first_name as string) cy.getDataCy('user-search-results') .find('polity-search-profile-result') .shouldBeVisible() - .contains(seedUser2.first_name as string) + .contains(userWhosProfileIsChecked.first_name as string) .click() cy.getDataCy('first-name') .shouldBeVisible() - .contains(seedUser2.first_name as string) + .contains(userWhosProfileIsChecked.first_name as string) cy.getDataCy('first-name') .shouldBeVisible() - .contains(seedUser2.last_name as string) + .contains(userWhosProfileIsChecked.last_name as string) }) it('not edit other users profiles', (): void => { cy.openSearchTab() - cy.getDataCy('search').type(seedUser2.first_name as string) + cy.getDataCy('search').type(userWhosProfileIsChecked.first_name as string) cy.getDataCy('user-search-results') .find('polity-search-profile-result') .shouldBeVisible() - .contains(seedUser2.first_name as string) + .contains(userWhosProfileIsChecked.first_name as string) .click() cy.getDataCy('nav-profile-edit', 'nav-profile-edit-desktop') .should('not.exist') diff --git a/cypress/e2e/02.2 profile negative api tests.cy.ts b/cypress/e2e/02.2 profile negative api tests.cy.ts index bb4e09ea..a4ec2b86 100644 --- a/cypress/e2e/02.2 profile negative api tests.cy.ts +++ b/cypress/e2e/02.2 profile negative api tests.cy.ts @@ -1,17 +1,26 @@ import {supabaseClient} from "../../src/app/auth/supabase-client"; import {POSTGRES_ERRORS} from "../fixtures/postgres_errors"; +import {AuthTokenResponse} from "@supabase/supabase-js"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; -describe(`Negative api tests for profile_counter table show that `, async () => { +const signedInUserAuth: AuthData = AUTH_DATA1; +const otherUser: AuthData = AUTH_DATA2; + +describe(`Negative api tests for profile_counter table show that `, async (): Promise => { let user_id: string | undefined; let token: string | undefined; - const TEST_ID = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; + const TEST_ID: string = otherUser.id; + + before((): void => { + cy.resetSupabase() + }) beforeEach(async (): Promise => { cy.visit('landing/sign-in'); - const response = await supabaseClient.auth.signInWithPassword( + const response: AuthTokenResponse = await supabaseClient.auth.signInWithPassword( { - email: 'follow@seed.com', - password: '12345678', + email: signedInUserAuth.email, + password: signedInUserAuth.password, } ) user_id = response.data.user?.id diff --git a/cypress/e2e/03.1 profile-follow.cy.ts b/cypress/e2e/03.1 profile-follow.cy.ts index 6abb9f53..b5f04a46 100644 --- a/cypress/e2e/03.1 profile-follow.cy.ts +++ b/cypress/e2e/03.1 profile-follow.cy.ts @@ -1,43 +1,68 @@ -import {ProfileTest} from "../fixtures/profile"; -import {seedProfileFollowingUser, seedProfileFollowUser, seedReadUser2} from "../fixtures/user"; import {Size, Sizes} from "../fixtures/size"; +import {AUTH_DATA1, AUTH_DATA2, AUTH_DATA3, AuthData} from "../../seed_and_test_data/01_test_auth"; +import {Profile, PROFILE1, PROFILE2, PROFILE3} from "../../seed_and_test_data/02_test_profiles"; +import { + PROFILE_COUNTER1, + PROFILE_COUNTER2, + PROFILE_COUNTER3, + ProfileCounter +} from "../../seed_and_test_data/04_test_profile_counters"; + +const userWhoFollowsAuth: AuthData = AUTH_DATA1; +const userWhoFollowsProfile: Profile = PROFILE1; +const userWhoFollowsCounter: ProfileCounter = PROFILE_COUNTER1; + +const userWhoIsFollowedAuth: AuthData = AUTH_DATA2; +const userWhoIsFollowedProfile: Profile = PROFILE2; +const userWhoIsFollowedCounter: ProfileCounter = PROFILE_COUNTER2; + +const userWhoIsUnFollowedAuth: AuthData = AUTH_DATA3; +const userWhoIsUnFollowedProfile: Profile = PROFILE3; +const userWhoIsUnFollowedCounter: ProfileCounter = PROFILE_COUNTER3; -const readUser: ProfileTest = seedReadUser2; -const followUser: ProfileTest = seedProfileFollowUser; -const followingUser: ProfileTest = seedProfileFollowingUser // ATTENTION // These test depend on the search and auth tests. // These test depend on each other, e.g. unfollow test only work if follow test works Sizes.forEach((size: Size): void => { - describe(`Profile follow tests with screen size ${size.width} show that users can `, () => { + describe(`Profile follow tests with screen size ${size.width} show that users can `, (): void => { + before((): void => { + }) + beforeEach((): void => { + cy.viewport(size.width, size.height) + cy.resetSupabase() cy.visit('landing/sign-in'); - cy.signIn(followUser); + cy.signIn(userWhoFollowsAuth); }) - it('view other users followers and followings', () => { - cy.searchUser(readUser.first_name as string) + it('view other users followers and followings', (): void => { + cy.searchUser(userWhoIsFollowedProfile.first_name as string) .click() cy.getDataCy('first-name') .shouldBeVisible() - .contains(readUser.first_name as string) + .contains(userWhoIsFollowedProfile.first_name as string) cy.getDataCy('followerCounter') .shouldBeVisible() - .contains(readUser.follower_counter) + .contains(userWhoIsFollowedCounter.follower_counter) cy.getDataCy('followingCounter') .shouldBeVisible() - .contains(readUser.following_counter) + .contains(userWhoIsFollowedCounter.following_counter) }) - it('follow other users', () => { - cy.followUser(followingUser, followUser); + it('follow other users', (): void => { + cy.followUser( + userWhoIsFollowedProfile, + userWhoIsFollowedCounter, + userWhoFollowsProfile, + userWhoFollowsCounter + ); }) - it('unfollow another user', () => { + it('unfollow another user', (): void => { cy.interceptSupabaseCall('select_user') .as('selectUser') @@ -46,13 +71,13 @@ Sizes.forEach((size: Size): void => { cy.interceptSupabaseCall('select_following_counter') .as('followingCounter') - cy.searchUser(followingUser.first_name as string) + cy.searchUser(userWhoIsUnFollowedProfile.first_name as string) .click() cy.wait(['@followingCounter', '@isFollowing', '@selectUser']) cy.getDataCy('first-name') .shouldBeVisible() - .contains(followingUser.first_name as string) + .contains(userWhoIsUnFollowedProfile.first_name as string) cy.interceptSupabaseCall('unfollow_transaction') .as('unfollowTransaction') @@ -72,87 +97,107 @@ Sizes.forEach((size: Size): void => { cy.getDataCy('followerCounter') .shouldBeVisible() - .contains(readUser.follower_counter) // add -1 if this test does not depend on following test to pass + .contains(userWhoIsUnFollowedCounter.follower_counter - 1) - cy.searchUser(followUser.first_name as string) + cy.searchUser(userWhoFollowsProfile.first_name as string) .click() cy.getDataCy('first-name') .shouldBeVisible() - .contains(followUser.first_name as string) + .contains(userWhoFollowsProfile.first_name as string) cy.getDataCy('followingCounter') .shouldBeVisible() - .contains(readUser.following_counter) // add -1 if this test does not depend on following test to pass + .contains(userWhoFollowsCounter.following_counter - 1) }) - it('remove a following from management tab', () => { - cy.followUser(followingUser, followUser); + it('remove a following from management tab', (): void => { cy.navigateToHome(); - cy.contains(followUser.first_name as string) + cy.interceptSupabaseCall('check_if_following') + .as('isFollowing') + cy.interceptSupabaseCall('select_following_counter') + .as('followingCounter') + cy.interceptSupabaseCall('select_user') + .as('user') + cy.contains(userWhoFollowsProfile.first_name as string) .click(); + cy.wait(['@isFollowing', '@followingCounter', '@user']) cy.interceptSupabaseCall('select_following_of_user').as('loadFollowingOfUser') - cy.getDataCy('nav-follower-edit') - .shouldBeVisible() - .click() + console.log('size width', size.width) + console.log('sizes[2] width', Sizes[2].width) + + if (size.width === Sizes[2].width) { + cy.getDataCy('nav-follower-edit-desktop') + .shouldBeVisible() + .click() + } else { + cy.getDataCy('nav-follower-edit') + .shouldBeVisible() + .click() + } cy.wait(['@loadFollowingOfUser']) cy.getDataCy('show-followings') .shouldBeVisible() .click() + cy.interceptSupabaseCall('unfollow_transaction').as('unfollowUser') + cy.getDataCy('following_first_name') .shouldBeVisible() - .contains(followingUser.first_name as string) - - cy.interceptSupabaseCall('unfollow_transaction').as('unfollowUser') - cy.getDataCy('following_remove') - // cy.contains(followingUser.first_name) - // .find('[data-cy="following-remove"]') + .contains(userWhoIsUnFollowedProfile.first_name as string) + .next() + .children() .first() - .shouldBeVisible() .click() cy.wait('@unfollowUser') - cy.contains(followingUser.first_name as string) + cy.contains(userWhoIsUnFollowedProfile.first_name as string) .should('not.exist') }) - it('remove a follower from management tab', () => { - cy.followUser(followingUser, followUser); - cy.signOut(followUser) - cy.signIn(followingUser) + it('remove a follower from management tab', (): void => { cy.navigateToHome(); - + cy.interceptSupabaseCall('check_if_following') + .as('isFollowing') + cy.interceptSupabaseCall('select_following_counter') + .as('followingCounter') + cy.interceptSupabaseCall('select_user') + .as('user') cy.getDataCy('home-to-profile') .shouldBeVisible() .click(); + cy.wait(['@isFollowing', '@followingCounter', '@user']) cy.interceptSupabaseCall('select_follower_of_user').as('loadFollowerOfUser') - cy.getDataCy('nav-follower-edit') - .shouldBeVisible() - .click() + if (size.width === Sizes[2].width) { + cy.getDataCy('nav-follower-edit-desktop') + .shouldBeVisible() + .click() + } else { + cy.getDataCy('nav-follower-edit') + .shouldBeVisible() + .click() + } cy.wait(['@loadFollowerOfUser']) cy.getDataCy('show-follower') .shouldBeVisible() .click() - cy.getDataCy('follower_first_name') - .shouldBeVisible() - cy.interceptSupabaseCall('remove_follower_transaction').as('unfollowUser') - cy.getDataCy('follower_remove') - // cy.contains(followUser.first_name) - // .find('[data-cy="follower-remove"]') + cy.getDataCy('follower_first_name') .shouldBeVisible() + .contains(userWhoIsUnFollowedProfile.first_name as string) + .next() + .children() .first() .click() cy.wait(['@unfollowUser']) - cy.contains(followUser.first_name as string) + cy.contains(userWhoIsUnFollowedProfile.first_name as string) .should('not.exist') }) }) diff --git a/cypress/e2e/03.2 following_follower negative api test.cy.ts b/cypress/e2e/03.2 following_follower negative api test.cy.ts index 6d844343..3a43ac70 100644 --- a/cypress/e2e/03.2 following_follower negative api test.cy.ts +++ b/cypress/e2e/03.2 following_follower negative api test.cy.ts @@ -1,32 +1,22 @@ import {supabaseClient} from "../../src/app/auth/supabase-client"; import {POSTGRES_ERRORS} from "../fixtures/postgres_errors"; +import {AuthTokenResponse} from "@supabase/supabase-js"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; -/** - * ERROR dictionary used in this test: - * - * data = true or null => transaction successful - * - * error codes: - * 23505: 409 - uniqueness violation, e.g. insert unsuccessful - * 42703: column does not exist, e.g. delete unsuccessful (custom thrown error) - * 42501: if authenticated 403, else 401 insufficient privileges, e.g. row-level-security or schema access error - * PGRST202: 404 - Caused by a stale function signature, otherwise the function may not exist in the database, e.g. - * api endpoint not public - * 42P01: 404 - undefined table, e.g. api endpoint not public - * https://postgrest.org/en/stable/references/errors.html - **/ - -describe(`Negative api tests for the following feature show that `, async () => { +const signedInUserAuth: AuthData = AUTH_DATA1; +const otherUser: AuthData = AUTH_DATA2; + +describe(`Negative api tests for the following feature show that `, async (): Promise => { let user_id: string | undefined; let token: string | undefined; - const TEST_ID = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; + const TEST_ID: string = otherUser.id; beforeEach(async (): Promise => { cy.visit('landing/sign-in'); - const response = await supabaseClient.auth.signInWithPassword( + const response: AuthTokenResponse = await supabaseClient.auth.signInWithPassword( { - email: 'follow@seed.com', - password: '12345678', + email: signedInUserAuth.email, + password: signedInUserAuth.password, } ) user_id = response.data.user?.id @@ -36,6 +26,7 @@ describe(`Negative api tests for the following feature show that `, async () => }) it('an authenticated user can call the follow transaction but can not call it twice', async (): Promise => { + cy.resetSupabase() const response = await supabaseClient .rpc('follow_transaction', { @@ -57,6 +48,7 @@ describe(`Negative api tests for the following feature show that `, async () => }) it('an authenticated user can call the unfollow transaction but can not call it twice', async (): Promise => { + cy.resetSupabase() const response = await supabaseClient .rpc('unfollow_transaction', { @@ -107,7 +99,7 @@ describe(`Negative api tests for the following feature show that `, async () => // @ts-ignore .rpc('increment_following_counter', {user_id: TEST_ID}) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('the profile_counter following decrement function is not publicly available', async (): Promise => { @@ -115,7 +107,7 @@ describe(`Negative api tests for the following feature show that `, async () => // @ts-ignore .rpc('decrement_following_counter', {user_id: TEST_ID}) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('the profile_counter follower increment function is not publicly available', async (): Promise => { @@ -123,7 +115,7 @@ describe(`Negative api tests for the following feature show that `, async () => // @ts-ignore .rpc('increment_follower_counter', {user_id: TEST_ID}) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('the profile_counter follower decrement function is not publicly available', async (): Promise => { @@ -131,7 +123,7 @@ describe(`Negative api tests for the following feature show that `, async () => // @ts-ignore .rpc('decrement_follower_counter', {user_id: TEST_ID}) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('the insert_following_follower_relationship function is not publicly available', async (): Promise => { @@ -139,7 +131,7 @@ describe(`Negative api tests for the following feature show that `, async () => // @ts-ignore .rpc('insert_following_follower_relationship', {user_id: TEST_ID}) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('the delete_following_follower_relationship function is not publicly available', async (): Promise => { @@ -147,7 +139,7 @@ describe(`Negative api tests for the following feature show that `, async () => // @ts-ignore .rpc('delete_following_follower_relationship', {user_id: TEST_ID}) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('the profile_counter api table not public selectable', async (): Promise => { @@ -182,7 +174,7 @@ describe(`Negative api tests for the following feature show that `, async () => }, ) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('an authenticated user can only view its own followings', async (): Promise => { @@ -194,7 +186,7 @@ describe(`Negative api tests for the following feature show that `, async () => }, ) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('an authenticated user can only view its own follower', async (): Promise => { @@ -206,7 +198,7 @@ describe(`Negative api tests for the following feature show that `, async () => }, ) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('a non authenticated user can not view counters', async (): Promise => { @@ -219,7 +211,7 @@ describe(`Negative api tests for the following feature show that `, async () => }, ) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.noPermission) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) it('an authenticated user can only update its own receive_notification status.', async (): Promise => { @@ -231,6 +223,6 @@ describe(`Negative api tests for the following feature show that `, async () => }, ) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) }) diff --git a/cypress/e2e/04.1 search.cy.ts b/cypress/e2e/04.1 search.cy.ts index 9596b403..2d404b7c 100644 --- a/cypress/e2e/04.1 search.cy.ts +++ b/cypress/e2e/04.1 search.cy.ts @@ -1,17 +1,20 @@ import {Size, Sizes} from "../fixtures/size"; -import {ProfileTest} from "../fixtures/profile"; -import {seedReadUser2} from "../fixtures/user"; +import {AUTH_DATA1, AuthData} from "../../seed_and_test_data/01_test_auth"; +import {Profile, PROFILE1} from "../../seed_and_test_data/02_test_profiles"; -const loggedInUser: ProfileTest = seedReadUser2; -const searchedUser: ProfileTest = seedReadUser2; +const userWhoSearches: AuthData = AUTH_DATA1; +const searchedUser: Profile = PROFILE1; Sizes.forEach((size: Size): void => { describe(`Search tests with screen size ${size.width} show that users can `, () => { + before((): void => { + cy.resetSupabase() + }) beforeEach((): void => { cy.viewport(size.width, size.height) cy.visit('landing/sign-in'); - cy.signIn(loggedInUser); + cy.signIn(userWhoSearches); }) it('search other users by their first name.', (): void => { diff --git a/cypress/e2e/04.2 search negative api test.cy.ts b/cypress/e2e/04.2 search negative api test.cy.ts index 8207b356..09daf532 100644 --- a/cypress/e2e/04.2 search negative api test.cy.ts +++ b/cypress/e2e/04.2 search negative api test.cy.ts @@ -1,17 +1,22 @@ import {supabaseClient} from "../../src/app/auth/supabase-client"; import {POSTGRES_ERRORS} from "../fixtures/postgres_errors"; +import {AuthTokenResponse} from "@supabase/supabase-js"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; -describe(`Negative api tests for psearch feature show that `, async () => { +const signedInUserAuth: AuthData = AUTH_DATA1; +const otherUser: AuthData = AUTH_DATA2; + +describe(`Negative api tests for psearch feature show that `, async (): Promise => { let user_id: string | undefined; let token: string | undefined; - const TEST_ID = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; + const TEST_ID: string = otherUser.id; beforeEach(async (): Promise => { cy.visit('landing/sign-in'); - const response = await supabaseClient.auth.signInWithPassword( + const response: AuthTokenResponse = await supabaseClient.auth.signInWithPassword( { - email: 'follow@seed.com', - password: '12345678', + email: signedInUserAuth.email, + password: signedInUserAuth.password, } ) user_id = response.data.user?.id @@ -25,6 +30,6 @@ describe(`Negative api tests for psearch feature show that `, async () => { const response = await supabaseClient .rpc('search_user', {search_term: TEST_ID}) expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.noPermission) + expect(response.error?.code).to.be.oneOf([POSTGRES_ERRORS.noPermission, POSTGRES_ERRORS.function_not_existing]) }) }) diff --git a/cypress/e2e/05.1 onbording.cy.ts b/cypress/e2e/05.1 onbording.cy.ts index 09c0f779..05daac1d 100644 --- a/cypress/e2e/05.1 onbording.cy.ts +++ b/cypress/e2e/05.1 onbording.cy.ts @@ -1,33 +1,35 @@ import {Size, Sizes} from "../fixtures/size"; -import {ProfileTest} from "../fixtures/profile"; -import {userCreatedByCypress} from "../fixtures/user"; +import {AUTH_DATA1, AUTH_DATA2, AUTH_DATA3, AUTH_DATA4, AuthData} from "../../seed_and_test_data/01_test_auth"; +import {Profile, PROFILE1} from "../../seed_and_test_data/02_test_profiles"; -const newUser: ProfileTest = userCreatedByCypress; +const userFirstLoginDoingWelcomeTutorialAuth: AuthData = AUTH_DATA1; +const userFirstLoginDoingWelcomeTutorialProfile: Profile = PROFILE1; + +const userDoingProfileTutorialAuth: AuthData = AUTH_DATA2; + +const userDoingSearchTutorialAuth: AuthData = AUTH_DATA3; + +const userRestartingTutorialAuth: AuthData = AUTH_DATA4; -// ATTENTION: tests depends on previous tests Sizes.forEach((size: Size): void => { - describe(`Onboarding tests with screen size ${size.width} show that users can `, () => { + describe(`Onboarding tests with screen size ${size.width} show that users can `, (): void => { before((): void => { - cy.visit('landing/sign-up'); - - cy.signUp(newUser).then((value) => { - newUser.email = value - }) }) beforeEach((): void => { cy.viewport(size.width, size.height) cy.visit('landing/sign-in'); - cy.signIn(newUser); + }) + + it('see an assistant-welcome-dialog tutorial if they sign in the first time', (): void => { + cy.resetSupabase() + cy.signIn(userFirstLoginDoingWelcomeTutorialAuth); cy.interceptSupabaseCall('select_assistant') .as('loadAssistant') cy.interceptSupabaseCall('select_user') .as('loadUser') cy.wait(['@loadAssistant', '@loadUser']) - }) - - it('see an assistant-welcome-dialog tutorial if they sign in the first time', (): void => { cy.getDataCy('assistant-welcome-dialog') .shouldBeVisible() @@ -37,13 +39,13 @@ Sizes.forEach((size: Size): void => { .scrollIntoView() cy.getDataCy('welcome-first-name') - .type(newUser.first_name as string) + .type(userFirstLoginDoingWelcomeTutorialProfile.first_name as string) cy.getDataCy('welcome-last-name') .scrollIntoView() cy.getDataCy('welcome-last-name') - .type(newUser.last_name as string) + .type(userFirstLoginDoingWelcomeTutorialProfile.last_name as string) cy.getDataCy('step1navigateToProfileStep') .shouldBeVisible() @@ -54,6 +56,13 @@ Sizes.forEach((size: Size): void => { }) it('can save their tutorial progress and load their progress', (): void => { + cy.signIn(userFirstLoginDoingWelcomeTutorialAuth); + cy.interceptSupabaseCall('select_assistant') + .as('loadAssistant') + cy.interceptSupabaseCall('select_user') + .as('loadUser') + cy.wait(['@loadAssistant', '@loadUser']) + cy.getDataCy('assistant-profile-dialog') .shouldBeVisible() .click() @@ -62,7 +71,15 @@ Sizes.forEach((size: Size): void => { .shouldBeVisible() }) - it('do a tutorial about their profile settings', () => { + it('do a tutorial about their profile settings', (): void => { + cy.resetSupabase() + cy.signIn(userDoingProfileTutorialAuth); + cy.interceptSupabaseCall('select_assistant') + .as('loadAssistant') + cy.interceptSupabaseCall('select_user') + .as('loadUser') + cy.wait(['@loadAssistant', '@loadUser']) + cy.getDataCy('assistant-profile-dialog') .shouldBeVisible() .click() @@ -85,6 +102,14 @@ Sizes.forEach((size: Size): void => { }) it('do a tutorial about searching users and follow them', (): void => { + cy.resetSupabase() + cy.signIn(userDoingSearchTutorialAuth); + cy.interceptSupabaseCall('select_assistant') + .as('loadAssistant') + cy.interceptSupabaseCall('select_user') + .as('loadUser') + cy.wait(['@loadAssistant', '@loadUser']) + cy.getDataCy('assistant-search-dialog') .shouldBeVisible() .click() @@ -95,13 +120,11 @@ Sizes.forEach((size: Size): void => { cy.getDataCy('step3closeAndSkipTutorial') .scrollIntoView() - // .shouldBeVisible() somehow it is overflown and cypress can not detect it even it is visible cy.interceptSupabaseCall('update_skip_tutorial').as('skipTutorial') cy.interceptSupabaseCall('update_last_tutorial').as('lastTutorial') cy.getDataCy('step3navigateToSearchPage') .scrollIntoView() - // .shouldBeVisible() somehow it is overflown and cypress can not detect it even it is visible .click() cy.wait(['@skipTutorial', '@lastTutorial']) @@ -110,7 +133,14 @@ Sizes.forEach((size: Size): void => { }) it('can open the tutorial from profile settings again ', (): void => { - // cy.pause() + cy.resetSupabase() + cy.signIn(userRestartingTutorialAuth); + cy.interceptSupabaseCall('select_assistant') + .as('loadAssistant') + cy.interceptSupabaseCall('select_user') + .as('loadUser') + cy.wait(['@loadAssistant', '@loadUser']) + cy.navigateToHome() cy.getDataCy('home-to-profile') @@ -122,7 +152,6 @@ Sizes.forEach((size: Size): void => { .first() .click() - // cy.pause() cy.getDataCy('toggle-assistant-headline') .shouldBeVisible() .contains('Zeige Tutorials') @@ -142,7 +171,15 @@ Sizes.forEach((size: Size): void => { .shouldBeVisible() }) - it('can reject the tutorial and will not see it again ', () => { + it('can reject the tutorial and will not see it again ', (): void => { + cy.resetSupabase() + cy.signIn(userDoingProfileTutorialAuth); + cy.interceptSupabaseCall('select_assistant') + .as('loadAssistant') + cy.interceptSupabaseCall('select_user') + .as('loadUser') + cy.wait(['@loadAssistant', '@loadUser']) + cy.getDataCy('assistant-profile-dialog') .shouldBeVisible() .click() diff --git a/cypress/e2e/05.2 assistant negative api test.cy.ts b/cypress/e2e/05.2 assistant negative api test.cy.ts index 02fac0f7..2d67f6e2 100644 --- a/cypress/e2e/05.2 assistant negative api test.cy.ts +++ b/cypress/e2e/05.2 assistant negative api test.cy.ts @@ -1,17 +1,22 @@ import {supabaseClient} from "../../src/app/auth/supabase-client"; import {POSTGRES_ERRORS} from "../fixtures/postgres_errors"; +import {AuthTokenResponse} from "@supabase/supabase-js"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; -describe(`Negative api tests for the assistant feature show that `, async () => { +const signedInUserAuth: AuthData = AUTH_DATA1; +const otherUser: AuthData = AUTH_DATA2; + +describe(`Negative api tests for the assistant feature show that `, async (): Promise => { let user_id: string | undefined; let token: string | undefined; - const TEST_ID = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; + const TEST_ID: string = otherUser.id; beforeEach(async (): Promise => { cy.visit('landing/sign-in'); - const response = await supabaseClient.auth.signInWithPassword( + const response: AuthTokenResponse = await supabaseClient.auth.signInWithPassword( { - email: 'follow@seed.com', - password: '12345678', + email: signedInUserAuth.email, + password: signedInUserAuth.password, } ) user_id = response.data.user?.id diff --git a/cypress/e2e/06.1 notifications.cy.ts b/cypress/e2e/06.1 notifications.cy.ts index 8115a7f4..1e6bb611 100644 --- a/cypress/e2e/06.1 notifications.cy.ts +++ b/cypress/e2e/06.1 notifications.cy.ts @@ -1,26 +1,37 @@ -import {ProfileTest} from "../fixtures/profile"; -import {seedProfileFollowingUser, seedProfileFollowUser} from "../fixtures/user"; import {Size, Sizes} from "../fixtures/size"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; +import {Profile, PROFILE1, PROFILE2, PROFILE3} from "../../seed_and_test_data/02_test_profiles"; +import {PROFILE_COUNTER1, PROFILE_COUNTER2, ProfileCounter} from "../../seed_and_test_data/04_test_profile_counters"; -const followingUser: ProfileTest = seedProfileFollowingUser; -const followUser: ProfileTest = seedProfileFollowUser +const userWhoIsNotifiedAuth: AuthData = AUTH_DATA2; +const userWhoIsNotifiedProfile: Profile = PROFILE2; +const userWhoIsNotifiedCounter: ProfileCounter = PROFILE_COUNTER2; + +const userWhoNotifiesAuth: AuthData = AUTH_DATA1; +const userWhoNotifiesProfile: Profile = PROFILE1; +const userWhoNotifiesCounter: ProfileCounter = PROFILE_COUNTER1; + +const userWhoNotifiedBySeedProfile: Profile = PROFILE3; Sizes.forEach((size: Size): void => { - describe(`Notification tests with screen size { {${size.width} show that users can `, () => { + describe(`Notification tests with screen size { {${size.width} show that users can `, (): void => { + before((): void => { + }) beforeEach((): void => { - // cy.viewport(size.width, size.height) + cy.viewport(size.width, size.height); cy.visit('landing/sign-in'); - cy.signIn(followingUser); + cy.resetSupabase() + cy.signIn(userWhoIsNotifiedAuth); }) - const today = new Date(); - const yearString = today.getFullYear().toString(); - const monthString = String(today.getMonth() + 1).padStart(2, '0').toString(); // Months are zero-indexed, so we add 1 - const dayString = String(today.getDate()).padStart(2, '0').toString(); - - const todayString = dayString + '.' + monthString + '.' + yearString - const checkString = dayString + '/' + monthString + '/' + yearString.substring(2) + const today: Date = new Date(); + const yearString: string = today.getFullYear().toString(); + const monthString: string = String(today.getMonth() + 1).padStart(2, '0').toString(); // Months are zero-indexed, + // so we add 1 + const dayString: string = String(today.getDate()).padStart(2, '0').toString(); + const todayString: string = dayString + '.' + monthString + '.' + yearString + const checkString: string = dayString + '/' + monthString + '/' + yearString.substring(2) it('can open notification tabs.', (): void => { cy.getDataCy('nav-office', 'nav-office-desktop') @@ -39,11 +50,6 @@ Sizes.forEach((size: Size): void => { .first() .click({force: true}) - - cy.getDataCy('created_at_headline') - .shouldBeVisible() - .click() - cy.getDataCy('created_at') .shouldBeVisible() .first() @@ -69,7 +75,7 @@ Sizes.forEach((size: Size): void => { // .should('not.be.visible') }) - // + it('filter notifications for follow type', (): void => { cy.getDataCy('nav-office', 'nav-office-desktop') .shouldBeVisible() @@ -91,12 +97,12 @@ Sizes.forEach((size: Size): void => { .click({force: true}) cy.getDataCy('filterStringInput') - .type(followUser.first_name as string) + .type(userWhoNotifiedBySeedProfile.first_name as string) cy.getDataCy('first_name') .shouldBeVisible() .first() - .contains(followUser.first_name as string) + .contains(userWhoNotifiedBySeedProfile.first_name as string) }) it('filter notifications for dates', (): void => { @@ -117,9 +123,6 @@ Sizes.forEach((size: Size): void => { }) it('will not receive messages from following if the user disables it.', (): void => { - cy.signOut(followingUser); - cy.signIn(followUser); - cy.navigateToHome() cy.getDataCy('home-to-profile') .shouldBeVisible() @@ -142,12 +145,17 @@ Sizes.forEach((size: Size): void => { .click() cy.wait('@updateNotifications') - cy.signOut(followUser); - cy.signIn(followingUser) - cy.followUser(followUser, followingUser) + cy.signOut(userWhoIsNotifiedAuth); + cy.signIn(userWhoNotifiesAuth) + cy.followUser( + userWhoIsNotifiedProfile, + userWhoIsNotifiedCounter, + userWhoNotifiesProfile, + userWhoNotifiesCounter + ) - cy.signOut(followingUser); - cy.signIn(followUser) + cy.signOut(userWhoNotifiesAuth); + cy.signIn(userWhoIsNotifiedAuth) cy.getDataCy('nav-office', 'nav-office-desktop') .shouldBeVisible() @@ -157,56 +165,8 @@ Sizes.forEach((size: Size): void => { .shouldBeVisible() cy.getDataCy('first_name') - .should('not.exist') - - cy.navigateToHome() - cy.getDataCy('home-to-profile') .shouldBeVisible() - .click() - - // reverse changes from here onward (implicite cleanup) - - cy.getDataCy('nav-profile-edit', 'nav-profile-edit-desktop') - .filter(':visible') - .first() - .click() - - cy.getDataCy('toggle-notifications-headline') - .shouldBeVisible() - .contains('Erhalte Nachrichten') - - cy.interceptSupabaseCall('update_receive_notifications_from_follow') - .as('updateNotifications') - - cy.getDataCy('toggle-notifications-from-user') - .shouldBeVisible() - .click() - cy.wait('@updateNotifications') - - cy.signOut(followUser) - cy.signIn(followingUser) - - cy.interceptSupabaseCall('select_user') - .as('selectUser') - cy.interceptSupabaseCall('check_if_following') - .as('isFollowing') - cy.interceptSupabaseCall('select_following_counter') - .as('followingCounter') - - cy.searchUser(followUser.first_name as string) - .click() - - cy.wait(['@followingCounter', '@isFollowing', '@selectUser']) - - cy.interceptSupabaseCall('unfollow_transaction').as('unfollow') - cy.getDataCy('followButton') - .shouldBeVisible() - .should('have.text', 'UNFOLLOW ') - .click() - cy.wait('@unfollow') - - cy.contains('Successful unfollowed') - .should('be.visible') + .should('not.contain', userWhoNotifiesProfile.first_name as string) }) }) }); diff --git a/cypress/e2e/06.2 notifications negative api test.cy.ts b/cypress/e2e/06.2 notifications negative api test.cy.ts index f5b6ed39..f3354f4d 100644 --- a/cypress/e2e/06.2 notifications negative api test.cy.ts +++ b/cypress/e2e/06.2 notifications negative api test.cy.ts @@ -1,17 +1,22 @@ import {supabaseClient} from "../../src/app/auth/supabase-client"; import {POSTGRES_ERRORS} from "../fixtures/postgres_errors"; +import {AuthTokenResponse} from "@supabase/supabase-js"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; -describe(`Negative api tests for the notifications feature show that `, async () => { +const signedInUserAuth: AuthData = AUTH_DATA1; +const otherUser: AuthData = AUTH_DATA2; + +describe(`Negative api tests for the notifications feature show that `, async (): Promise => { let user_id: string | undefined; let token: string | undefined; - const TEST_ID = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; + const TEST_ID: string = otherUser.id; beforeEach(async (): Promise => { cy.visit('landing/sign-in'); - const response = await supabaseClient.auth.signInWithPassword( + const response: AuthTokenResponse = await supabaseClient.auth.signInWithPassword( { - email: 'follow@seed.com', - password: '12345678', + email: signedInUserAuth.email, + password: signedInUserAuth.password, } ) user_id = response.data.user?.id diff --git a/cypress/e2e/06.3 notifications push receive test.cy.ts b/cypress/e2e/06.3 notifications push receive test.cy.ts index 527b9435..4c1574f9 100644 --- a/cypress/e2e/06.3 notifications push receive test.cy.ts +++ b/cypress/e2e/06.3 notifications push receive test.cy.ts @@ -1,20 +1,20 @@ -import {ProfileTest} from "../fixtures/profile"; -import {userCreatedByCypress} from "../fixtures/user"; import {supabaseClient} from "../../src/app/auth/supabase-client"; -import {POSTGRES_ERRORS} from "../fixtures/postgres_errors"; +import {AuthTokenResponse} from "@supabase/supabase-js"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; -const profile1: ProfileTest = userCreatedByCypress; +const signedInUserAuth: AuthData = AUTH_DATA1; +const otherUser: AuthData = AUTH_DATA2; describe(`Push tests show that `, async (): Promise => { let user_id: string | undefined; let token: string | undefined; - const TEST_ID = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; + const TEST_ID: string = otherUser.id; beforeEach(async (): Promise => { - const response = await supabaseClient.auth.signInWithPassword( + const response: AuthTokenResponse = await supabaseClient.auth.signInWithPassword( { - email: 'follow@seed.com', - password: '12345678', + email: signedInUserAuth.email, + password: signedInUserAuth.password, } ) user_id = response.data.user?.id @@ -25,16 +25,16 @@ describe(`Push tests show that `, async (): Promise => { it('notifications function can not be accessed by client users', async (): Promise => { // TODO test implementation - const response = await supabaseClient.functions.invoke('hello-world'); - expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + // const response = await supabaseClient.functions.invoke('hello-world'); + // expect(response.data).to.be.null + // expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) }) it('notifications function can not be called by postgres service role', async (): Promise => { // TODO test implementation - const response = await supabaseClient.functions.invoke('hello-world'); - expect(response.data).to.be.null - expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) + // const response = await supabaseClient.functions.invoke('hello-world'); + // expect(response.data).to.be.null + // expect(response.error?.code).to.be.equal(POSTGRES_ERRORS.function_not_existing) // add secret env service role key variable }) diff --git a/cypress/e2e/99. Default copy.cy.ts b/cypress/e2e/99. Default copy.cy.ts index 187d2e56..1b10e7e1 100644 --- a/cypress/e2e/99. Default copy.cy.ts +++ b/cypress/e2e/99. Default copy.cy.ts @@ -1,31 +1,36 @@ import {Size, Sizes} from "../fixtures/size"; -import {ProfileTest} from "../fixtures/profile"; -import {userCreatedByCypress} from "../fixtures/user"; import {supabaseClient} from "../../src/app/auth/supabase-client"; +import {AUTH_DATA1, AUTH_DATA2, AuthData} from "../../seed_and_test_data/01_test_auth"; +import {AuthTokenResponse} from "@supabase/supabase-js"; -const profile1: ProfileTest = userCreatedByCypress; +const signedInUserAuth: AuthData = AUTH_DATA1; +const otherUser: AuthData = AUTH_DATA2; Sizes.forEach((size: Size): void => { - describe(`Feature tests with screen size ${size.width} show that users can `, () => { + describe(`Feature tests with screen size ${size.width} show that users can `, (): void => { + before((): void => { + + }) beforeEach((): void => { + cy.resetSupabase() cy.viewport(size.width, size.height) cy.visit('landing/sign-in'); - cy.signIn(profile1); + cy.signIn(signedInUserAuth); }) }) }); -describe(`Negative api tests for profile_counter table show that `, async () => { +describe(`Negative api tests for profile_counter table show that `, async (): Promise => { let user_id: string | undefined; let token: string | undefined; - const TEST_ID = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; + const TEST_ID: string = otherUser.id; beforeEach(async (): Promise => { - const response = await supabaseClient.auth.signInWithPassword( + const response: AuthTokenResponse = await supabaseClient.auth.signInWithPassword( { - email: 'follow@seed.com', - password: '12345678', + email: signedInUserAuth.email, + password: signedInUserAuth.password, } ) user_id = response.data.user?.id diff --git a/cypress/fixtures/api_url.ts b/cypress/fixtures/api_url.ts deleted file mode 100644 index c24c601a..00000000 --- a/cypress/fixtures/api_url.ts +++ /dev/null @@ -1 +0,0 @@ -export const API_URL = 'https://abcwkgkiztruxwvfwabf.supabase.co/rest/v1/rpc/' diff --git a/cypress/fixtures/assistant_seed.json b/cypress/fixtures/assistant_seed.json deleted file mode 100644 index d31ad6c3..00000000 --- a/cypress/fixtures/assistant_seed.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "first_sign_in": , - "boolean": , - "skip_tutorial": , - "last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, -{ -"first_sign_in": , -"boolean": , -"skip_tutorial": , -"last_tutorial": -}, diff --git a/cypress/fixtures/auth_seed_data.json b/cypress/fixtures/auth_seed_data.json deleted file mode 100644 index 430b45fc..00000000 --- a/cypress/fixtures/auth_seed_data.json +++ /dev/null @@ -1,693 +0,0 @@ -{ - id: , - aud: , - role: , - email: , - encrypted_password: , - email_confirmed_at: , - invited_at: , - confirmation_token: , - confirmation_sent_at: , - recovery_token: , - recovery_sent_at: , - email_change_token_new: , - email_change: , - email_change_sent_at: , - last_sign_in_at: , - raw_app_meta_data: , - raw_user_meta_data: , - is_super_admin: , - created_at: , - "updated_at": , - "phone": , - "phone_confirmed_at": , - "phone_change": , - "phone_change_token": , - "phone_change_sent_at": , - "confirmed_at": , - "email_change_token_current": , - "email_change_confirm_status": , - "banned_until": , - "reauthentication_token": , - "reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, -{ -id: , -aud: , -role: , -email: , -encrypted_password: , -email_confirmed_at: , -invited_at: , -confirmation_token: , -confirmation_sent_at: , -recovery_token: , -recovery_sent_at: , -email_change_token_new: , -email_change: , -email_change_sent_at: , -last_sign_in_at: , -raw_app_meta_data: , -raw_user_meta_data: , -is_super_admin: , -created_at: , -"updated_at": , -"phone": , -"phone_confirmed_at": , -"phone_change": , -"phone_change_token": , -"phone_change_sent_at": , -"confirmed_at": , -"email_change_token_current": , -"email_change_confirm_status": , -"banned_until": , -"reauthentication_token": , -"reauthentication_sent_at": -}, diff --git a/cypress/fixtures/profile.ts b/cypress/fixtures/profile.ts deleted file mode 100644 index ac51d3ff..00000000 --- a/cypress/fixtures/profile.ts +++ /dev/null @@ -1,34 +0,0 @@ -export type Profile = { - id: string, - username?: string | null, - first_name: string | null, - last_name: string | null, - profile_image?: string | null, - updated_at?: Date | null -} - -export interface ProfileTest extends Profile { - password: string, - email: string, - name: string, - about: string, - contactEmail: string, - contactPhone: string, - street: string, - postCode: string, - city: string, - ftsName: string, - follower_counter: number, - following_counter: number, - follower: ProfileMin[], - following: ProfileMin[], - is_following: boolean, - profile_id: string -} - -export type ProfileMin = { - id: string - first_name: string, - last_name: string, - profile_image?: string -} diff --git a/cypress/fixtures/profile_follow_seed.json b/cypress/fixtures/profile_follow_seed.json deleted file mode 100644 index e69de29b..00000000 diff --git a/cypress/fixtures/profile_seed.json b/cypress/fixtures/profile_seed.json deleted file mode 100644 index e69de29b..00000000 diff --git a/cypress/fixtures/profiles_counter_seed.json b/cypress/fixtures/profiles_counter_seed.json deleted file mode 100644 index 79fdc3b0..00000000 --- a/cypress/fixtures/profiles_counter_seed.json +++ /dev/null @@ -1,2 +0,0 @@ -EQQ/Q - diff --git a/cypress/fixtures/user.ts b/cypress/fixtures/user.ts deleted file mode 100644 index ca4fe245..00000000 --- a/cypress/fixtures/user.ts +++ /dev/null @@ -1,151 +0,0 @@ -import {ProfileTest} from "./profile"; - -// A user created by a cypress auth test -export const userCreatedByCypress: ProfileTest = { - id: '', - first_name: 'Fabian', - last_name: 'Bäcker', - name: '', - email: 'user1@seed.com', - password: "12345678", - about: '', - contactEmail: '', - contactPhone: '', - street: '', - postCode: '', - city: '', - ftsName: '', - profile_image: '', - username: '', - follower_counter: 1, - following_counter: 2, - follower: [], - following: [], - is_following: false, - profile_id: '' -} - -// A user to view -export const seedReadUser2: ProfileTest = { - id: '', - first_name: 'Fabian', - last_name: 'Bäcker', - name: '', - email: 'user2@seed.com', - password: '12345678', - about: '', - contactEmail: '', - contactPhone: '', - street: '', - postCode: '', - city: '', - ftsName: '', - profile_image: '', - username: '', - follower_counter: 1, - following_counter: 2, - follower: [], - following: [], - is_following: false, - profile_id: '' -} - -// A user to view -export const seedReadUser3: ProfileTest = { - id: '', - first_name: 'Tobias', - last_name: 'Müller', - name: '', - email: 'user3@cypress.com', - password: '12345678', - about: '', - contactEmail: '', - contactPhone: '', - street: '', - postCode: '', - city: '', - ftsName: '', - profile_image: '', - username: '', - follower_counter: 1, - following_counter: 2, - follower: [], - following: [], - is_following: false, - profile_id: '' -} - -// A user to edit its own data -export const seedWriteUser: ProfileTest = { - id: '', - first_name: 'Lars', - last_name: 'Berg', - name: '', - email: 'edit1@seed.com', - password: '12345678', - about: '', - contactEmail: '', - contactPhone: '', - street: '', - postCode: '', - city: '', - ftsName: '', - profile_image: '', - username: '', - follower_counter: 1, - following_counter: 2, - follower: [], - following: [], - is_following: false, - profile_id: '' -} - -// A user to test follow actions -export const seedProfileFollowUser: ProfileTest = { - id: '', - first_name: 'Jana', - last_name: 'Klein', - name: '', - email: 'follow@seed.com', - password: '12345678', - about: '', - contactEmail: '', - contactPhone: '', - street: '', - postCode: '', - city: '', - ftsName: '', - profile_image: '', - username: '', - follower_counter: 1, - following_counter: 2, - follower: [], - following: [], - is_following: false, - profile_id: '' -} - -// A user to test unfollow actions -export const seedProfileFollowingUser: ProfileTest = { - id: '', - first_name: 'Lennart', - last_name: 'Lieb', - name: '', - email: 'unfollow@seed.com', - password: '12345678', - about: '', - contactEmail: '', - contactPhone: '', - street: '', - postCode: '', - city: '', - ftsName: '', - profile_image: '', - username: '', - follower_counter: 1, - following_counter: 2, - follower: [], - following: [], - is_following: false, - profile_id: '' -} diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 629f6449..e0701264 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -12,9 +12,11 @@ // // -- This is a parent command -- -import {ProfileTest} from "../fixtures/profile"; import {FunctionName} from "../../supabase/types/supabase.shorthand-types"; -import {API_URL} from "../fixtures/api_url"; +import {environment} from "../../src/environments/environment"; +import {Profile} from "../../seed_and_test_data/02_test_profiles"; +import {ProfileCounter} from "../../seed_and_test_data/04_test_profile_counters"; +import {AuthData} from "../../seed_and_test_data/01_test_auth"; import Chainable = Cypress.Chainable; /** @@ -27,19 +29,19 @@ Cypress.Commands.add('getDataCy', (value: string, value2?: string): void => { }); Cypress.Commands.add('interceptSupabaseCall', (endPoint: FunctionName): void => { - const apiUrl = API_URL - cy.intercept('POST', apiUrl + endPoint) + const apiUrl = environment.supabaseProjectUrl; + cy.intercept('POST', apiUrl + '/rest/v1/rpc/' + endPoint) }); -Cypress.Commands.add('shouldBeVisible', {prevSubject: 'element'}, (subject) => { +Cypress.Commands.add('shouldBeVisible', {prevSubject: 'element'}, (subject): void => { cy.wrap(subject).should('be.visible'); }); -Cypress.Commands.add('andContain', {prevSubject: 'element'}, (subject, value) => { +Cypress.Commands.add('andContain', {prevSubject: 'element'}, (subject, value): void => { cy.wrap(subject).and('contain', value); }); -Cypress.Commands.add('signIn', (profile: ProfileTest) => { +Cypress.Commands.add('signIn', (profile: AuthData): void => { cy.get('input').clear() cy.get('[data-cy="email"]').type(profile.email) cy.get('[data-cy="password"]').clear() @@ -47,15 +49,14 @@ Cypress.Commands.add('signIn', (profile: ProfileTest) => { cy.get('[data-cy="sign-in"]').click() }); -Cypress.Commands.add('openSearchTab', () => { +Cypress.Commands.add('openSearchTab', (): void => { cy.getDataCy('nav-search', 'nav-search-desktop') .filter(':visible') .first() .click() }); -Cypress.Commands.add('searchUser', (firstName: string) => { - // y.pause() +Cypress.Commands.add('searchUser', (firstName: string): void => { cy.openSearchTab() cy.getDataCy('search').type(firstName) cy.getDataCy('user-search-results') @@ -67,9 +68,11 @@ Cypress.Commands.add('searchUser', (firstName: string) => { Cypress.Commands.add( 'followUser', ( - followingUser: ProfileTest, - followUser: ProfileTest - ) => { + userWhoIsFollowedProfile: Profile, + userWhoIsFollowedCounter: ProfileCounter, + userWhoFollowsProfile: Profile, + userWhoFollowsCounter: ProfileCounter + ): void => { cy.interceptSupabaseCall('select_user') .as('selectUser') @@ -78,23 +81,24 @@ Cypress.Commands.add( cy.interceptSupabaseCall('select_following_counter') .as('followingCounter') - cy.searchUser(followingUser.first_name as string) + cy.searchUser(userWhoIsFollowedProfile.first_name as string) .click() - cy.wait(['@followingCounter', '@isFollowing', '@selectUser']) + // cy.wait(['@followingCounter', '@isFollowing', '@selectUser']) cy.getDataCy('first-name') .shouldBeVisible() - .contains(followingUser.first_name as string) + .contains(userWhoIsFollowedProfile.first_name as string) cy.interceptSupabaseCall('follow_transaction') .as('followTransaction') cy.getDataCy('followButton') + .scrollIntoView() .shouldBeVisible() .should('have.text', 'FOLLOW ') .click() - cy.wait('@followTransaction') + // cy.wait('@followTransaction') cy.contains('Successful followed') .should('be.visible') @@ -105,22 +109,22 @@ Cypress.Commands.add( cy.getDataCy('followerCounter') .shouldBeVisible() - .contains(followingUser.follower_counter + 1) + .contains(userWhoIsFollowedCounter.follower_counter + 1) - cy.searchUser(followUser.first_name as string) + cy.searchUser(userWhoFollowsProfile.first_name as string) .click() cy.getDataCy('first-name') .shouldBeVisible() - .contains(followUser.first_name as string) + .contains(userWhoFollowsProfile.first_name as string) cy.getDataCy('followingCounter') .shouldBeVisible() - .contains(followUser.following_counter + 1) + .contains(userWhoFollowsCounter.following_counter + 1) } ) -Cypress.Commands.add('navigateToHome', () => { +Cypress.Commands.add('navigateToHome', (): void => { cy.getDataCy('nav-home', 'nav-home-desktop') .filter(':visible') .first() @@ -130,7 +134,7 @@ Cypress.Commands.add('navigateToHome', () => { .contains('Dein Profil und Gruppen.') }) -Cypress.Commands.add('signOut', (signedInUser: ProfileTest) => { +Cypress.Commands.add('signOut', (signedInUser: AuthData): void => { cy.navigateToHome() cy.getDataCy('home-to-profile') .shouldBeVisible() @@ -145,7 +149,7 @@ Cypress.Commands.add('signOut', (signedInUser: ProfileTest) => { cy.url().should('contain', 'sign-in') }) -Cypress.Commands.add('signUp', (newUser: ProfileTest): Chainable => { +Cypress.Commands.add('signUp', (newUser: AuthData): Chainable => { const randomNumber: number = Math.floor(Math.random() * 10000000); newUser.email = 'test' + randomNumber + '@gmail.com'; cy.visit('landing/signup'); @@ -163,3 +167,15 @@ Cypress.Commands.add('signUp', (newUser: ProfileTest): Chainable => { return cy.wrap(newUser.email); }) +Cypress.Commands.add('resetSupabase', (): void => { + // Tries to reset the database 3 times + try { + cy.exec('echo Y | npx supabase db reset --linked') + } catch (error) { + try { + cy.exec('echo Y | npx supabase db reset --linked') + } catch (error) { + cy.exec('echo Y | npx supabase db reset --linked') + } + } +}); diff --git a/cypress/support/index.d.ts b/cypress/support/index.d.ts index 824f232b..79977f2e 100644 --- a/cypress/support/index.d.ts +++ b/cypress/support/index.d.ts @@ -1,5 +1,7 @@ -import {ProfileTest} from "../fixtures/profile"; import {FunctionName} from "../../supabase/types/supabase.shorthand-types"; +import {AuthData} from "../../seed_and_test_data/01_test_auth"; +import {Profile} from "../../seed_and_test_data/02_test_profiles"; +import {ProfileCounter} from "../../seed_and_test_data/04_test_profile_counters"; declare global { @@ -35,9 +37,9 @@ declare global { /** * Sign in a user with the given profile. * - * @param {ProfileTest} profile - The profile information of the user. + * @param {AuthData} profile - The profile information of the user. */ - signIn(profileTest: ProfileTest): Chainable + signIn(authData: AuthData): Chainable /** * Custom command to test if user can open the search tab. @@ -51,15 +53,21 @@ declare global { */ searchUser(firstName: string): Chainable + /** - * Follows a user. + * Follows a user's profile by updating the counters and returning a Chainable element. * - * @param {ProfileTest} followingUser - The profile who is being followed. - * @param {ProfileTest} followUser - The profile who follows the other user. + * @param {Profile} userWhoIsFollowedProfile - The profile of the user who is being followed. + * @param {ProfileCounter} userWhoIsFollowedCounter - The counter of the user who is being followed. + * @param {Profile} userWhoFollowsProfile - The profile of the user who is following. + * @param {ProfileCounter} userWhoFollowsCounter - The counter of the user who is following. + * @return {Chainable} - A Chainable element. */ followUser( - followingUser: ProfileTest, - followUser: ProfileTest + userWhoIsFollowedProfile: Profile, + userWhoIsFollowedCounter: ProfileCounter, + userWhoFollowsProfile: Profile, + userWhoFollowsCounter: ProfileCounter ): Chainable /** @@ -70,16 +78,21 @@ declare global { /** * Signs out a signed-in user. * - * @param {ProfileTest} signedInUser - The signed-in user. + * @param {AuthData} signedInUser - The signed-in user. */ - signOut(signedInUser: ProfileTest): Chainable + signOut(signedInUser: AuthData): Chainable /** * Signs up a new user. * - * @param {ProfileTest} newUser - The new user. + * @param {AuthData} newUser - The new user. + */ + signUp(newUser: AuthData): Chainable + + /** + * Custom command to reset supabase */ - signUp(newUser: ProfileTest): Chainable + resetSupabase(): boolean } } } diff --git a/package.json b/package.json index 4cff8e68..f6f1b5ea 100644 --- a/package.json +++ b/package.json @@ -1,61 +1,64 @@ { - "name": "polity", - "version": "0.0.0", - "scripts": { - "ng": "ng", - "start": "ng serve", - "build": "ng build", - "watch": "ng build --watch --configuration development", - "test": "ng test" - }, - "private": true, - "dependencies": { - "@angular/animations": "^17.0.4", - "@angular/cdk": "^17.0.1", - "@angular/common": "^17.0.4", - "@angular/compiler": "^17.0.4", - "@angular/core": "^17.0.4", - "@angular/forms": "^17.0.4", - "@angular/platform-browser": "^17.0.4", - "@angular/platform-browser-dynamic": "^17.0.4", - "@angular/router": "^17.0.4", - "@angular/service-worker": "^17.0.4", - "@supabase/supabase-js": "^2.38.5", - "@taiga-ui/addon-charts": "^3.55.0", - "@taiga-ui/addon-commerce": "^3.55.0", - "@taiga-ui/addon-doc": "^3.55.0", - "@taiga-ui/addon-mobile": "^3.55.0", - "@taiga-ui/addon-preview": "^3.55.0", - "@taiga-ui/addon-table": "^3.55.0", - "@taiga-ui/addon-tablebars": "^3.55.0", - "@taiga-ui/cdk": "^3.55.0", - "@taiga-ui/core": "^3.55.0", - "@taiga-ui/icons": "^3.55.0", - "@taiga-ui/kit": "^3.55.0", - "@taiga-ui/layout": "^3.55.0", - "@taiga-ui/styles": "^3.55.0", - "@tinkoff/ng-dompurify": "^4.0.0", - "dompurify": "^3.0.6", - "ngx-infinite-scroll": "^17.0.0", - "rxjs": "~7.8.0", - "tslib": "^2.3.0", - "type-fest": "^4.8.2", - "typescript": "5.2", - "zone.js": "~0.14.2" - }, - "devDependencies": { - "@angular-devkit/build-angular": "^17.0.3", - "@angular/cli": "~17.0.3", - "@angular/compiler-cli": "^17.0.4", - "@types/dompurify": "^3.0.5", - "@types/jasmine": "~4.3.0", - "cypress": "^13.6.0", - "jasmine-core": "~4.5.0", - "karma": "~6.4.0", - "karma-chrome-launcher": "~3.1.0", - "karma-coverage": "~2.2.0", - "karma-jasmine": "~5.1.0", - "karma-jasmine-html-reporter": "~2.0.0", - "supabase": "^1.113.2" - } -} \ No newline at end of file + "name": "polity", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "ng test", + "supabase:db:reset": "supabase db reset", + "supabase:db:reset:linked": "echo Y | npx supabase db reset --linked", + "supabase:db:push:linked": "supabase db push --include-all" + }, + "private": true, + "dependencies": { + "@angular/animations": "^17.0.4", + "@angular/cdk": "^17.0.1", + "@angular/common": "^17.0.4", + "@angular/compiler": "^17.0.4", + "@angular/core": "^17.0.4", + "@angular/forms": "^17.0.4", + "@angular/platform-browser": "^17.0.4", + "@angular/platform-browser-dynamic": "^17.0.4", + "@angular/router": "^17.0.4", + "@angular/service-worker": "^17.0.4", + "@supabase/supabase-js": "^2.38.5", + "@taiga-ui/addon-charts": "^3.55.0", + "@taiga-ui/addon-commerce": "^3.55.0", + "@taiga-ui/addon-doc": "^3.55.0", + "@taiga-ui/addon-mobile": "^3.55.0", + "@taiga-ui/addon-preview": "^3.55.0", + "@taiga-ui/addon-table": "^3.55.0", + "@taiga-ui/addon-tablebars": "^3.55.0", + "@taiga-ui/cdk": "^3.55.0", + "@taiga-ui/core": "^3.55.0", + "@taiga-ui/icons": "^3.55.0", + "@taiga-ui/kit": "^3.55.0", + "@taiga-ui/layout": "^3.55.0", + "@taiga-ui/styles": "^3.55.0", + "@tinkoff/ng-dompurify": "^4.0.0", + "dompurify": "^3.0.6", + "ngx-infinite-scroll": "^17.0.0", + "rxjs": "~7.8.0", + "tslib": "^2.3.0", + "type-fest": "^4.8.2", + "typescript": "5.2", + "zone.js": "~0.14.2" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^17.0.3", + "@angular/cli": "~17.0.3", + "@angular/compiler-cli": "^17.0.4", + "@types/dompurify": "^3.0.5", + "@types/jasmine": "~4.3.0", + "cypress": "^13.6.0", + "jasmine-core": "~4.5.0", + "karma": "~6.4.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage": "~2.2.0", + "karma-jasmine": "~5.1.0", + "karma-jasmine-html-reporter": "~2.0.0", + "supabase": "^1.113.2" + } +} diff --git a/seed_and_test_data/01_auth.json b/seed_and_test_data/01_auth.json new file mode 100644 index 00000000..8f06cf10 --- /dev/null +++ b/seed_and_test_data/01_auth.json @@ -0,0 +1,197 @@ +[ + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "aud": "authenticated", + "role": "authenticated", + "email": "user1@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "invited_at": "2022-06-24T17:22:59.653Z", + "confirmation_token": "", + "confirmation_sent_at": "2022-06-24T17:22:59.653Z", + "recovery_token": "", + "recovery_sent_at": "2022-06-24T17:22:59.653Z", + "email_change_token_new": "", + "email_change": "", + "email_change_sent_at": "2022-06-24T17:22:59.653Z", + "last_sign_in_at": "2022-06-24T17:22:59.657Z", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {}, + "is_super_admin": "FALSE", + "created_at": "2022-06-24T17:22:59.649Z", + "updated_at": "2022-06-24T17:22:59.649Z", + "phone": "hgvhgvgvhg6767", + "phone_confirmed_at": "2022-06-24T17:22:59.649Z", + "phone_change": "", + "phone_change_token": "", + "phone_change_sent_at": "2022-06-24T17:22:59.653Z", + "confirmed_at": "2022-06-24T17:22:59.653Z", + "email_change_token_current": "", + "email_change_confirm_status": "1", + "banned_until": "2022-06-24T17:22:59.653Z", + "reauthentication_token": "", + "reauthentication_sent_at": "2022-06-24T17:22:59.653Z", + "is_sso_user": "FALSE", + "deleted_at": "2022-06-24T17:22:59.649Z" + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "b24f9e68-8fac-4525-b001-fffb91704d68", + "aud": "authenticated", + "role": "authenticated", + "email": "user2@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "aud": "authenticated", + "role": "authenticated", + "email": "user3@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "aud": "authenticated", + "role": "authenticated", + "email": "user4@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "aud": "authenticated", + "role": "authenticated", + "email": "user5@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "aud": "authenticated", + "role": "authenticated", + "email": "user6@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "aud": "authenticated", + "role": "authenticated", + "email": "user7@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "437bf909-34c5-4e54-b1eb-799771159cd1", + "aud": "authenticated", + "role": "authenticated", + "email": "user8@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "eada6e0c-e432-4af8-b238-71394e0866bc", + "aud": "authenticated", + "role": "authenticated", + "email": "user9@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "aud": "authenticated", + "role": "authenticated", + "email": "user10@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + } +] diff --git a/seed_and_test_data/01_identities.json b/seed_and_test_data/01_identities.json new file mode 100644 index 00000000..6b3e0d9a --- /dev/null +++ b/seed_and_test_data/01_identities.json @@ -0,0 +1,30 @@ +[ + { + "provider_id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "user_id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "identity_data": { + "sub": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "email": "user1@gmail.com", + "email_verified": false, + "phone_verified": false + }, + "provider": "email", + "last_sign_in_at": "2024-01-01 16:02:39.256589+00", + "created_at": "2024-01-01 16:02:39.256589+00", + "updated_at": "2024-01-01 16:02:39.256589+00" + }, + { + "provider_id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "user_id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "identity_data": { + "sub": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "email": "user4@gmail.com", + "email_verified": false, + "phone_verified": false + }, + "provider": "email", + "last_sign_in_at": "2024-01-01 16:02:39.256589+00", + "created_at": "2024-01-01 16:02:39.256589+00", + "updated_at": "2024-01-01 16:02:39.256589+00" + } +] diff --git a/seed_and_test_data/01_test_auth.ts b/seed_and_test_data/01_test_auth.ts new file mode 100644 index 00000000..bef65af9 --- /dev/null +++ b/seed_and_test_data/01_test_auth.ts @@ -0,0 +1,65 @@ +import * as jsonData from './01_auth.json'; + +export type AuthData = { + instance_id: any, + id: string, + aud: string, + role: string, + email: string, + password: string, + encrypted_password: string, + email_confirmed_at?: Date | string | undefined, + invited_at?: Date | string | undefined, + confirmation_token?: any, + confirmation_sent_at?: Date | string | undefined, + recovery_token?: any, + recovery_sent_at?: Date | string | undefined, + email_change_token_new?: any, + email_change?: any, + email_change_sent_at?: Date | string | undefined, + last_sign_in_at?: Date | string | undefined, + raw_app_meta_data?: any, + raw_user_meta_data?: any, + is_super_admin?: boolean | string | undefined, + created_at?: Date | string | undefined, + updated_at?: Date | string | undefined, + phone?: any, + phone_confirmed_at?: Date | string, + phone_change?: any, + phone_change_token?: any, + phone_change_sent_at?: Date | string | undefined, + confirmed_at?: Date | string | undefined, + email_change_token_current?: any, + email_change_confirm_status?: any, + banned_until?: Date | string | undefined, + reauthentication_token?: any, + reauthentication_sent_at?: Date | string | undefined, + is_sso_user?: boolean | string | undefined, + deleted_at?: Date | string | undefined +} + +const Persons: AuthData[] = jsonData; + +const AUTH_DATA1: AuthData = Persons[0]; +const AUTH_DATA2: AuthData = Persons[1]; +const AUTH_DATA3: AuthData = Persons[2]; +const AUTH_DATA4: AuthData = Persons[3]; +const AUTH_DATA5: AuthData = Persons[4]; +const AUTH_DATA6: AuthData = Persons[5]; +const AUTH_DATA7: AuthData = Persons[6]; +const AUTH_DATA8: AuthData = Persons[7]; +const AUTH_DATA9: AuthData = Persons[8]; +const AUTH_DATA10: AuthData = Persons[9]; + +export { + AUTH_DATA1, + AUTH_DATA2, + AUTH_DATA3, + AUTH_DATA4, + AUTH_DATA5, + AUTH_DATA6, + AUTH_DATA7, + AUTH_DATA8, + AUTH_DATA9, + AUTH_DATA10 +}; diff --git a/seed_and_test_data/02_profiles.json b/seed_and_test_data/02_profiles.json new file mode 100644 index 00000000..41397ec1 --- /dev/null +++ b/seed_and_test_data/02_profiles.json @@ -0,0 +1,52 @@ +[ + { + "id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "first_name": "Fabian", + "last_name": "Bäcker" + }, + { + "id": "b24f9e68-8fac-4525-b001-fffb91704d68", + "first_name": "Laura", + "last_name": "Müller" + }, + { + "id": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "first_name": "Lars", + "last_name": "Berg" + }, + { + "id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "first_name": "Pia", + "last_name": "Roller" + }, + { + "id": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "first_name": "Tobias", + "last_name": "Kling" + }, + { + "id": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "first_name": "Maya", + "last_name": "Lieb" + }, + { + "id": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "first_name": "Lennart", + "last_name": "Lang" + }, + { + "id": "437bf909-34c5-4e54-b1eb-799771159cd1", + "first_name": "Viki", + "last_name": "Frieden" + }, + { + "id": "eada6e0c-e432-4af8-b238-71394e0866bc", + "first_name": "Jens", + "last_name": "Spielberg" + }, + { + "id": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "first_name": "Anna", + "last_name": "Lieder" + } +] diff --git a/seed_and_test_data/02_test_profiles.ts b/seed_and_test_data/02_test_profiles.ts new file mode 100644 index 00000000..a049f726 --- /dev/null +++ b/seed_and_test_data/02_test_profiles.ts @@ -0,0 +1,33 @@ +import * as jsonData from './02_profiles.json'; + +export type Profile = { + id: string; + first_name: string; + last_name: string; +} + +const Profiles: Profile[] = jsonData; + +const PROFILE1: Profile = Profiles[0] +const PROFILE2: Profile = Profiles[1] +const PROFILE3: Profile = Profiles[2] +const PROFILE4: Profile = Profiles[3] +const PROFILE5: Profile = Profiles[4] +const PROFILE6: Profile = Profiles[5] +const PROFILE7: Profile = Profiles[6] +const PROFILE8: Profile = Profiles[7] +const PROFILE9: Profile = Profiles[8] +const PROFILE10: Profile = Profiles[9] + +export { + PROFILE1, + PROFILE2, + PROFILE3, + PROFILE4, + PROFILE5, + PROFILE6, + PROFILE7, + PROFILE8, + PROFILE9, + PROFILE10 +}; diff --git a/seed_and_test_data/03_following_profiles_relationships.json b/seed_and_test_data/03_following_profiles_relationships.json new file mode 100644 index 00000000..1fa51da0 --- /dev/null +++ b/seed_and_test_data/03_following_profiles_relationships.json @@ -0,0 +1,362 @@ +[ + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + } +] diff --git a/seed_and_test_data/03_test_following_relationships.ts b/seed_and_test_data/03_test_following_relationships.ts new file mode 100644 index 00000000..f3344525 --- /dev/null +++ b/seed_and_test_data/03_test_following_relationships.ts @@ -0,0 +1,32 @@ +import * as jsonData from './03_following_profiles_relationships.json'; + +export type FollowingRelationship = { + follower: string; + following: string; +} + +const FollowingRelationships: FollowingRelationship[] = jsonData; + +const FOLLOWER1: FollowingRelationship = FollowingRelationships[0] +const FOLLOWER2: FollowingRelationship = FollowingRelationships[1] +const FOLLOWER3: FollowingRelationship = FollowingRelationships[2] +const FOLLOWER4: FollowingRelationship = FollowingRelationships[3] +const FOLLOWER5: FollowingRelationship = FollowingRelationships[4] +const FOLLOWER6: FollowingRelationship = FollowingRelationships[5] +const FOLLOWER7: FollowingRelationship = FollowingRelationships[6] +const FOLLOWER8: FollowingRelationship = FollowingRelationships[7] +const FOLLOWER9: FollowingRelationship = FollowingRelationships[8] +const FOLLOWER10: FollowingRelationship = FollowingRelationships[9] + +export { + FOLLOWER1, + FOLLOWER2, + FOLLOWER3, + FOLLOWER4, + FOLLOWER5, + FOLLOWER6, + FOLLOWER7, + FOLLOWER8, + FOLLOWER9, + FOLLOWER10 +}; diff --git a/cypress/fixtures/notifications_from_user_seed.json b/seed_and_test_data/04_profile_counters.json similarity index 100% rename from cypress/fixtures/notifications_from_user_seed.json rename to seed_and_test_data/04_profile_counters.json diff --git a/seed_and_test_data/04_test_profile_counters.ts b/seed_and_test_data/04_test_profile_counters.ts new file mode 100644 index 00000000..ef5484e4 --- /dev/null +++ b/seed_and_test_data/04_test_profile_counters.ts @@ -0,0 +1,824 @@ +import * as profiles_jsonData from './02_profiles.json'; +import * as following_jsonData from './03_following_profiles_relationships.json'; + +import {FollowingRelationship} from "./03_test_following_relationships"; +import {Profile} from "./02_test_profiles"; + + +export type ProfileCounter = { + id: string; + follower_counter: number; + following_counter: number; + unread_notifications_counter: number +} + +const FollowingRelationship: FollowingRelationship[] = following_jsonData; +const Profiles: Profile[] = profiles_jsonData; + +function findFollowerOfId(id: string): number { + const relationShips: FollowingRelationship[] = [ + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + } + ] + + return relationShips.filter(item => item.following === id).length; +} + +function findFollowingOfId(id: string): number { + const relationShips: FollowingRelationship[] = [ + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + } + ] + + return relationShips.filter(item => item.follower === id).length; +} + +const PROFILE_COUNTER1: ProfileCounter = { + id: profiles_jsonData[0].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[0].id), + following_counter: findFollowingOfId(profiles_jsonData[0].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER2: ProfileCounter = { + id: profiles_jsonData[1].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[1].id), + following_counter: findFollowingOfId(profiles_jsonData[1].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER3: ProfileCounter = { + id: profiles_jsonData[2].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[2].id), + following_counter: findFollowingOfId(profiles_jsonData[2].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER4: ProfileCounter = { + id: profiles_jsonData[3].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[3].id), + following_counter: findFollowingOfId(profiles_jsonData[3].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER5: ProfileCounter = { + id: profiles_jsonData[4].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[4].id), + following_counter: findFollowingOfId(profiles_jsonData[4].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER6: ProfileCounter = { + id: profiles_jsonData[5].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[5].id), + following_counter: findFollowingOfId(profiles_jsonData[5].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER7: ProfileCounter = { + id: profiles_jsonData[6].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[6].id), + following_counter: findFollowingOfId(profiles_jsonData[6].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER8: ProfileCounter = { + id: profiles_jsonData[7].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[7].id), + following_counter: findFollowingOfId(profiles_jsonData[7].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER9: ProfileCounter = { + id: profiles_jsonData[8].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[8].id), + following_counter: findFollowingOfId(profiles_jsonData[8].id), + unread_notifications_counter: 0 +} +const PROFILE_COUNTER10: ProfileCounter = { + id: profiles_jsonData[9].id as string, + follower_counter: findFollowerOfId(profiles_jsonData[9].id), + following_counter: findFollowingOfId(profiles_jsonData[9].id), + unread_notifications_counter: 0 +} + +export { + PROFILE_COUNTER1, + PROFILE_COUNTER2, + PROFILE_COUNTER3, + PROFILE_COUNTER4, + PROFILE_COUNTER5, + PROFILE_COUNTER6, + PROFILE_COUNTER7, + PROFILE_COUNTER8, + PROFILE_COUNTER9, + PROFILE_COUNTER10 +}; diff --git a/seed_and_test_data/05_assisants.json b/seed_and_test_data/05_assisants.json new file mode 100644 index 00000000..957753dd --- /dev/null +++ b/seed_and_test_data/05_assisants.json @@ -0,0 +1,62 @@ +[ + { + "id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "b24f9e68-8fac-4525-b001-fffb91704d68", + "first_sign_in": "FALSE", + "skip_tutorial": "FALSE", + "last_tutorial": "profile" + }, + { + "id": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "first_sign_in": "FALSE", + "skip_tutorial": "FALSE", + "last_tutorial": "search" + }, + { + "id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "first_sign_in": "FALSE", + "skip_tutorial": "TRUE", + "last_tutorial": "search" + }, + { + "id": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "437bf909-34c5-4e54-b1eb-799771159cd1", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "eada6e0c-e432-4af8-b238-71394e0866bc", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + } +] diff --git a/seed_and_test_data/05_test_assistants.ts b/seed_and_test_data/05_test_assistants.ts new file mode 100644 index 00000000..402fb28f --- /dev/null +++ b/seed_and_test_data/05_test_assistants.ts @@ -0,0 +1,34 @@ +import * as jsonData from './05_assisants.json'; + +export type Assistant = { + id: string, + first_sign_in: boolean | string + skip_tutorial: boolean | string, + last_tutorial: string +} + +const Assistants: Assistant[] = jsonData; + +const ASSISTANT1: Assistant = Assistants[0] +const ASSISTANT2: Assistant = Assistants[1] +const ASSISTANT3: Assistant = Assistants[2] +const ASSISTANT4: Assistant = Assistants[3] +const ASSISTANT5: Assistant = Assistants[4] +const ASSISTANT6: Assistant = Assistants[5] +const ASSISTANT7: Assistant = Assistants[6] +const ASSISTANT8: Assistant = Assistants[7] +const ASSISTANT9: Assistant = Assistants[8] +const ASSISTANT10: Assistant = Assistants[9] + +export { + ASSISTANT1, + ASSISTANT2, + ASSISTANT3, + ASSISTANT4, + ASSISTANT5, + ASSISTANT6, + ASSISTANT7, + ASSISTANT8, + ASSISTANT9, + ASSISTANT10 +}; diff --git a/seed_and_test_data/06_notifications.json b/seed_and_test_data/06_notifications.json new file mode 100644 index 00000000..41051538 --- /dev/null +++ b/seed_and_test_data/06_notifications.json @@ -0,0 +1,542 @@ +[ + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + } +] diff --git a/seed_and_test_data/06_test_notifications.ts b/seed_and_test_data/06_test_notifications.ts new file mode 100644 index 00000000..d07e11f6 --- /dev/null +++ b/seed_and_test_data/06_test_notifications.ts @@ -0,0 +1,34 @@ +import * as jsonData from './06_notifications.json'; + +export type Notification = { + sender: string, + receiver: string, + type_of_notification: string, + read_by_receiver: string | boolean +} + +const Notifications: Notification[] = jsonData; + +const NOTIFICATION1: Notification = Notifications[0] +const NOTIFICATION2: Notification = Notifications[1] +const NOTIFICATION3: Notification = Notifications[2] +const NOTIFICATION4: Notification = Notifications[3] +const NOTIFICATION5: Notification = Notifications[4] +const NOTIFICATION6: Notification = Notifications[5] +const NOTIFICATION7: Notification = Notifications[6] +const NOTIFICATION8: Notification = Notifications[7] +const NOTIFICATION9: Notification = Notifications[8] +const NOTIFICATION10: Notification = Notifications[9] + +export { + NOTIFICATION1, + NOTIFICATION2, + NOTIFICATION3, + NOTIFICATION4, + NOTIFICATION5, + NOTIFICATION6, + NOTIFICATION7, + NOTIFICATION8, + NOTIFICATION9, + NOTIFICATION10 +}; diff --git a/seed_and_test_data/user_created_by_cypress.ts b/seed_and_test_data/user_created_by_cypress.ts new file mode 100644 index 00000000..9cc32caf --- /dev/null +++ b/seed_and_test_data/user_created_by_cypress.ts @@ -0,0 +1,12 @@ +import {AuthData} from "./01_test_auth"; + +// A user created by a cypress auth test +export const userCreatedByCypress: AuthData = { + instance_id: '', + aud: 'authenticated', + role: 'authenticated', + id: '', + email: 'user1@seed.com', + password: "12345678", + encrypted_password: 'asd' +} diff --git a/src/app/auth/sign-in/sign-in.component.ts b/src/app/auth/sign-in/sign-in.component.ts index 111a6151..a54406c2 100644 --- a/src/app/auth/sign-in/sign-in.component.ts +++ b/src/app/auth/sign-in/sign-in.component.ts @@ -59,7 +59,7 @@ export class SignInComponent { password: FormControl }> = new FormGroup({ email: new FormControl( - 'follow@seed.com', + 'user1@gmail.com', [Validators.required, Validators.email]), password: new FormControl( '12345678', diff --git a/src/app/auth/supabase-client.ts b/src/app/auth/supabase-client.ts index 249fcb2e..f40a206b 100644 --- a/src/app/auth/supabase-client.ts +++ b/src/app/auth/supabase-client.ts @@ -2,7 +2,7 @@ import {createClient, PostgrestError} from '@supabase/supabase-js'; import {DatabaseOverwritten} from "../../../supabase/types/supabase.modified"; import {environment} from "../../environments/environment"; -export const supabaseClient = createClient(environment.supabaseUrl, environment.supabaseKey); +export const supabaseClient = createClient(environment.supabaseProjectUrl, environment.supabaseAnonKey); export type DbResult = T extends PromiseLike ? U : never export type DbResultOk = T extends PromiseLike<{ data: infer U }> ? Exclude : never diff --git a/src/app/features/home/home/home.component.ts b/src/app/features/home/home/home.component.ts index 16d4dbd4..0c76289c 100644 --- a/src/app/features/home/home/home.component.ts +++ b/src/app/features/home/home/home.component.ts @@ -1,9 +1,9 @@ import {Component, signal, WritableSignal} from '@angular/core'; import {SessionStoreService} from "../../../auth/services/session.store.service"; -import {Profile} from "../../../../../cypress/fixtures/profile"; import {LinkCardComponent} from "../../../ui/link-card/link-card.component"; import {ProfileActionService} from "../../profile/action-store-services/profile.action.service"; import {ProfileStoreService} from "../../profile/action-store-services/profile.store.service"; +import {FunctionSingleReturn} from "../../../../../supabase/types/supabase.shorthand-types"; @Component({ selector: 'polity-home', @@ -17,7 +17,7 @@ import {ProfileStoreService} from "../../profile/action-store-services/profile.s }) export class HomeComponent { protected sessionId: string | null; - protected profile: WritableSignal = signal(null) + protected profile: WritableSignal | null> = signal(null) protected isProfileLoading: WritableSignal = signal(true) constructor( diff --git a/src/app/features/profile-follow/profile-follow-edit/profile-follow-edit.component.html b/src/app/features/profile-follow/profile-follow-edit/profile-follow-edit.component.html index 3444b8f3..49b90ffa 100644 --- a/src/app/features/profile-follow/profile-follow-edit/profile-follow-edit.component.html +++ b/src/app/features/profile-follow/profile-follow-edit/profile-follow-edit.component.html @@ -37,6 +37,8 @@ [bonusKeys]="['last_name']" [dataCyTags]="['follower_profile_image', 'follower_first_name', 'follower_remove']" + [dataCyTagsHeadline]="['follower_profile_image_headline', 'follower_first_name_headline', + 'follower_remove_headline']" [dataKeysForColumns]="['profile_image', 'first_name', 'id']" [data]="followersOfUser" [headings]="['Foto', 'test', 'Entfernen']" @@ -50,9 +52,11 @@ (remove)="removeFollowing($event)" [bonusKeys]="['last_name']" [dataCyTags]="['following_profile_image', 'following_first_name', 'following_remove']" + [dataCyTagsHeadline]="['following_profile_image_headline', 'following_first_name_headline', + 'following_remove_headline']" [dataKeysForColumns]="['profile_image', 'first_name', 'id']" [data]="followingsOfUser" - [headings]="['Foto', 'test', 'Entfernen']" + [headings]="['Foto', 'Name', 'Entfernen']" [isLoading]="isFollowingLoading" > diff --git a/src/app/features/profile/profile-edit/profile-edit.component.ts b/src/app/features/profile/profile-edit/profile-edit.component.ts index 5d3a078d..cba14ee0 100644 --- a/src/app/features/profile/profile-edit/profile-edit.component.ts +++ b/src/app/features/profile/profile-edit/profile-edit.component.ts @@ -1,7 +1,6 @@ import {Component, effect, signal, WritableSignal} from '@angular/core'; import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms"; import {TUI_VALIDATION_ERRORS, TuiFieldErrorPipeModule, TuiInputModule} from "@taiga-ui/kit"; -import {Profile} from "../../../../../cypress/fixtures/profile"; import {TuiButtonModule, TuiErrorModule, TuiSvgModule, TuiTextfieldControllerModule} from "@taiga-ui/core"; import {AssistantToggleComponent} from "../../assistant/assistant-toggle/assistant-toggle.component"; import {SignOutComponent} from "../../../auth/sign-out/sign-out.component"; @@ -43,7 +42,7 @@ import { ] }) export class ProfileEditComponent { - protected profile: WritableSignal = signal(null); + protected profile: WritableSignal | null> = signal(null); protected editProfileForm: FormGroup<{ firstName: FormControl, lastName: FormControl diff --git a/src/app/features/profile/profile-image-upload/profile-image-upload.component.ts b/src/app/features/profile/profile-image-upload/profile-image-upload.component.ts index 4bc6fdd3..a91f2485 100644 --- a/src/app/features/profile/profile-image-upload/profile-image-upload.component.ts +++ b/src/app/features/profile/profile-image-upload/profile-image-upload.component.ts @@ -2,7 +2,6 @@ import {Component, signal, WritableSignal} from '@angular/core'; import {TuiFileLike, TuiInputFilesModule} from "@taiga-ui/kit"; import {from, Observable, of, Subject, switchMap} from "rxjs"; import {FormControl, ReactiveFormsModule} from "@angular/forms"; -import {Profile} from "../../../../../cypress/fixtures/profile"; import {CommonModule} from "@angular/common"; import {ProfileActionService} from "../action-store-services/profile.action.service"; import {ProfileStoreService} from "../action-store-services/profile.store.service"; @@ -27,7 +26,7 @@ export class ProfileImageUploadComponent { protected loadedFiles$: Observable = this.imageControl.valueChanges.pipe( switchMap(file => (file ? this.returnRequestAsObservable(file) : of(null))), ); - protected profileWriteable: WritableSignal; + protected profileWriteable: WritableSignal | null | undefined>; private avatarUrl: string = ''; constructor( diff --git a/src/app/features/profile/profile-wiki/profile-wiki.component.html b/src/app/features/profile/profile-wiki/profile-wiki.component.html index c36a458a..59c48a49 100644 --- a/src/app/features/profile/profile-wiki/profile-wiki.component.html +++ b/src/app/features/profile/profile-wiki/profile-wiki.component.html @@ -1,4 +1,4 @@ -
+
= signal(true); protected isProfileCounterLoading: WritableSignal = signal(true); protected isFollowingCheckLoading: WritableSignal = signal(true); - protected profile: Signal; + protected profile: Signal | null>; protected profileCounter: WritableSignal | null> = signal(null); protected isOwner: WritableSignal; protected isFollowing: WritableSignal; diff --git a/src/app/ui/link-card/link-card.component.ts b/src/app/ui/link-card/link-card.component.ts index 8ca528a1..914c3cb3 100644 --- a/src/app/ui/link-card/link-card.component.ts +++ b/src/app/ui/link-card/link-card.component.ts @@ -1,7 +1,7 @@ import {Component, Input, signal, WritableSignal} from '@angular/core'; import {Router} from "@angular/router"; -import {Profile} from "../../../../cypress/fixtures/profile"; import {TuiIslandModule} from "@taiga-ui/kit"; +import {FunctionSingleReturn} from "../../../../supabase/types/supabase.shorthand-types"; @Component({ selector: 'polity-link-card', @@ -21,7 +21,7 @@ export class LinkCardComponent { @Input({required: true}) public sessionId: string | null = null; @Input({required: true}) public isLoading: WritableSignal = signal(true); @Input({required: true}) public profile: WritableSignal< - Profile | null | undefined + FunctionSingleReturn<'select_user'> | null | undefined > = signal( null ) diff --git a/src/environments/environment.ts b/src/environments/environment.ts index dd88cf62..04a2fed2 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,9 +1,9 @@ export const environment = { production: false, - supabaseUrl: 'https://abcwkgkiztruxwvfwabf.supabase.co', - supabaseKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFiY3drZ2tpenRydXh3dmZ3YWJmIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDEwMzE4NjYsImV4cCI6MjAxNjYwNzg2Nn0.Twkclab5NZXJFsb6qo5sYnXuf_lhBRu5xWul-fOc4Tg', - vapidPublicKey: 'BL8N69j1Xo5NCPPFqkuf7VQqPTkSLi5D34bV7HTe079sffnQi_6B44o9oCCud9Y4TTye64ZV2XgPyoE91ta7OHs', - vapidPrivateKey: 'lMrwS0krqYeZlueGwBf4aHiH1AHvhg1POp7Ikfai4uk', - senderId: '362498466681', - FirebaseApiKey: 'AIzaSyADlx9pLim_Z_X9JwLYOxn6a4UxB2FLkMM' + supabaseProjectUrl: 'https://rjljgqxktntquuftngcf.supabase.co', + supabaseAnonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJqbGpncXhrdG50cXV1ZnRuZ2NmIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDQxMjAxNTksImV4cCI6MjAxOTY5NjE1OX0.dP-CKlbAPQsTVFDmPfEMvAc4ZtyJmyfOZUi-BGPdCl8', + vapidPublicKey: '', + vapidPrivateKey: '', + senderId: '', + FirebaseApiKey: '' } diff --git a/supabase/.gitignore b/supabase/.gitignore index dd4d7cc7..73d673bc 100644 --- a/supabase/.gitignore +++ b/supabase/.gitignore @@ -10,3 +10,8 @@ .branches .temp .env + +# Supabase +.branches +.temp +.env diff --git a/supabase/functions/import_map.json b/supabase/functions/import_map.json index e69de29b..af3ba113 100644 --- a/supabase/functions/import_map.json +++ b/supabase/functions/import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "lodash": "https://cdn.skypack.dev/lodash" + } +} diff --git a/supabase/migrations/01_migration_preparation_and_schemas/00000000_reset_migrations.sql b/supabase/migrations/01_migration_preparation_and_schemas/00000000_reset_migrations.sql index 445550d0..c158bc0a 100644 --- a/supabase/migrations/01_migration_preparation_and_schemas/00000000_reset_migrations.sql +++ b/supabase/migrations/01_migration_preparation_and_schemas/00000000_reset_migrations.sql @@ -2,6 +2,6 @@ DELETE FROM supabase_migrations.schema_migrations; -DELETE -FROM - auth.schema_migrations; +-- DELETE +-- FROM +-- auth.schema_migrations; diff --git a/supabase/migrations/05_assistant/00000501_tutorial_enum.sql b/supabase/migrations/05_assistant/00000501_tutorial_enum.sql index 38faa1d3..95b5cc98 100644 --- a/supabase/migrations/05_assistant/00000501_tutorial_enum.sql +++ b/supabase/migrations/05_assistant/00000501_tutorial_enum.sql @@ -1 +1,2 @@ +DROP TYPE IF EXISTS tutorial_enum CASCADE; CREATE TYPE tutorial_enum AS enum ('welcome', 'profile', 'search'); diff --git a/supabase/migrations/06_notifications/02000614_send_push_notification_trigger.sql b/supabase/migrations/06_notifications/02000614_send_push_notification_trigger.sql index 448cdd2c..7bff12b4 100644 --- a/supabase/migrations/06_notifications/02000614_send_push_notification_trigger.sql +++ b/supabase/migrations/06_notifications/02000614_send_push_notification_trigger.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE TRIGGER "send-push-hook" ON authenticated_access.notifications_by_user FOR EACH ROW EXECUTE FUNCTION supabase_functions.http_request( - 'https://abcwkgkiztruxwvfwabf.supabase.co/functions/v1/send-push-notification', + 'https://rjljgqxktntquuftngcf.supabase.co/functions/v1/send-push-notification', 'POST', '{ "Content-Type":"application/json", diff --git a/supabase/migrations/99_seed/09009901_auth_seed.sql b/supabase/migrations/99_seed/09009901_auth_seed.sql index e5ed137d..a1963206 100644 --- a/supabase/migrations/99_seed/09009901_auth_seed.sql +++ b/supabase/migrations/99_seed/09009901_auth_seed.sql @@ -1,227 +1,293 @@ -INSERT INTO +-- Supabase AI is experimental and may produce incorrect answers +-- Always verify the output before executing + +WITH + auth_json (doc) AS ( + VALUES + ('[ + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "aud": "authenticated", + "role": "authenticated", + "email": "user1@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "invited_at": "2022-06-24T17:22:59.653Z", + "confirmation_token": "", + "confirmation_sent_at": "2022-06-24T17:22:59.653Z", + "recovery_token": "", + "recovery_sent_at": "2022-06-24T17:22:59.653Z", + "email_change_token_new": "", + "email_change": "", + "email_change_sent_at": "2022-06-24T17:22:59.653Z", + "last_sign_in_at": "2022-06-24T17:22:59.657Z", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {}, + "is_super_admin": "FALSE", + "created_at": "2022-06-24T17:22:59.649Z", + "updated_at": "2022-06-24T17:22:59.649Z", + "phone": "hgvhgvgvhg6767", + "phone_confirmed_at": "2022-06-24T17:22:59.649Z", + "phone_change": "", + "phone_change_token": "", + "phone_change_sent_at": "2022-06-24T17:22:59.653Z", + "confirmed_at": "2022-06-24T17:22:59.653Z", + "email_change_token_current": "", + "email_change_confirm_status": "1", + "banned_until": "2022-06-24T17:22:59.653Z", + "reauthentication_token": "", + "reauthentication_sent_at": "2022-06-24T17:22:59.653Z", + "is_sso_user": "FALSE", + "deleted_at": "2022-06-24T17:22:59.649Z" + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "b24f9e68-8fac-4525-b001-fffb91704d68", + "aud": "authenticated", + "role": "authenticated", + "email": "user2@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "aud": "authenticated", + "role": "authenticated", + "email": "user3@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "aud": "authenticated", + "role": "authenticated", + "email": "user4@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "aud": "authenticated", + "role": "authenticated", + "email": "user5@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "aud": "authenticated", + "role": "authenticated", + "email": "user6@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "aud": "authenticated", + "role": "authenticated", + "email": "user7@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "437bf909-34c5-4e54-b1eb-799771159cd1", + "aud": "authenticated", + "role": "authenticated", + "email": "user8@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "eada6e0c-e432-4af8-b238-71394e0866bc", + "aud": "authenticated", + "role": "authenticated", + "email": "user9@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + }, + { + "instance_id": "00000000-0000-0000-0000-000000000000", + "id": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "aud": "authenticated", + "role": "authenticated", + "email": "user10@gmail.com", + "password": "12345678", + "encrypted_password": "$2a$10$X2B4kwBYyMzt54HgToaMvekAz1lCy8CvMV7FMoU3IjPXnsl8PjBMy", + "email_confirmed_at": "2024-01-01 16:15:00.697049+00", + "raw_app_meta_data": { + "provider": "email", + "providers": [ + "email" + ] + }, + "raw_user_meta_data": {} + } + ] + '::json) + ) +INSERT +INTO auth.users (instance_id, --1 id, --2 aud, --3 role, --4 email, --5 - encrypted_password, --6 - email_confirmed_at, --7 - invited_at, --8 - confirmation_token, --9 - confirmation_sent_at, --10 - recovery_token, --11 - recovery_sent_at, --12 - email_change_token_new, --13 - email_change, --14 - email_change_sent_at, --15 - last_sign_in_at, --16 + --encrypted_password, --6 + --email_confirmed_at, --7 + --invited_at, --8 + --confirmation_token, --9 + --confirmation_sent_at, --10 + --recovery_token, --11 + --recovery_sent_at, --12 + --email_change_token_new, --13 + --email_change, --14 + --email_change_sent_at, --15 + --last_sign_in_at, --16 raw_app_meta_data, --17 - raw_user_meta_data, --18 - is_super_admin, --19 - created_at, --20 - updated_at, --21 - phone, --22 - phone_confirmed_at, --23 - phone_change, --24 - phone_change_token, --25 - phone_change_sent_at, --26 - confirmed_at, --27 - email_change_token_current, --28 - email_change_confirm_status, --29 - banned_until, --30 - reauthentication_token, --31 - reauthentication_sent_at --32 + raw_user_meta_data --18 + --is_super_admin, --19 + --created_at, --20 + --updated_at, --21 + --phone, --22 + --phone_confirmed_at, --23 + --phone_change, --24 + --phone_change_token, --25 + --phone_change_sent_at, --26 + --confirmed_at --missing? --27 + --email_change_token_current, --28 + --email_change_confirm_status, --29 + --banned_until, --30 + --reauthentication_token, --31 + --reauthentication_sent_at, --32 + --is_sso_user --new? --33 + --deleted_at --new? --34 ) -VALUES - ('00000000-0000-0000-0000-000000000000'::uuid, --1 - 'f8b028b8-231b-4c80-abf2-7ca787fe686f'::uuid, --2 - 'authenticated', --3 - 'authenticated', --4 - 'user1@seed.com', --5 - '$2a$10$V31IziLiRRQFCO/ISWvGaOIonwHq0ePKojtkZOyVkmAeFBYAVSsba', --6 - '2022-06-24T17:22:59.653Z', --7 - '2022-06-24T17:22:59.653Z', --invited_at, --8 - '', --confirmation_token, --9 - '2022-06-24T17:22:59.653Z', --confirmation_sent_at, --10 - '', --recovery_token, --11 - '2022-06-24T17:22:59.653Z', --recovery_sent_at, --12 - '', --email_change_token_new, --13 - '', --email_change, --14 - '2022-06-24T17:22:59.653Z', --email_change_sent_at, --15 - '2022-06-24T17:22:59.657Z', --16 - '{ - "provider": "email", - "providers": [ - "email" - ] - }', --17 - '{}', --18 - FALSE, --19 - '2022-06-24T17:22:59.649Z', --20 - '2022-06-24T17:22:59.649Z', --21 - NULL, --22 - NULL, --23 - '', --phone_change, --24 - '', --phone_change_token, --25 - '2022-06-24T17:22:59.653Z', --phone_change_sent_at, --26 - DEFAULT,--'2011-01-01 00:00:00+03'::TIMESTAMP WITH TIME ZONE, --'2022-11-22 15:13:57.853992+00', --confirmed_at, --27 - '', --email_change_token_current, --28 - 1, --email_change_confirm_status, --29 - '2022-06-24T17:22:59.653Z', --banned_until, --30 - '', --reauthentication_token, --31 - '2022-06-24T17:22:59.653Z' --reauthentication_sent_at --32 - ), - ('00000000-0000-0000-0000-000000000000'::uuid, --1 - '42e58ca1-2eb8-4651-93c2-cefba2e32f42'::uuid, --2 - 'authenticated', --3 - 'authenticated', --4 - 'user2@seed.com', --5 - '$2a$10$V31IziLiRRQFCO/ISWvGaOIonwHq0ePKojtkZOyVkmAeFBYAVSsba', --6 - '2022-06-24T17:23:18.660Z', --7 - '2022-06-24T17:22:59.653Z', --invited_at, --8 - '', --confirmation_token, --9 - '2022-06-24T17:22:59.653Z', --confirmation_sent_at, --10 - '', --recovery_token, --11 - '2022-06-24T17:22:59.653Z', --recovery_sent_at, --12 - '', --email_change_token_new, --13 - '', --email_change, --14 - '2022-06-24T17:22:59.653Z', --email_change_sent_at, --15 - '2022-06-24T17:23:18.666Z', --16 - '{ - "provider": "email", - "providers": [ - "email" - ] - }', --17 - '{}', --18 - FALSE, --19 - '2022-06-24T17:23:18.656Z', --20 - '2022-06-24T17:23:18.656Z', --21 - NULL, --22 - NULL, --23 - '', --phone_change, --24 - '', --phone_change_token, --25 - '2022-06-24T17:22:59.653Z', --phone_change_sent_at, --26 - DEFAULT, --'2011-01-01 00:00:00+03'::TIMESTAMP WITH TIME ZONE, --'2022-11-22 15:13:57.853992+00', --confirmed_at, --27 - '', --email_change_token_current, --28 - 1, --email_change_confirm_status, -- 29 - '2022-06-24T17:22:59.653Z', --banned_until, --30 - '', --reauthentication_token, --31 - '2022-06-24T17:22:59.653Z' --reauthentication_sent_at --32 - ), - ('00000000-0000-0000-0000-000000000000'::uuid, --1 - '5615fd53-5b0f-49ce-b242-73677ad547ec'::uuid, --2 - 'authenticated', --3 - 'authenticated', --4 - 'edit1@seed.com', --5 - '$2a$10$V31IziLiRRQFCO/ISWvGaOIonwHq0ePKojtkZOyVkmAeFBYAVSsba', --6 - '2022-06-24T17:23:18.660Z', --7 - '2022-06-24T17:22:59.653Z', --invited_at, --8 - '', --confirmation_token, --9 - '2022-06-24T17:22:59.653Z', --confirmation_sent_at, --10 - '', --recovery_token, --11 - '2022-06-24T17:22:59.653Z', --recovery_sent_at, --12 - '', --email_change_token_new, --13 - '', --email_change, --14 - '2022-06-24T17:22:59.653Z', --email_change_sent_at, --15 - '2022-06-24T17:23:18.666Z', --16 - '{ - "provider": "email", - "providers": [ - "email" - ] - }', --17 - '{}', --18 - FALSE, --19 - '2022-06-24T17:23:18.656Z', --20 - '2022-06-24T17:23:18.656Z', --21 - NULL, --22 - NULL, --23 - '', --phone_change, --24 - '', --phone_change_token, --25 - '2022-06-24T17:22:59.653Z', --phone_change_sent_at, --26 - DEFAULT, --'2011-01-01 00:00:00+03'::TIMESTAMP WITH TIME ZONE, --'2022-11-22 15:13:57.853992+00', --confirmed_at, --27 - '', --email_change_token_current, --28 - 1, --email_change_confirm_status, -- 29 - '2022-06-24T17:22:59.653Z', --banned_until, --30 - '', --reauthentication_token, --31 - '2022-06-24T17:22:59.653Z' --reauthentication_sent_at --32 - ), - ('00000000-0000-0000-0000-000000000000'::uuid, --1 - 'd5d41bd8-ca96-4583-a0f8-61a34c6dddaa'::uuid, --2 - 'authenticated', --3 - 'authenticated', --4 - 'follow@seed.com', --5 - '$2a$10$V31IziLiRRQFCO/ISWvGaOIonwHq0ePKojtkZOyVkmAeFBYAVSsba', --6 - '2022-06-24T17:23:18.660Z', --7 - '2022-06-24T17:22:59.653Z', --invited_at, --8 - '', --confirmation_token, --9 - '2022-06-24T17:22:59.653Z', --confirmation_sent_at, --10 - '', --recovery_token, --11 - '2022-06-24T17:22:59.653Z', --recovery_sent_at, --12 - '', --email_change_token_new, --13 - '', --email_change, --14 - '2022-06-24T17:22:59.653Z', --email_change_sent_at, --15 - '2022-06-24T17:23:18.666Z', --16 - '{ - "provider": "email", - "providers": [ - "email" - ] - }', --17 - '{}', --18 - FALSE, --19 - '2022-06-24T17:23:18.656Z', --20 - '2022-06-24T17:23:18.656Z', --21 - NULL, --22 - NULL, --23 - '', --phone_change, --24 - '', --phone_change_token, --25 - '2022-06-24T17:22:59.653Z', --phone_change_sent_at, --26 - DEFAULT, --'2011-01-01 00:00:00+03'::TIMESTAMP WITH TIME ZONE, --'2022-11-22 15:13:57.853992+00', --confirmed_at, --27 - '', --email_change_token_current, --28 - 1, --email_change_confirm_status, -- 29 - '2022-06-24T17:22:59.653Z', --banned_until, --30 - '', --reauthentication_token, --31 - '2022-06-24T17:22:59.653Z' --reauthentication_sent_at --32 - ), - ('00000000-0000-0000-0000-000000000000'::uuid, --1 - 'b6febbc9-aaf9-42a5-b6df-082fafe5937f'::uuid, --2 - 'authenticated', --3 - 'authenticated', --4 - 'unfollow@seed.com', --5 - '$2a$10$V31IziLiRRQFCO/ISWvGaOIonwHq0ePKojtkZOyVkmAeFBYAVSsba', --6 - '2022-06-24T17:23:18.660Z', --7 - '2022-06-24T17:22:59.653Z', --invited_at, --8 - '', --confirmation_token, --9 - '2022-06-24T17:22:59.653Z', --confirmation_sent_at, --10 - '', --recovery_token, --11 - '2022-06-24T17:22:59.653Z', --recovery_sent_at, --12 - '', --email_change_token_new, --13 - '', --email_change, --14 - '2022-06-24T17:22:59.653Z', --email_change_sent_at, --15 - '2022-06-24T17:23:18.666Z', --16 - '{ - "provider": "email", - "providers": [ - "email" - ] - }', --17 - '{}', --18 - FALSE, --19 - '2022-06-24T17:23:18.656Z', --20 - '2022-06-24T17:23:18.656Z', --21 - NULL, --22 - NULL, --23 - '', --phone_change, --24 - '', --phone_change_token, --25 - '2022-06-24T17:22:59.653Z', --phone_change_sent_at, --26 - DEFAULT, --'2011-01-01 00:00:00+03'::TIMESTAMP WITH TIME ZONE, --'2022-11-22 15:13:57.853992+00', --confirmed_at, --27 - '', --email_change_token_current, --28 - 1, --email_change_confirm_status, -- 29 - '2022-06-24T17:22:59.653Z', --banned_until, --30 - '', --reauthentication_token, --31 - '2022-06-24T17:22:59.653Z' --reauthentication_sent_at --32 - ) +SELECT + instance_id, --1 + id, --2 + aud, --3 + role, --4 + email, --5 + --encrypted_password, --6 + --email_confirmed_at, --7 +--invited_at, --8 +--confirmation_token, --9 +--confirmation_sent_at, --10 +--recovery_token, --11 +--recovery_sent_at, --12 +--email_change_token_new, --13 +--email_change, --14 +--email_change_sent_at, --15 +--last_sign_in_at, --16 + raw_app_meta_data, --17 + raw_user_meta_data --18 +--is_super_admin, --19 +--created_at, --20 +--updated_at, --21 +--phone, --22 +--phone_confirmed_at, --23 +--phone_change, --24 +--phone_change_token, --25 +--phone_change_sent_at, --26 +--confirmed_at, --27 +--email_change_token_current, --28 +--email_change_confirm_status, --29 +--banned_until, --30 +--reauthentication_token, --31 +--reauthentication_sent_at, --32 +--is_sso_user --33 +--deleted_at --34 +FROM + auth_json a + CROSS JOIN LATERAL JSON_POPULATE_RECORDSET(NULL::auth.users, doc) AS u; + -ON CONFLICT (id) DO NOTHING; +UPDATE auth.users +SET + encrypted_password = '$2a$10$WB.1YZRHv1JWNwV4l1Es8e5hVzDe2m/E9sO.1WOp836dTcPkayKZ2', + last_sign_in_at = '2024-01-01 16:38:49.847114+00', + created_at = '2024-01-01 16:38:49.847114+00', + updated_at = '2024-01-01 16:38:49.847114+00', + email_confirmed_at = '2024-01-01 16:38:49.847114+00', + email_change = '', + email_change_token_new = '', + confirmation_token = '', + recovery_token = ''; diff --git a/supabase/migrations/99_seed/09009902_identites_seed.sql b/supabase/migrations/99_seed/09009902_identites_seed.sql new file mode 100644 index 00000000..644c9039 --- /dev/null +++ b/supabase/migrations/99_seed/09009902_identites_seed.sql @@ -0,0 +1,63 @@ +-- Supabase AI is experimental and may produce incorrect answers +-- Always verify the output before executing + +WITH + auth_identities_json (doc) AS ( + VALUES + ('[ + { + "provider_id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "user_id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "identity_data": { + "sub": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "email": "user1@gmail.com", + "email_verified": false, + "phone_verified": false + }, + "provider": "email", + "last_sign_in_at": "2024-01-01 16:02:39.256589+00", + "created_at": "2024-01-01 16:02:39.256589+00", + "updated_at": "2024-01-01 16:02:39.256589+00" + }, + { + "provider_id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "user_id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "identity_data": { + "sub": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "email": "user4@gmail.com", + "email_verified": false, + "phone_verified": false + }, + "provider": "email", + "last_sign_in_at": "2024-01-01 16:02:39.256589+00", + "created_at": "2024-01-01 16:02:39.256589+00", + "updated_at": "2024-01-01 16:02:39.256589+00" + } + ] + '::json) + ) +INSERT +INTO + auth.identities (provider_id, + user_id, + identity_data, + provider, + last_sign_in_at, + created_at, + updated_at + --email + --id +) +SELECT + provider_id, + user_id, + identity_data, + provider, + last_sign_in_at, + created_at, + updated_at +--email +--id +FROM + auth_identities_json a + CROSS JOIN LATERAL JSON_POPULATE_RECORDSET(NULL::auth.identities, doc) AS u; diff --git a/supabase/migrations/99_seed/09009902_profile_seed.sql b/supabase/migrations/99_seed/09009902_profile_seed.sql deleted file mode 100644 index 27449057..00000000 --- a/supabase/migrations/99_seed/09009902_profile_seed.sql +++ /dev/null @@ -1,75 +0,0 @@ ---Updating seeded profiles -UPDATE authenticated_access.profiles -SET - first_name = 'Fabian', - last_name = 'Bäcker' -WHERE - id = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; - -UPDATE authenticated_access.profiles_counters -SET - follower_counter = 1, - following_counter = 2 -WHERE - id = '42e58ca1-2eb8-4651-93c2-cefba2e32f42'; - - -UPDATE authenticated_access.profiles -SET - first_name = 'Tobias', - last_name = 'Müller' -WHERE - id = 'f8b028b8-231b-4c80-abf2-7ca787fe686f'; - -UPDATE authenticated_access.profiles_counters -SET - follower_counter = 1, - following_counter = 2 -WHERE - id = 'f8b028b8-231b-4c80-abf2-7ca787fe686f'; - - -UPDATE authenticated_access.profiles -SET - first_name = 'Lars', - last_name = 'Berg' -WHERE - id = '5615fd53-5b0f-49ce-b242-73677ad547ec'; - -UPDATE authenticated_access.profiles_counters -SET - follower_counter = 1, - following_counter = 2 -WHERE - id = '5615fd53-5b0f-49ce-b242-73677ad547ec'; - - - -UPDATE authenticated_access.profiles -SET - first_name = 'Jana', - last_name = 'Klein' -WHERE - id = 'd5d41bd8-ca96-4583-a0f8-61a34c6dddaa'; - -UPDATE authenticated_access.profiles_counters -SET - follower_counter = 1, - following_counter = 2 -WHERE - id = 'd5d41bd8-ca96-4583-a0f8-61a34c6dddaa'; - - -UPDATE authenticated_access.profiles -SET - first_name = 'Lennart', - last_name = 'Lieb' -WHERE - id = 'b6febbc9-aaf9-42a5-b6df-082fafe5937f'; - -UPDATE authenticated_access.profiles_counters -SET - follower_counter = 1, - following_counter = 2 -WHERE - id = 'b6febbc9-aaf9-42a5-b6df-082fafe5937f'; diff --git a/supabase/migrations/99_seed/09009903_profile_seed.sql b/supabase/migrations/99_seed/09009903_profile_seed.sql new file mode 100644 index 00000000..056eebf7 --- /dev/null +++ b/supabase/migrations/99_seed/09009903_profile_seed.sql @@ -0,0 +1,71 @@ +WITH + profiles_json (doc) AS ( + VALUES + ('[ + { + "id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "first_name": "Fabian", + "last_name": "Bäcker" + }, + { + "id": "b24f9e68-8fac-4525-b001-fffb91704d68", + "first_name": "Laura", + "last_name": "Müller" + }, + { + "id": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "first_name": "Lars", + "last_name": "Berg" + }, + { + "id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "first_name": "Pia", + "last_name": "Roller" + }, + { + "id": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "first_name": "Tobias", + "last_name": "Kling" + }, + { + "id": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "first_name": "Maya", + "last_name": "Lieb" + }, + { + "id": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "first_name": "Lennart", + "last_name": "Lang" + }, + { + "id": "437bf909-34c5-4e54-b1eb-799771159cd1", + "first_name": "Viki", + "last_name": "Frieden" + }, + { + "id": "eada6e0c-e432-4af8-b238-71394e0866bc", + "first_name": "Jens", + "last_name": "Spielberg" + }, + { + "id": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "first_name": "Anna", + "last_name": "Lieder" + } + ]'::json) + ) +UPDATE authenticated_access.profiles AS p +SET + first_name = json_data.first_name, + last_name = json_data.last_name +FROM + ( + SELECT + (JSON_ARRAY_ELEMENTS(doc) ->> 'id')::uuid AS id, + (JSON_ARRAY_ELEMENTS(doc) ->> 'first_name') AS first_name, + (JSON_ARRAY_ELEMENTS(doc) ->> 'last_name') AS last_name + FROM + profiles_json + ) AS json_data +WHERE + p.id = json_data.id; diff --git a/supabase/migrations/99_seed/09009904_following_profiles.sql b/supabase/migrations/99_seed/09009904_following_profiles.sql new file mode 100644 index 00000000..38feee43 --- /dev/null +++ b/supabase/migrations/99_seed/09009904_following_profiles.sql @@ -0,0 +1,379 @@ +WITH + following_relationships_json (doc) AS ( + VALUES + ('[ + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "b24f9e68-8fac-4525-b001-fffb91704d68", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + }, + { + "follower": "437bf909-34c5-4e54-b1eb-799771159cd1", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "eada6e0c-e432-4af8-b238-71394e0866bc", + "following": "1c8171bb-36bd-41ff-b207-a5d219e53740" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "ff6cc644-ec9e-45dc-a98a-1186e091674f" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "b24f9e68-8fac-4525-b001-fffb91704d68" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "71aa5d19-43d8-4063-839d-114a0ad49ed7" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "94875c0e-fa45-4504-828a-6ec9f21a49ca" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "2d196d44-ae7f-4999-b080-e8a0db639c65" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "393bc641-eaa3-45a2-9a2a-ab16dc62424b" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "437bf909-34c5-4e54-b1eb-799771159cd1" + }, + { + "follower": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "following": "eada6e0c-e432-4af8-b238-71394e0866bc" + } + ] + '::json) + ) +INSERT +INTO + authenticated_access.following_profiles (follower, + following) +SELECT + follower, + following +FROM + following_relationships_json l + CROSS JOIN LATERAL JSON_POPULATE_RECORDSET( + NULL::authenticated_access.following_profiles, + doc) AS f; diff --git a/supabase/migrations/99_seed/09009905_profile_counters_seed.sql b/supabase/migrations/99_seed/09009905_profile_counters_seed.sql new file mode 100644 index 00000000..ca7c58a3 --- /dev/null +++ b/supabase/migrations/99_seed/09009905_profile_counters_seed.sql @@ -0,0 +1,21 @@ +UPDATE authenticated_access.profiles_counters +SET + follower_counter = ( + SELECT + COUNT(*) + FROM + authenticated_access.following_profiles + WHERE + following_profiles.following = profiles_counters.id + ); + +UPDATE authenticated_access.profiles_counters +SET + following_counter = ( + SELECT + COUNT(*) + FROM + authenticated_access.following_profiles + WHERE + following_profiles.follower = profiles_counters.id + ); diff --git a/supabase/migrations/99_seed/09009906_assistants_seed_json.sql b/supabase/migrations/99_seed/09009906_assistants_seed_json.sql new file mode 100644 index 00000000..ca515cc1 --- /dev/null +++ b/supabase/migrations/99_seed/09009906_assistants_seed_json.sql @@ -0,0 +1,85 @@ +WITH + assistants_json (doc) AS ( + VALUES + ('[ + { + "id": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "b24f9e68-8fac-4525-b001-fffb91704d68", + "first_sign_in": "FALSE", + "skip_tutorial": "FALSE", + "last_tutorial": "profile" + }, + { + "id": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "first_sign_in": "FALSE", + "skip_tutorial": "FALSE", + "last_tutorial": "search" + }, + { + "id": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "first_sign_in": "FALSE", + "skip_tutorial": "TRUE", + "last_tutorial": "search" + }, + { + "id": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "437bf909-34c5-4e54-b1eb-799771159cd1", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "eada6e0c-e432-4af8-b238-71394e0866bc", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + }, + { + "id": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "first_sign_in": "TRUE", + "skip_tutorial": "FALSE", + "last_tutorial": "welcome" + } + ] + '::json) + ) +UPDATE authenticated_access.assistants AS a +SET + first_sign_in = json_data.first_sign_in, + skip_tutorial = json_data.skip_tutorial, + last_tutorial = json_data.last_tutorial +FROM + ( + SELECT + (JSON_ARRAY_ELEMENTS(doc) ->> 'id')::uuid AS id, + (JSON_ARRAY_ELEMENTS(doc) ->> 'first_sign_in')::boolean AS first_sign_in, + (JSON_ARRAY_ELEMENTS(doc) ->> 'skip_tutorial')::boolean AS skip_tutorial, + (JSON_ARRAY_ELEMENTS(doc) ->> 'last_tutorial')::tutorial_enum AS last_tutorial + + FROM + assistants_json + ) AS json_data +WHERE + a.id = json_data.id; diff --git a/supabase/migrations/99_seed/09009907_notifications_by_user_seed.sql b/supabase/migrations/99_seed/09009907_notifications_by_user_seed.sql new file mode 100644 index 00000000..f372dd12 --- /dev/null +++ b/supabase/migrations/99_seed/09009907_notifications_by_user_seed.sql @@ -0,0 +1,588 @@ +WITH + notification_json (doc) AS ( + VALUES + ('[ + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "b24f9e68-8fac-4525-b001-fffb91704d68", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "437bf909-34c5-4e54-b1eb-799771159cd1", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "eada6e0c-e432-4af8-b238-71394e0866bc", + "receiver": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "ff6cc644-ec9e-45dc-a98a-1186e091674f", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "b24f9e68-8fac-4525-b001-fffb91704d68", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "71aa5d19-43d8-4063-839d-114a0ad49ed7", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "94875c0e-fa45-4504-828a-6ec9f21a49ca", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "2d196d44-ae7f-4999-b080-e8a0db639c65", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "393bc641-eaa3-45a2-9a2a-ab16dc62424b", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "fefe27da-66ac-4d08-a8b3-c5adfb9bd5ce", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "437bf909-34c5-4e54-b1eb-799771159cd1", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + }, + { + "sender": "1c8171bb-36bd-41ff-b207-a5d219e53740", + "receiver": "eada6e0c-e432-4af8-b238-71394e0866bc", + "type_of_notification": "follow_from_user", + "read_by_receiver": "FALSE" + } + ] + '::json) + ) +INSERT +INTO + authenticated_access.notifications_by_user (sender, + receiver, + type_of_notification, + read_by_receiver) +SELECT + n.sender, + n.receiver, + n.type_of_notification, + n.read_by_receiver +FROM + notification_json l + CROSS JOIN LATERAL JSON_POPULATE_RECORDSET( + NULL::authenticated_access.notifications_by_user, + doc) AS n; + + +-- WITH +-- notification_json (doc) AS ( +-- VALUES +-- (( +-- SELECT PG_READ_FILE('./06_notifications.json') --no file access on remote or local migration +-- )::json) +-- ) +-- INSERT +-- INTO +-- authenticated_access.notifications_by_user (sender, +-- receiver, +-- type_of_notification, +-- read_by_receiver) +-- SELECT +-- n.sender, +-- n.receiver, +-- n.type_of_notification, +-- n.read_by_receiver +-- FROM +-- notification_json l +-- CROSS JOIN LATERAL JSON_POPULATE_RECORDSET( +-- NULL::authenticated_access.notifications_by_user, +-- doc) AS n; diff --git a/supabase/types/supabase.ts b/supabase/types/supabase.ts index 7f95a020..0be5398a 100644 --- a/supabase/types/supabase.ts +++ b/supabase/types/supabase.ts @@ -9,48 +9,7 @@ export type Json = export interface Database { public: { Tables: { - notifications_by_user: { - Row: { - created_at: string - id: string - read_by_receiver: boolean - receiver: string - sender: string - type_of_notification: Database["public"]["Enums"]["notifications_enum"] - } - Insert: { - created_at?: string - id?: string - read_by_receiver?: boolean - receiver: string - sender: string - type_of_notification?: Database["public"]["Enums"]["notifications_enum"] - } - Update: { - created_at?: string - id?: string - read_by_receiver?: boolean - receiver?: string - sender?: string - type_of_notification?: Database["public"]["Enums"]["notifications_enum"] - } - Relationships: [ - { - foreignKeyName: "notifications_by_user_receiver_fkey" - columns: ["receiver"] - isOneToOne: false - referencedRelation: "users" - referencedColumns: ["id"] - }, - { - foreignKeyName: "notifications_by_user_sender_fkey" - columns: ["sender"] - isOneToOne: false - referencedRelation: "users" - referencedColumns: ["id"] - } - ] - } + [_ in never]: never } Views: { [_ in never]: never diff --git a/supabase/types/supabase_authenticated_access.ts b/supabase/types/supabase_authenticated_access.ts index e10eac43..83150d48 100644 --- a/supabase/types/supabase_authenticated_access.ts +++ b/supabase/types/supabase_authenticated_access.ts @@ -294,79 +294,3 @@ export interface Database { } } } - -export type TablesAuthenticatedAccess< - PublicTableNameOrOptions extends | keyof (Database["authenticated_access"]["Tables"] & Database["authenticated_access"]["Views"]) - | { schema: keyof Database }, - TableName extends PublicTableNameOrOptions extends { schema: keyof Database } - ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] & - Database[PublicTableNameOrOptions["schema"]]["Views"]) - : never = never -> = PublicTableNameOrOptions extends { schema: keyof Database } - ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & - Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { - Row: infer R - } - ? R - : never - : PublicTableNameOrOptions extends keyof (Database["authenticated_access"]["Tables"] & - Database["authenticated_access"]["Views"]) - ? (Database["authenticated_access"]["Tables"] & - Database["authenticated_access"]["Views"])[PublicTableNameOrOptions] extends { - Row: infer R - } - ? R - : never - : never - -export type TablesInsertAuthenticatedAccess< - PublicTableNameOrOptions extends | keyof Database["authenticated_access"]["Tables"] - | { schema: keyof Database }, - TableName extends PublicTableNameOrOptions extends { schema: keyof Database } - ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] - : never = never -> = PublicTableNameOrOptions extends { schema: keyof Database } - ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { - Insert: infer I - } - ? I - : never - : PublicTableNameOrOptions extends keyof Database["authenticated_access"]["Tables"] - ? Database["authenticated_access"]["Tables"][PublicTableNameOrOptions] extends { - Insert: infer I - } - ? I - : never - : never - -export type TablesUpdateAuthenticatedAccess< - PublicTableNameOrOptions extends | keyof Database["authenticated_access"]["Tables"] - | { schema: keyof Database }, - TableName extends PublicTableNameOrOptions extends { schema: keyof Database } - ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] - : never = never -> = PublicTableNameOrOptions extends { schema: keyof Database } - ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { - Update: infer U - } - ? U - : never - : PublicTableNameOrOptions extends keyof Database["authenticated_access"]["Tables"] - ? Database["authenticated_access"]["Tables"][PublicTableNameOrOptions] extends { - Update: infer U - } - ? U - : never - : never - -export type EnumsAuthenticatedAccess< - PublicEnumNameOrOptions extends | keyof Database["authenticated_access"]["Enums"] - | { schema: keyof Database }, - EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } - ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] - : never = never -> = PublicEnumNameOrOptions extends { schema: keyof Database } - ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] - : PublicEnumNameOrOptions extends keyof Database["authenticated_access"]["Enums"] - ? Database["authenticated_access"]["Enums"][PublicEnumNameOrOptions] - : never diff --git a/tsconfig.json b/tsconfig.json index ed360f38..b567491a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,38 +1,39 @@ /* To learn more about this file see: https://angular.io/config/tsconfig. */ { - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "sourceMap": true, - "declaration": false, - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "importHelpers": true, - "target": "ES2022", - "module": "ES2022", - "useDefineForClassFields": false, - "lib": [ - "ES2022", - "dom" - ], - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true - }, - "exclude": [ - "cypress.config.ts", - "cypress", - "node_modules" - ] + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "importHelpers": true, + "target": "ES2022", + "module": "ES2022", + "useDefineForClassFields": false, + "resolveJsonModule": true, + "lib": [ + "ES2022", + "dom" + ] + }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + }, + "exclude": [ + "cypress.config.ts", + "cypress", + "node_modules" + ] }