Skip to content

Commit

Permalink
RBAC back-office (#153)
Browse files Browse the repository at this point in the history
* ✨ feat(audit): add audit functionality to track changes in tables

This commit adds the necessary SQL scripts to implement an audit functionality for tracking changes in tables. The audit functionality is based on the 2ndQuadrant/audit-trigger project with a few modifications. The changes include:
- Requiring PostgreSQL version 10 or higher
- Storing row data in jsonb format

The commit includes the following changes:
- Creates a new schema called "audit" to store the audit tables and trigger functions
- Creates a table called "audit.logged_actions" to store the history of auditable actions on audited tables
- Defines a trigger function called "audit.if_modified_func()" to track changes to a table at the statement and/or row level
- Defines a function called "audit.audit_table()" to add auditing support to a table, allowing for row-level changes to be logged with full client query text
- Provides convenience call wrappers for the "audit.audit_table()" function to simplify the process of adding auditing support to a table

The audit functionality allows for customization through optional parameters in the CREATE TRIGGER call, including whether to log the query text and which columns to ignore in updates.

✨ feat(roles_and_role_assignments): add migration scripts for roles and role_assignments tables

The migration scripts add the following changes:
- Create the "roles" table to store different user roles with their values as primary keys.
- Insert default roles into the "roles" table.
- Add comments to describe each role in the "roles" table.
- Create the "role_assignments" table to assign roles to accounts, allowing a many-to-many relationship.
- Add comments to explain the purpose and design of the "role_assignments" table.
- Enable auditing for the "role_assignments" table to record row changes and SQL text.

These changes are necessary to implement the Role-Based Access Control (RBAC) system integration within the Offline platform.

📦 chore(audit): add audit_logged_actions.yaml table to audit schema
📦 chore(audit): add public_role_assignments.yaml table to public schema
📦 chore(audit): add public_roles.yaml table to public schema
📦 chore(audit): update tables.yaml to include new tables audit_logged_actions.yaml, public_role_assignments.yaml, and public_roles.yaml

🔧 chore(.env.local): add HASURA_GRAPHQL_DEV_MODE=true to enable development mode in local environment
🔧 chore(.env.test.jest): add HASURA_GRAPHQL_DEV_MODE=true to enable development mode in test environment

📦 chore(roleAssignments): rename table and file names to improve consistency and readability

📝 docs(roleAssignments): update table comment to provide more detailed explanation of its purpose and design

🔧 fix(roleAssignments): update migration scripts to use correct table name and schema

🐛 fix(docker-compose.yaml): add x-hasura-organizer-id claim to HASURA_GRAPHQL_JWT_SECRET in order to support organizer role in authorization
✨ feat(docker-compose.yaml): update HASURA_GRAPHQL_JWT_SECRET in test/docker-compose.yml to include x-hasura-organizer-id claim for testing purposes

🔧 fix(index.spec.ts): update mockOrganizer object to include role property for better test coverage
🔧 fix(index.spec.ts): update path in test case to use mockOrganizer's role.organizerId instead of organizerId
🔧 fix(index.ts): update getJwtAccessOptions function to handle access depending on user's role
🔧 fix(next-auth.ts): import RoleAssignments type from '@gql/shared/types' for better type checking

🔍 chore(.opencommitignore): add schema.graphql and schema.json to the list of ignored files to exclude them from version control

🔧 chore(.opencommitignore): update ignore patterns for schema.graphql and schema.json files
🐛 fix(Dashboard/layout.tsx): fix condition to check if user is an organizer by accessing the role property
🐛 fix(Dashboard/page.tsx): fix condition to check if user is an organizer by accessing the role property

🔒 chore(public_eventParameters.yaml): add insert permissions for the 'organizer' role

🔒 chore(public_eventParameters.yaml): add check condition for insert permissions of 'organizer' role to ensure the user has the required role assignments

🔒 chore(public_eventParameters.yaml): set 'organizerId' column value to 'X-Hasura-Organizer-Id' for insert permissions of 'organizer' role

🔒 chore(public_eventParameters.yaml): specify columns for insert permissions of 'organizer' role

🔧 chore(hasura): update role names and descriptions for better clarity and organization

The role names and descriptions in the `public_eventParameters.yaml` file and the `up.sql` and `down.sql` migration scripts have been updated to use the prefix "organizer_" to indicate that these roles are specific to organizers. This change improves clarity and organization within the codebase.

🔒 chore(.env.local): update JWT secrets for authentication to improve security
🔒 chore(next.config.js): update NEXTAUTH_SECRET to improve security
🔒 chore(docker-compose.yaml): update HASURA_GRAPHQL_JWT_SECRETS to improve security
🔒 chore(tools/test/docker-compose.yml): update HASURA_GRAPHQL_JWT_SECRETS to improve security

🐛 fix(route.ts): remove unnecessary parameter from createOptions() function call
🐛 fix(route.ts): remove unnecessary parameter from createOptions() function call
🐛 fix(index.spec.ts): remove unnecessary parameter from createOptions() function call
🐛 fix(index.spec.ts): remove unnecessary parameter from createOptions() function call
🐛 fix(index.spec.ts): remove unnecessary parameter from createOptions() function call
🐛 fix(index.ts): remove unnecessary parameter from createOptions() function call
🐛 fix(getCurrentUser.ts): remove unnecessary parameters from createOptions() and getServerSession() function calls
🐛 fix(getJwt.ts): remove unnecessary parameter from nextAuthCookieName() function call
🐛 fix(getJwt.ts): remove unnecessary parameters from getToken() function call
🐛 fix(getSession.ts): remove unnecessary parameters from createOptions() and getServerSession() function calls

🔧 fix(nextAuthCookieName.ts): add support for appending '.back-office' to the cookie name if isBackOffice() returns true
🔧 fix(index.ts): refactor generateJwt function to accept user object and secret as arguments, and generate JWT with user and role information for marketplace users
🔧 fix(index.ts): refactor usersJwt object to use generateJwt function with user object, secret, and role for marketplace users

📝 chore(env): update HASURA_VERSION to v2.35.0 in .env.local file to use the latest version of Hasura GraphQL Engine
📝 chore(docker-compose): update hasura/graphql-engine image version to v2.35.0 in docker-compose.yaml file to use the latest version of Hasura GraphQL Engine
📝 chore(hasura): update Hasura CLI version to v2.35.0 in Dockerfile to use the latest version of Hasura CLI
📝 chore(test): update hasura/graphql-engine image version to v2.35.0.cli-migrations-v3 in docker-compose.yml file to use the latest version of Hasura GraphQL Engine for testing purposes

🐛 fix(global-error.tsx): remove unnecessary console.log statement in Error component
🔀 merge(gql): add support for back-office-jwt and marketplace-jwt headers in fetchDataForTest function
🔧 chore(jest.setup.back-office.ts): add environment variables for back-office app and NEXTAUTH_SECRET

📦 chore(docker-compose.yaml): update PostgreSQL image version from 13 to 16 for both db and test-db services to use the latest version

🔧 refactor(features-pass-cache.ts): update cache methods to use kv namespace for better readability and maintainability
🔧 refactor(index.spec.ts): update cache methods to use kv namespace for better readability and maintainability
🔧 refactor(index.ts): rename client property to kv and update cache methods to use kv namespace for better readability and maintainability

📦 chore(admin): add admin role library

📝 Add .eslintrc.json configuration file for the admin role library to extend the root .eslintrc.json file and ignore specific patterns.

📝 Add .swcrc configuration file for the admin role library to configure the SWC compiler options.

📝 Add README.md file for the admin role library.

📝 Add jest.config.ts file for the admin role library to configure Jest for unit testing.

📝 Add package.json file for the admin role library.

📝 Add project.json file for the admin role library to define the project structure and targets.

📝 Add index.ts file for the admin role library to export the roles-admin module.

📝 Add roles-admin.ts file for the admin role library to implement the RoleInvitationService class and its methods.

📝 Add tsconfig.json file for the admin role library to extend the base tsconfig and configure the compiler options.

📝 Add tsconfig.lib.json file for the admin role library to extend the tsconfig.json and configure the compiler options for the library.

📝 Add tsconfig.spec.json file for the admin role library to extend the tsconfig.json and configure the compiler options for unit testing.

🔧 chore(roles_and_role_assignments): update down.sql and up.sql to add "invitedById" column and unique constraint on roleAssignments table
✨ feat(account.query.gql): add new query GetAccountByAddress to fetch account by address
📦 add(roles/roleAssignments.mutation.gql): add new mutation CreateRoleAssignment to insert a role assignment into roleAssignments table

🔧 chore(roleAssignments.yaml): add object and remote relationships, select and delete permissions to improve data model and access control

📝 docs(roleAssignments.query.gql): add new queries to fetch role assignments with organizer and inviter information

📝 docs(RoleAssignmentsFields.fragement.gql): add fragment for role assignments fields

🔧 chore(roles-admin.ts): refactor and improve code readability and semantics
🚀 feat(roles-admin.ts): add support for accepting and declining role invitations
🐛 fix(roles-admin.ts): fix bugs related to invitation verification and retrieval

🔧 chore(roles-admin.ts): refactor RoleInvitationService constructor to accept an optional cache parameter for better testability and flexibility
🔧 chore(roles-admin.spec.ts): add tests for RoleInvitationService class methods to ensure proper functionality and error handling
🔧 chore(index.ts): add back-office user accounts and JWT generation for testing purposes

📦 chore(roles-api): add ESLint configuration file

📦 chore(roles-api): add README.md file

📦 chore(roles-api): add Jest configuration file

📦 chore(roles-api): add package.json file

📦 chore(roles-api): add project.json file

📦 feat(roles-api): add index.ts file

📦 feat(roles-api): add getMyRoles function

📦 feat(roles-api): add getMyRolesWithOrganizerAndInviterInfos function

📦 feat(roles-api): add getMyRolesWithOrganizerInfos function

📦 chore(roles-api): add tsconfig.json file

📦 chore(roles-api): add tsconfig.lib.json file

📦 chore(roles-api): add tsconfig.spec.json file

🔧 chore(public_account.yaml): remove unused remote_relationships block to simplify the configuration
🔧 chore(1698942028885_roles_and_role_assignments): add NOT NULL constraint to "accountId", "invitedById", and "role" columns for roleAssignments table
🔧 chore(1699117141773_alter_table_public_account_drop_column_organizerId): add migration scripts to drop and add "organizerId" column in the "account" table
🔧 chore(0_account.sql): remove "organizerId" column from INSERT statements in the "account" seed data
🔧 chore(AccountFields.fragment.gql): remove "organizerId" field from AccountFields fragment
🔧 chore(index.ts): update backOfficeAccounts object to use satisfies keyword instead of casting to AppUser

📝 chore(roleAssignments.sql): add roleAssignments seed file to populate roleAssignments table with initial data
📝 chore(db): update SeedTable enum to include roleAssignments table
📝 chore(gql): add alpha_organizer2_admin_user to backOfficeAccounts to simulate an organizer admin user with a dummy organizer ID
📝 chore(deleteAllData.js): add roleAssignments table to tablesToDelete list to ensure it gets deleted when running deleteAllData script

🔥 refactor(migrations): remove unnecessary migration files and update account seed data

🔥 refactor(migrations): remove unnecessary migration files and update account seed data to remove "isOrganizer" column and update "emailVerified" column values

🐛 fix(server.ts): change port variable case from lowercase port to uppercase PORT to improve semantics
✨ feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port
🐛 fix(index.ts): import Currency_Enum_Not_Const from '@currency/types' to fix missing import error
🐛 fix(index.ts): remove unused imports to improve code cleanliness
✨ feat(index.ts): add supportedCurrencies property to Currency class to store supported currencies as a string
✨ feat(index.ts): initialize supportedCurrencies property in Currency class constructor to join values of Currency_Enum_Not_Const enum
🐛 fix(index.ts): update getRate method in Currency class to include symbols query parameter in API URL to fetch rates for supported currencies only
🐛 fix(tsconfig.json): add "preserveConstEnums": true to preserve const enums during compilation
🐛 fix(tsconfig.lib.json): add "preserveConstEnums": true to preserve const enums during compilation
🐛 fix(currency-types.ts): update Currency_Enum_Not_Const enum values to start with uppercase letters for consistency
🐛 fix(next-currency-cache.spec.ts): update import statements to fix missing import errors
✨ feat(CurrencyCache): add CurrencyCache class to handle caching of currency rates
✨ feat(CurrencyCache): implement getCacheKey method to generate cache key for a given currency
✨ feat(CurrencyCache): implement withCacheKey method to wrap a function with cache key generation logic
✨ feat(CurrencyCache): implement setRate method to fetch rate for a currency from Currency API and store it in Cache API
✨ feat(CurrencyCache): implement getRate method to fetch rate for a currency from Cache API
✨ feat(CurrencyCache): implement setRates method to set rates for all currencies by calling setRate method for each currency
✨ feat(CurrencyCache): implement getRates method to fetch rates for all currencies by calling getRate method for each currency
✨ feat(CurrencyCache): implement populateCacheIfEmpty method to populate cache with rates if cache is empty
🐛 fix(CurrencyProvider): update import statement to fix missing import error
✨ feat(CurrencyProvider): create instance of CurrencyCache class to handle caching of currency rates
✨ feat(CurrencyProvider): update useEffect hook to call getRates method of CurrencyCache instance

🔧 chore(roles-api): update jest configuration to ignore integration tests and add new integration test configuration
✨ feat(roles-api): add integration test configuration for roles-api
🔧 chore(roles-api): update project.json to include new test-integration executor and configuration
✅ test(roles-api): add integration test for getMyRoles function
✅ test(roles-api): add unit test for getMyRoles function
🔧 chore(roles-api): update tsconfig.spec.json to include types from the types folder in the coverage calculation

🔀 refactor(index.ts): reorganize and optimize user client functions

🔀 refactor(index.ts): reorganize and optimize back-office user client functions

✨ feat(index.ts): add support for isBackOffice parameter in alphaUserClient and betaUserClient functions to generate appropriate JWTs for back-office users

🐛 fix(roleAssignments.sql): fix incorrect value in accountId field in one of the seed records

🚀 feat(docker-compose.yaml): add "organizer_human_resources" service to the list of services in the docker-compose file to support new functionality related to human resources management in the organization

🐛 fix(roles_role_assignments_account): add "organizer_human_resources" role to the list of roles in the up and down migration scripts to enable administrative permissions for managing human resources in the organization

🚀 feat(docker-compose.yml): add "organizer_human_resources" service to the list of services in the test docker-compose file to support testing of new functionality related to human resources management in the organization

🔥 refactor(public_eventParameters.yaml): remove unused insert_permissions block to simplify the configuration
🔥 refactor(public_nftTransfer.yaml): remove unused select_permissions block to simplify the configuration

🔧 fix(roles-admin.spec.ts): add missing cache operations for srem and sadd
✨ feat(roles-admin.ts): add support for managing inviter's sent invitations in cache

📦 chore: add roleAssignments.query.gql and RoleAssignmentsFields.fragment.gql files to the project
🐛 fix(roles-admin.ts): fix expiration time calculation for invitation creation to set it to 24 hours from now
✨ feat(roles-admin.ts): add invitationForRoleExists method to check if an invitation or role assignment already exists for a given role, organizer, and event
🐛 fix(roles-admin.ts): perform cleanup and throw error if invitation has expired during verification or acceptance of invitation

🐛 fix(types): update type definition for EventPassOrderWithContractData to use correct GraphQL query response type
✨ feat(roles-admin): add support for checking if an invitation for a role exists for a given inviter, invited, role, organizerId, and eventId
✅ test(roles-admin): add tests for invitationForRoleExists and getInvitationsByInviter methods in RoleInvitationService class
🐛 fix(roles-admin): fix bug in invitationForRoleExists method where it was not returning false when the invited user does not have the given role for the given organizer and event
✨ feat(roles-admin): add support for filtering out null results from expired or non-existent invitations in getInvitationsByInviter method
🐛 fix(roles-admin): fix bug in fetchInvitation method where it was not marked as public

🐛 fix(roles-admin.spec.ts): remove unnecessary mockResolvedValue for cache get method
✨ feat(roles-admin.spec.ts): add test cases for fetchInvitation method to cover different scenarios

🐛 fix(roles-admin.spec.ts): fix incorrect property names in invitationForRoleExists and verifyInvitation functions

🐛 fix(roles-admin.spec.ts): import RoleAuthorization class to fix reference error
✨ feat(roles-admin.spec.ts): add tests for RoleAuthorization.inviteAccountWithRole method to ensure proper role authorization logic
🚚 chore(roles-admin.ts): move RoleAuthorization class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorizationError class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move InviteAccountWithRoleProps interface to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorization class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorizationError class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move InviteAccountWithRoleProps interface to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorization class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorizationError class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move InviteAccountWithRoleProps interface to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorization class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorizationError class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move InviteAccountWithRoleProps interface to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorization class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorizationError class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move InviteAccountWithRoleProps interface to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorization class to its own file for better organization and separation of concerns
🚚 chore(roles-admin.ts): move RoleAuthorizationError class to its own file for better organization and separation of concerns

📦 chore(roles-actions): add roles-actions library

✨ feat(roles-actions): add .eslintrc.json configuration file for roles-actions library

✨ feat(roles-actions): add README.md file for roles-actions library

✨ feat(roles-actions): add jest.config.ts configuration file for roles-actions library

✨ feat(roles-actions): add package.json file for roles-actions library

✨ feat(roles-actions): add project.json configuration file for roles-actions library

✨ feat(roles-actions): add index.ts file for roles-actions library

✨ feat(roles-actions): add inviteAccountWithRole.ts file for roles-actions library

✨ feat(roles-actions): add inviteAccountWithRole.spec.ts file for roles-actions library

✨ feat(roles-actions): add tsconfig.json configuration file for roles-actions library

✨ feat(roles-actions): add tsconfig.lib.json configuration file for roles-actions library

✨ feat(roles-actions): add tsconfig.spec.json configuration file for roles-actions library

🔧 chore(public_roleAssignments.yaml): add insert and delete permissions for organizer_human_resources and organizer_super_admin roles
🔧 chore(public_roleAssignments.yaml): add insert and delete permissions for organizer_human_resources and organizer_super_admin roles
🔧 chore(inviteAccountWithRole.spec.ts): refactor test cases to use mock functions and improve readability

feat: updated next-auth to handle RBAC with user.role for backoffice + tests

feat: account now return roles list

feat: permissions for roleAssignments + roles relationship in account

🐛 fix(index.spec.ts): remove unused imports and variables
🐛 fix(index.spec.ts): remove unused mockReq variable
🐛 fix(index.spec.ts): remove commented out code
🐛 fix(index.spec.ts): remove unused mockToken variable
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in back office
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in back office and updated role
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in back office and unauthorized role
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in back office and unauthorized kyc status
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in web app
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in web app and no role
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in web app and unauthorized role
✨ feat(index.spec.ts): add test case for createOptions callbacks.jwt function with user in web app and unauthorized kyc status
🐛 fix(index.ts): remove unused import
🐛 fix(index.ts): remove unused variable
✨ feat(index.ts): add check for user role and return undefined if role is not defined
✨ feat(index.ts): add check for user role and return undefined if app is not back office
✨ feat(index.ts): add check for user role and return undefined if user kyc is not validated
🐛 fix(next-auth.ts): remove unused import
🐛 fix(next-auth.ts): remove unused type import
✨ feat(next-auth.ts): update AppUser type to use Role type instead of RoleAssignments type
🐛 fix(index.ts): remove unused import
🐛 fix(index.ts): remove unused type import
✨ feat(index.ts): export Role type

🔥 refactor(jest.config.js): remove unused jest configuration file

🔥 refactor(next/hasura/utils): remove unused files and configurations

🔥 refactor(next/hasura/utils/src/index.ts): remove unused enum and types

🔥 refactor(next/hasura/utils/tsconfig.json): remove unused tsconfig file

🔥 refactor(next/hasura/utils/tsconfig.lib.json): remove unused tsconfig file

🔥 refactor(next/hasura/utils/tsconfig.spec.json): remove unused tsconfig file

🔥 refactor(tsconfig.base.json): remove unused paths for next/hasura/utils

🔀 refactor(index.ts): add optional levelName parameter to isUserKycValidated function for more flexible validation
🐛 fix(index.ts): fix isUserKycValidated function to properly validate user's kyc levelName if provided

📦 chore(roles): add ESLint configuration file for roles feature

📦 chore(roles): add README.md file for roles feature

📦 chore(roles): add Jest configuration file for roles feature

📦 chore(roles): add package.json file for roles feature

📦 chore(roles): add project.json file for roles feature

📦 chore(roles): add index.ts file for roles feature

📦 chore(roles): add RoleBadge.stories.tsx file for RoleBadge component

📦 feat(RoleBadge): implement RoleBadge component to display role badges

📦 chore(roles): add tsconfig.json file for roles feature

📦 chore(roles): add tsconfig.lib.json file for roles feature

📦 chore(roles): add tsconfig.spec.json file for roles feature

📦 chore(i18n): update en.json and fr.json with translations for RoleBadge component

📦 chore(role-avatar): add RoleAvatar component and its stories

📝 Add RoleAvatar component and its related files:
- Added RoleAvatar.stories.tsx file to showcase the RoleAvatar component in Storybook.
- Added RoleAvatar.tsx file to implement the RoleAvatar component.
- Added examples.tsx file to provide example data for the RoleAvatar component.

The RoleAvatar component is used to display an avatar for a specific role with its associated organizer. It takes a role object as a prop, which includes information about the organizer such as their name, image URL, and slug. The component renders an avatar with the organizer's image if available, or falls back to displaying the organizer's initials if no image is provided.

The RoleAvatar component is now ready to be used in the application.

📦 chore(gql): add OrganizerFields fragment to improve code reusability and readability in roleAssignments queries
🔀 merge(gql): use OrganizerFields fragment in roleAssignments queries to fetch organizer information
🔀 merge(roles): add RoleWithOrganizer type to represent a role with associated organizer information

🚀 feat(app-nav): add ProfileAvatar component to app-nav library

🐛 fix(app-nav): fix className assignment in ProfileAvatar component

🚀 feat(app-nav): add ProfileNav and ProfileNavSkeleton components to app-nav library

🚀 feat(app-nav): add ProfileNavClient component to app-nav library

🚀 feat(app-nav): add ProfileNavClientExample and ProfileNavExample components to app-nav library

* 🐛 fix(docker-compose.yml): fix syntax error by adding missing closing double quote for "organizer_guest" service name

* 🐛 fix(layout.tsx): import CurrencyCache instead of individual functions from currency-cache to improve code readability and maintainability
🐛 fix(layout.tsx): change getRate and setRates function calls to methods of CurrencyCache class to improve code readability and maintainability
🐛 fix(next.config.js): add webpack configuration to resolve fs and path modules to fix build errors
🐛 fix(next.config.js): add webpack configuration to resolve fs and path modules to fix build errors
🐛 fix(layout.tsx): import CurrencyCache instead of individual functions from currency-cache to improve code readability and maintainability
🐛 fix(layout.tsx): change getRate and setRates function calls to methods of CurrencyCache class to improve code readability and maintainability
🐛 fix(next.config.js): add webpack configuration to resolve fs and path modules to fix build errors
🐛 fix(next.config.js): add webpack configuration to resolve fs and path modules to fix build errors
🐛 fix(index.ts): change ProfileAvatarProps type import to use 'type' keyword for consistency
🐛 fix(setRates.ts): import CurrencyCache instead of next-currency-cache to improve code readability and maintainability
🐛 fix(next-currency-cache.ts): remove unnecessary 'use server' statement
🐛 fix(roles-admin.ts): add null check for user.role to prevent potential errors

* fix: alchemy network undefined, change in AlchemyNFTACtivityWebHookEvent

* fix: alchemy tests and network in event

* 🔧 chore(handleAccount.spec.ts): add test case for null roles in handleAccount function

* 🐛 fix(server.ts): change port variable case from lowercase port to uppercase PORT to improve semantics
✨ feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port
🐛 fix(default.tsx): refactor ProfileNavSection to accept locale as a parameter to improve reusability
✨ feat(default.tsx): add Suspense component to handle loading state and render ProfileNavSectionContent when locale is available
🐛 fix(default.tsx): refactor ProfileNavSectionContent to use getCurrentUser and getMyRolesWithOrganizerInfos functions to improve data fetching
✨ feat(default.tsx): pass roles and account props to ProfileNavClient component to display user role and account information
🐛 fix(index.ts): export ProfileNavSkeleton component to fix import error in other files
🐛 fix(ProfileNav.stories.tsx): remove unused imports and fix import path for ProfileNavSkeleton component
✨ feat(ProfileNav.stories.tsx): add new stories for different scenarios of ProfileNav component
🐛 fix(ProfileNav.tsx): refactor ProfileNav component to split rendering logic into separate functions for better readability
✨ feat(ProfileNav.tsx): add ProfileNavUser, ProfileNavNotConnected, and ProfileNavRole components to handle different user states and roles
🐛 fix(ProfileNavClient.tsx): refactor ProfileNavClient component to use SafeUser type from @next/auth and RoleWithOrganizer type from @roles/types
✨ feat(ProfileNavClient.tsx): add matchingRole variable to find the matching role for the current user and pass it to ProfileNav component
🐛 fix(examples.tsx): fix import path for ProfileNav component
✨ feat(examples.tsx): add user object for testing purposes
🐛 fix(RoleAvatar.stories.tsx): remove unused import and fix import path for RoleAvatar component
✨ feat(RoleAvatar.stories.tsx): add new stories for different scenarios of RoleAvatar component
🐛 fix(RoleAvatar.tsx): fix fallback value for organizer name and profile image in RoleAvatar component
✨ feat(role-avatar/examples.tsx): rename organizerRole to organizerRoleAdmin for better clarity
🐛 fix(index.ts): export RoleBadge component from lib/role-badge/RoleBadge

* 🔧 fix(ProfileNav.tsx): update CSS classes to improve readability and maintain consistency
🔧 fix(RoleBadge.tsx): update import path for Badge component to match new file structure
🔧 fix(index.ts): update export statement for Badge component to include type BadgeProps

* add make reset-docker to ci

make ci commands sequential

🔧 chore(ci.yml): update parallel commands in CI workflow to run docker:test and docker:services commands concurrently
🐛 fix(docker-compose.yaml): fix JSON path in x-hasura-* headers to correctly access values

* 🐛 fix(ProfileNav.stories.tsx): include WithUser configuration in Skeleton story to ensure consistent rendering
🐛 fix(RoleAvatar.tsx): remove 'role' prop from Omit type to prevent TypeScript error
✨ feat(RoleAvatar.tsx): destructure 'props' object in function signature for improved readability and maintainability
🔧 chore(tsconfig.lib.json): exclude example and story files from TypeScript compilation to improve build performance

* 🔨 refactor(ProfileNav.tsx): improve readability and semantics of ProfileNav component
🐛 fix(ProfileNav.tsx): replace span element with div element for better accessibility and styling

---------

Co-authored-by: Alexandre Gouasmi <[email protected]>
  • Loading branch information
sebpalluel and AlexandreG-tech authored Nov 9, 2023
1 parent be7821c commit 0d0fa4a
Show file tree
Hide file tree
Showing 162 changed files with 45,561 additions and 27,902 deletions.
8 changes: 5 additions & 3 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ NX_CLOUD_AUTH_TOKEN=MTIzMmRkZjctM2RjOS00OTRkLWE0ODgtYjIyNzk1ZjlkZTFmfHJlYWQtd3Jp
NX_CACHE_DIRECTORY=.nx/cache

# hasura
HASURA_VERSION=v2.27.0
HASURA_VERSION=v2.35.0
HASURA_GRAPHQL_SERVER_PORT=8080
HASURA_GRAPHQL_ADMIN_SECRET=password
HASURA_CONSOLE_PORT=9695
HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:password@db:5432/postgres
HYGRAPH_CMS_WEBHOOK_READ_URL=https://eu-central-1-shared-euc1-02.cdn.hygraph.com/content/cliyf1fte05rf01um257o2lim/master
HYGRAPH_CMS_READ_TOKEN=Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImdjbXMtbWFpbi1wcm9kdWN0aW9uIn0.eyJ2ZXJzaW9uIjozLCJpYXQiOjE2ODczNDQzODgsImF1ZCI6WyJodHRwczovL2FwaS1ldS1jZW50cmFsLTEtc2hhcmVkLWV1YzEtMDIuaHlncmFwaC5jb20vdjIvY2xpeWYxZnRlMDVyZjAxdW0yNTdvMmxpbS9tYXN0ZXIiLCJtYW5hZ2VtZW50LW5leHQuZ3JhcGhjbXMuY29tIl0sImlzcyI6Imh0dHBzOi8vbWFuYWdlbWVudC5ncmFwaGNtcy5jb20vIiwic3ViIjoiNWI1ZjUwMWMtYjQyOC00OGY1LWI2ZGEtOTcwMWZiZDlhZjViIiwianRpIjoiY2xqNWxhNnpwMDh5ZTAxdW0wcWsyN3A1byJ9.gMlU5X5OzMHiUPB_NlsOWogmh61uNn4mdsEm83cPOAcX4hkahhJqrgva2ODjfldC7C26RbWSdxTOJH3MNn_Dc6Vl38MweNtuVivkyHirC7S_ts9apoyfr_MGyfc0UxzvGyja06ljQ78F-NlizXpFGGZKPlPwTrq0_2wY_SlY6S1YRFDMqNbmYAiQTlzzrvB0ccd0Pnjp4dQ9-gygr4SA6lBfd44w9dN31JyvX2rzMyviFb1dEh9VxWGtgw-C41JP_Fkn30SSnFt1u2lmJt848d0vxT8mzwE6hg9uPSCzcALe3AjHP95_S2BqTSGw7a43iyfDVx3UhRMCbmPWntnX95v_Ht1XB7QDEarDavYlc8cFx5g1GRxGUrh2gfeJxGki2AQIToM3uaFtuq2hJ9R70_GX5k7DOK2_P8KgzCCXozMiHIGeCtJ6O5MGjA1U3AUOSw4F78u7AL9bid8g-v8zuAMEl7zBCcErqgKdcp28ehesDXEY0vBk9p5VfWpW_jNspD6G7hMg1gKCyYa2d4px-2Ftr3OpKnu9cSKQkKWWB_UvwNKZcZy1q0fI5hzz3wcLnsMiT_qHf8JBvXJ7wzOJBR2YTd1HsWv66NOVGESacUGRqUcsgR4ZjQHbWOxMcgsk3fe5oAKR3zDMR_CCWi3Q17s9_0z155GBGm-GPb0mjgE
HASURA_GRAPHQL_UNAUTHORIZED_ROLE=anonymous
HASURA_GRAPHQL_DEV_MODE=true
# TODO: activate once allow list fonctionnal
# HASURA_GRAPHQL_ENABLE_ALLOWLIST=true

Expand All @@ -30,8 +31,9 @@ HASURA_PROJECT_ENDPOINT=http://localhost:8080/v1/graphql
NEXT_PORT=8888
NEXT_HOST=localhost
NEXTAUTH_URL=http://localhost:8888
## This is corresponding to the RSA key for web app
## IMPORTANT ! Keep the "" arround in NEXTAUTH_SECRET to avoid convertion to string litteral, otherwise \n not interpreted and private key will not work
NEXTAUTH_SECRET="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCUT2D12vnJqrz2\nCviWdnXJFvYMqKw+GtWYC9U9NxeQWs7NDMm+4hV2fKiNPEs5OiSo/W12KNvvbA9R\nZBrG4G6KYihABDaXXP+i80uDM9CH9zaDysLdKrc7ixWB1lISsYa0q+Idz75rdX9k\ncnjmomCtamiyPTmrxIdC58/ovo37G7XDCLwI/0vEmHWCn9Gdps+CA8xGPT3BXq6e\npwy4r+iEvrJx+B5OZUaVwK9Qs3+2dwfDfiwac4ETeRB+CFHQpEUZHY/A7gaciScF\n5u6XRbv6GtS2XKLZ/M/lZSfqfzwEu7/Zx332zE6Rsb0aTxMwpvfS85vjm63sJa+3\nugV8ejDvAgMBAAECggEABwpJmQIfD2Kqe6eDq2jOKJCNd4ZePsh5UTFmmvRNiw20\neWlc/lGvISPDwIiXLY1EBj2Zf51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YVgm0LXPSLcuU92zfqNKJ1mk/7oeV\ndvHS55Z6eEoukrwweG8y+f4yKreBV7wNg/TENm6SzooTjMddI8BCUzqhp2ddMP6S\nK7RID8jCstbhlaqYfuDOGOc6HaLTbPwM/2wwj9j8D53QfksRvcwSuqtZSQe+QF9W\noiHqZpJ/qIeLN4Yv2rWYLpNdNOF7dpF+0mwRFeQwMm0YonWYoTdroPqkDeDt\n-----END RSA PRIVATE KEY-----\n"
TOKEN_LIFE_TIME="648000"
# NEXT_PUBLIC_WEB3AUTH_CLIENT_ID="BNIxn1mWyMcmbMPI9sns29pGFoMlgN0j3X3rkC9u8w7LFnIkwIaUMYJ2mQkZIUILZtg8acRnlLQ2FnlUgyu_BAo"
# NEXT_PUBLIC_WEB3AUTH_NETWORK='testnet'
Expand Down Expand Up @@ -78,7 +80,7 @@ NEXT_PUBLIC_UPLOAD_ACCOUNT_ID=FW25ba3
## those are the local api key with `/local/*/**` access, production have other secret key with access to `/production/*/**`
UPLOAD_PATH_PREFIX=local
NEXT_PUBLIC_UPLOAD_PATH_PREFIX=local
UPLOAD_SECRET_JWT="-----BEGIN RSA PRIVATE KEY-----\nMIIJJwIBAAKCAgEAvhOAP5dkthnYD/uOSOWpRvqLKCC0fepevXF0SYz2wISUt/YG\n3Q0dOCXmoqXogQE24Il8dI4HA8+1WhIxt2Vo9/6mTTZAacdgYdkc3qCEFjHccatD\nh9K8V+z2q9UBL52Q5ZGznZgoRUqHTb7O4qqXesTqGMmzc1L4BKwGXYQjItI31vnG\nGn5AOh2qzPmCn4KYJY4hwjZDMVpuos0U2iP+e2vQj9+WEXSnf/krdibQa0Xnn84+\nyYgSnPItYgndxNA+7L87cEO5KE0LWT1sA2+QFcikzcKnptO4l+5ul8utWJgXmF/e\nneh/7KkG6YCOp5/tAz9Eh14PCOU1bloLW457c/gnax3pzDivm8CUwEDLMXIyUpj2\n0/usKVYHHqjWSCuxYTSCfNqqfAdkf9vt9Yll+fU0ouF00+B6ojeYQM3ROAO6C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i/putXysxxSEf43VfVjVlMTdVemXgNRXqdbwX4ji5NKlU0bHxK\nO2iXUeym7soaFZRHixYfex7WMl1m4qkSe7LY4NWiJdK5rDlt7yKYWCy/6GkINBCR\nBQRRbfseJXVv/jLKfYK8D4RVD+VrkH6uhBAbDn5SeTbNIjfXOSNaKyt+YLjF32Ni\n+XyoQTTZAT38FHyvC8Ie1+lsSHpjc3Ni8Aj4f3I3nMeiW1vP1vbIpBjCDMcSPObq\nFNZOmoQVUkJIIJE9NpdLa/kPDrUj7ptlUzqyJAvPbtwGLQuxjYZN6zwIIUn2dmPq\nguhOr7YxeD4jodRa6P0ZGml1HGGVG9LDAoIBAQCgMyPvM04hiLXDP/TV22qZUlaq\nnZK+ucyaosJ/lZZ0v9bNpsPz5s6yrzFUictW6j2Zi3p9Gd+yN1vCPPYE+gVHkSVv\n+cw0OATZGQYKbptIAxv5lEORzramtS5huHwYVgm0LXPSLcuU92zfqNKJ1mk/7oeV\ndvHS55Z6eEoukrwweG8y+f4yKreBV7wNg/TENm6SzooTjMddI8BCUzqhp2ddMP6S\nK7RID8jCstbhlaqYfuDOGOc6HaLTbPwM/2wwj9j8D53QfksRvcwSuqtZSQe+QF9W\noiHqZpJ/qIeLN4Yv2rWYLpNdNOF7dpF+0mwRFeQwMm0YonWYoTdroPqkDeDt\n-----END RSA PRIVATE KEY-----\n"
UPLOAD_SECRET_API_KEY=secret_FW25ba32vi58j8Xr45gBcpAcVG4W
UPLOAD_PUBLIC_API_KEY=public_FW25ba36mEdkrUv4r6qd45EtSRpT
NEXT_PUBLIC_UPLOAD_PUBLIC_API_KEY=public_FW25ba36mEdkrUv4r6qd45EtSRpT
Expand Down
3 changes: 3 additions & 0 deletions .opencommitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
\*.7z#
**/generated/**
pnpm-lock.yaml
schema.graphql
schema.json

37 changes: 30 additions & 7 deletions apps/back-office/app/[locale]/@profileNav/default.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
import { isConnected } from '@next/next-auth/user';
import { useLocale } from 'next-intl';
import {
ProfileNavClient,
ProfileNavSkeleton,
} from '@features/back-office/app-nav';
import { getMyRolesWithOrganizerInfos } from '@features/back-office/roles-api';
import { getCurrentUser } from '@next/next-auth/user';
import { getTranslator } from 'next-intl/server';
import { ProfileNavClient } from '@features/app-nav';
import { Suspense } from 'react';

export default async function ProfileNavSection() {
const locale = useLocale();
interface ProfileNavSectionProps {
params: {
locale: string;
};
}

export default async function ProfileNavSection({
params: { locale },
}: ProfileNavSectionProps) {
return (
<Suspense fallback={<ProfileNavSkeleton />}>
<ProfileNavSectionContent locale={locale} />
</Suspense>
);
}

async function ProfileNavSectionContent({ locale }: { locale: string }) {
const t = await getTranslator(locale, 'AppNav.Profile');
const isNextAuthConnected = await isConnected();
const user = await getCurrentUser();
let roles;
if (user) roles = await getMyRolesWithOrganizerInfos();
return (
<ProfileNavClient
signInText={t('sign-in')}
Expand All @@ -21,7 +42,9 @@ export default async function ProfileNavSection() {
signIn: t('sections-text.sign-in'),
settings: t('sections-text.settings'),
}}
isNextAuthConnected={isNextAuthConnected}
isNextAuthConnected={!!user}
roles={roles}
account={user}
/>
);
}
2 changes: 1 addition & 1 deletion apps/back-office/app/[locale]/Dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default async function DashboardLayout({
return (
<section className="container mx-auto">
{user ? (
!user.organizerId ? (
!user.role?.organizerId ? (
<p>User {user.id} is not an organizer</p>
) : (
children
Expand Down
6 changes: 3 additions & 3 deletions apps/back-office/app/[locale]/Dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OrganizerDashboard } from '@features/back-office/dashboard';
import { getCurrentUser } from '@next/next-auth/user';
import { getEventsFromOrganizerId } from '@features/back-office/dashboard-api';
import { getCurrentUser } from '@next/next-auth/user';

interface DashboardProps {
params: {
Expand All @@ -13,10 +13,10 @@ export default async function Dashboard({
}: DashboardProps) {
const user = await getCurrentUser();
if (!user) return;
const organizerId = user.organizerId || '';
const organizerId = user.role?.organizerId || '';
if (!organizerId) return;
const events = await getEventsFromOrganizerId({
id: user.organizerId as string,
id: organizerId as string,
locale,
});
return <OrganizerDashboard events={events} organizerId={organizerId} />;
Expand Down
7 changes: 4 additions & 3 deletions apps/back-office/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { siteConfig } from '@back-office/config/site';
import { Currency_Enum_Not_Const } from '@currency/types';
import { AppNavLayout, type AppNavLayoutProps } from '@features/app-nav';
import { AuthProvider, NextAuthProvider } from '@next/auth';
import { getRate, setRates } from '@next/currency-cache';
import { CurrencyCache } from '@next/currency-cache';
import { CurrencyProvider } from '@next/currency-provider';
import { getMessages, locales } from '@next/i18n';
import { getSession, isConnected } from '@next/next-auth/user';
Expand Down Expand Up @@ -62,11 +62,12 @@ export default async function RootLayout({
const messages = await getMessages(locale);
const session = await getSession();
const t = createTranslator({ locale, messages });
const currencyCache = new CurrencyCache();

if (isLocal()) {
const res = await getRate(Currency_Enum_Not_Const.USD);
const res = await currencyCache.getRate(Currency_Enum_Not_Const.Usd);
if (!res) {
await setRates();
await currencyCache.setRates();
}
}
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/back-office/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const handler = async (req: NextRequest, res: NextResponse) => {
return NextAuth(
req as unknown as NextApiRequest,
res as unknown as NextApiResponse,
createOptions(req),
createOptions(),
);
};

Expand Down
1 change: 1 addition & 0 deletions apps/back-office/app/global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function Error({
reset: () => void;
}) {
useEffect(() => {
console.log('Global Error', error);
// Log the error to an error reporting service
console.error(error);
}, [error]);
Expand Down
Loading

0 comments on commit 0d0fa4a

Please sign in to comment.