Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fffa7e6
Remove gender, telephone, username, position, placeholder, birthdate …
bolmsten Jul 14, 2025
803b69f
fix for E2E tests
bolmsten Jul 15, 2025
321f5ed
clean up tests from legacy fields
bolmsten Jul 15, 2025
c5b1ddd
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
bolmsten Oct 28, 2025
2b0e5ca
Update apps/frontend/src/components/user/UpdateUserInformation.tsx
bolmsten Oct 28, 2025
d192872
Remove old redeemCodes functionality
bolmsten Oct 30, 2025
86d9cd2
Remove gender, telephone, username, position, placeholder, birthdate …
bolmsten Jul 14, 2025
64c9c6e
fix for E2E tests
bolmsten Jul 15, 2025
40bc957
clean up tests from legacy fields
bolmsten Jul 15, 2025
bcac694
Update apps/frontend/src/components/user/UpdateUserInformation.tsx
bolmsten Oct 28, 2025
8300471
Remove old redeemCodes functionality
bolmsten Nov 7, 2025
809e1d6
Merge branch 'SWAP-4778-View_Only_Profile' of github.com:UserOfficePr…
bolmsten Nov 7, 2025
24d53b5
remove unused graphql call for email invite
bolmsten Nov 7, 2025
3ae7b38
fix merge
bolmsten Nov 7, 2025
80aba85
Fix E2E test after removing email invite
bolmsten Nov 7, 2025
94c7b36
fix seeds by removing unused parameters
bolmsten Nov 7, 2025
9aa98cb
remove seed file for redeem codes
bolmsten Nov 7, 2025
a939f89
fix E2E tests
bolmsten Nov 7, 2025
6511609
update validation package
bolmsten Nov 7, 2025
a0fe7a9
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
bolmsten Nov 14, 2025
d1f92a6
Fix E2E tests for removal of old people search
bolmsten Nov 14, 2025
5943bcf
Change proposals E2E test to use the new people selector
bolmsten Nov 18, 2025
e61c6d5
Merge branch 'develop' of github.com:UserOfficeProject/user-office-co…
bolmsten Nov 18, 2025
15c8e10
Removed aforementioned fields in more places
yoganandaness Nov 18, 2025
d41343f
Removed department from the user object
yoganandaness Nov 18, 2025
1bf5c12
Merge branch 'develop' into SWAP-4778-View_Only_Profile
bolmsten Nov 21, 2025
c62ea6f
Merge branch 'develop' into SWAP-4778-View_Only_Profile
bolmsten Nov 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/backend/db_patches/0181_RemoveUserColumns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ BEGIN
'2025-05-12'
) THEN
BEGIN
DELETE FROM features WHERE feature_id = 'EMAIL_INVITE_LEGACY';
DROP TABLE IF EXISTS public.redeem_codes;
-- first drop the FK on nationality
ALTER TABLE public.users
DROP CONSTRAINT IF EXISTS users_nationality_fkey;
Expand Down
24 changes: 24 additions & 0 deletions apps/backend/db_patches/0183_RemoveUserColulmns2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- 0181_RemoveUserColumns.sql
DO
$$
BEGIN
IF register_patch(
'0182_RemoveUserColumns2.sql',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: No need for the numbers, they might go easily out of sync with the file name

Suggested change
'0182_RemoveUserColumns2.sql',
'RemoveUserColumns2.sql',

'Fredrik Bolmsten',
'Remove gender, telephone, username, position, placeholder, birthdate and department columns from users table',
'2025-05-12'
) THEN
BEGIN
-- now drop the unwanted columns
ALTER TABLE public.users
DROP COLUMN username,
DROP COLUMN gender,
DROP COLUMN birthdate,
DROP COLUMN department,
DROP COLUMN position,
DROP COLUMN telephone;
END;
END IF;
END;
$$
LANGUAGE plpgsql;
23 changes: 11 additions & 12 deletions apps/backend/db_patches/db_seeds/0002_InstrumentScientists.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@ $DO$
BEGIN

INSERT INTO users(
user_id, user_title, firstname, lastname, username, preferredname, oidc_sub, oauth_refresh_token, gender, birthdate, department, "position", email,
telephone, created_at, updated_at, institution_id, placeholder)
VALUES (100, '', 'Instrument', 'Scientist1', 'instr.sci1', '-', 'instr.sci1.oauthsub', 'dummy-refresh-token', 'e2e user', '2020-10-10', 'IT', '', '[email protected]', '', NOW(), NOW(), 1, false);
user_id, user_title, firstname, lastname, preferredname, oidc_sub, oauth_refresh_token, email, created_at, updated_at, institution_id
)
VALUES (100, '', 'Instrument', 'Scientist1', '-', 'instr.sci1.oauthsub', 'dummy-refresh-token', '[email protected]', NOW(), NOW(), 1);

INSERT INTO users(
user_id, user_title, firstname, lastname, username, preferredname, oidc_sub, oauth_refresh_token, gender, birthdate, department, "position", email,
telephone, created_at, updated_at, institution_id, placeholder)
VALUES (101, '', 'Instrument', 'Scientist2', 'instr.sci2', '-', 'instr.sci2.oauthsub', 'dummy-refresh-token', 'e2e user', '2020-10-10', 'IT', '', '[email protected]', '', NOW(), NOW(), 1, false);
user_id, user_title, firstname, lastname, preferredname, oidc_sub, oauth_refresh_token, email, created_at, updated_at, institution_id
)
VALUES (101, '', 'Instrument', 'Scientist2', '-', 'instr.sci2.oauthsub', 'dummy-refresh-token', '[email protected]', NOW(), NOW(), 1);

-- user account with every roles except instrument scientist and user officer
INSERT INTO users(
user_id, user_title, firstname, lastname, username, preferredname, oidc_sub, oauth_refresh_token, gender, birthdate, department, "position", email,
telephone, created_at, updated_at, institution_id, placeholder)
VALUES (102, '', 'Not', 'Scientist', 'not.instr.sci', '-', 'not.instr.sci.oauthsub', 'dummy-refresh-token', 'e2e user', '2020-10-10', 'IT', '', '[email protected]', '', NOW(), NOW(), 1, false);
user_id, user_title, firstname, lastname, preferredname, oidc_sub, oauth_refresh_token, email, created_at, updated_at, institution_id
)
VALUES (102, '', 'Not', 'Scientist', '-', 'not.instr.sci.oauthsub', 'dummy-refresh-token', '[email protected]', NOW(), NOW(), 1);

-- user account with experiment safety reviewer
INSERT INTO users(
user_id, user_title, firstname, lastname, username, preferredname, oidc_sub, oauth_refresh_token, gender, birthdate, department, "position", email,
telephone, created_at, updated_at, institution_id, placeholder)
VALUES (103, '', 'Experiment', 'Safety', 'experiment.safety', '-', 'experiment.safety.oauthsub', 'dummy-refresh-token', 'e2e user', '2020-10-10', 'IT', '', '[email protected]', '', NOW(), NOW(), 1, false);
user_id, user_title, firstname, lastname, preferredname, oidc_sub, oauth_refresh_token, email, created_at, updated_at, institution_id)
VALUES (103, '', 'Experiment', 'Safety', 'experiment.safety', 'experiment.safety.oauthsub', 'dummy-refresh-token', '[email protected]', NOW(), NOW(), 1);

INSERT INTO role_user(
role_id, user_id)
Expand Down
13 changes: 0 additions & 13 deletions apps/backend/db_patches/db_seeds/0006_RedeemCodes.sql

This file was deleted.

15 changes: 7 additions & 8 deletions apps/backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@user-office-software/duo-localisation": "^1.2.0",
"@user-office-software/duo-logger": "^2.3.2",
"@user-office-software/duo-message-broker": "^1.8.0",
"@user-office-software/duo-validation": "^5.1.20",
"@user-office-software/duo-validation": "^5.1.22",
"@user-office-software/openid": "^1.4.0",
"await-to-js": "^2.1.1",
"bcryptjs": "^2.4.3",
Expand Down
15 changes: 1 addition & 14 deletions apps/backend/src/auth/OAuthAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,14 @@ export class OAuthAuthorization extends UserAuthorization {
if (user) {
const updatedUser = await this.userDataSource.update({
...user,
birthdate: userInfo.birthdate
? new Date(userInfo.birthdate)
: undefined,
department: userInfo.department as string,
email: userInfo.email,
firstname: userInfo.given_name,
gender: userInfo.gender,
lastname: userInfo.family_name,
oauthIssuer: client.issuer.metadata.issuer,
oauthRefreshToken: tokenSet.refresh_token ?? '',
oidcSub: userInfo.sub,
institutionId: institution?.id ?? user.institutionId,
position: userInfo.position as string,
preferredname: userInfo.preferred_username,
telephone: userInfo.phone_number,
user_title: userInfo.title as string,
});

Expand All @@ -165,18 +158,12 @@ export class OAuthAuthorization extends UserAuthorization {
(userInfo.title as string) ?? 'unspecified',
userInfo.given_name,
userInfo.family_name,
userInfo.email,
userInfo.preferred_username ?? '',
userInfo.sub,
tokenSet.refresh_token ?? '',
client.issuer.metadata.issuer,
userInfo.gender ?? 'unspecified',
new Date(),
institution?.id ?? 1,
'',
(userInfo.position as string) ?? '',
userInfo.email,
''
userInfo.email
);

const roleID = this.getUserRole(newUser);
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/buildContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import PredefinedMessageMutations from './mutations/PredefinedMessageMutations';
import ProposalMutations from './mutations/ProposalMutations';
import ProposalPdfTemplateMutations from './mutations/ProposalPdfTemplateMutations';
import QuestionaryMutations from './mutations/QuestionaryMutations';
import RedeemCodesMutations from './mutations/RedeemCodesMutations';
import ReviewMutations from './mutations/ReviewMutations';
import SampleMutations from './mutations/SampleMutations';
import ShipmentMutations from './mutations/ShipmentMutations';
Expand Down Expand Up @@ -120,7 +119,6 @@ const context: BasicResolverContext = {
),
proposal: container.resolve(ProposalMutations),
questionary: container.resolve(QuestionaryMutations),
redeemCodes: container.resolve(RedeemCodesMutations),
review: container.resolve(ReviewMutations),
sample: container.resolve(SampleMutations),
fap: container.resolve(FapMutations),
Expand Down
1 change: 0 additions & 1 deletion apps/backend/src/config/Tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const Tokens = {
ProposalSettingsDataSource: Symbol('ProposalSettingsDataSource'),
StatusActionsDataSource: Symbol('StatusActionsDataSource'),
QuestionaryDataSource: Symbol('QuestionaryDataSource'),
RedeemCodesDataSource: Symbol('RedeemCodesDataSource'),
RoleClaimDataSource: Symbol('RoleClaimDataSource'),
ReviewDataSource: Symbol('ReviewDataSource'),
FapDataSource: Symbol('FapDataSource'),
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/config/dependencyConfigDefault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import PostgresProposalDataSource from '../datasources/postgres/ProposalDataSour
import PostgresProposalInternalCommentsDataSource from '../datasources/postgres/ProposalInternalCommentsDataSource';
import PostgresProposalPdfTemplateDataSource from '../datasources/postgres/ProposalPdfTemplateDataSource';
import PostgresQuestionaryDataSource from '../datasources/postgres/QuestionaryDataSource';
import PostgresRedeemCodesDataSource from '../datasources/postgres/RedeemCodesDataSource';
import PostgresReviewDataSource from '../datasources/postgres/ReviewDataSource';
import PostgresRoleClaimDataSource from '../datasources/postgres/RoleClaimsDataSource';
import PostgresSampleDataSource from '../datasources/postgres/SampleDataSource';
Expand Down Expand Up @@ -98,7 +97,6 @@ mapClass(
);
mapClass(Tokens.StatusActionsDataSource, PostgresStatusActionsDataSource);
mapClass(Tokens.QuestionaryDataSource, PostgresQuestionaryDataSource);
mapClass(Tokens.RedeemCodesDataSource, PostgresRedeemCodesDataSource);
mapClass(Tokens.ReviewDataSource, PostgresReviewDataSource);
mapClass(Tokens.FapDataSource, PostgresFapDataSource);
mapClass(Tokens.SampleDataSource, PostgresSampleDataSource);
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/config/dependencyConfigE2E.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import PostgresProposalDataSource from '../datasources/postgres/ProposalDataSour
import PostgresProposalInternalCommentsDataSource from '../datasources/postgres/ProposalInternalCommentsDataSource';
import PostgresProposalPdfTemplateDataSource from '../datasources/postgres/ProposalPdfTemplateDataSource';
import PostgresQuestionaryDataSource from '../datasources/postgres/QuestionaryDataSource';
import PostgresRedeemCodesDataSource from '../datasources/postgres/RedeemCodesDataSource';
import PostgresReviewDataSource from '../datasources/postgres/ReviewDataSource';
import PostgresRoleClaimDataSource from '../datasources/postgres/RoleClaimsDataSource';
import PostgresSampleDataSource from '../datasources/postgres/SampleDataSource';
Expand Down Expand Up @@ -89,7 +88,6 @@ mapClass(
);
mapClass(Tokens.StatusActionsDataSource, PostgresStatusActionsDataSource);
mapClass(Tokens.QuestionaryDataSource, PostgresQuestionaryDataSource);
mapClass(Tokens.RedeemCodesDataSource, PostgresRedeemCodesDataSource);
mapClass(Tokens.ReviewDataSource, PostgresReviewDataSource);
mapClass(Tokens.FapDataSource, PostgresFapDataSource);
mapClass(Tokens.SampleDataSource, PostgresSampleDataSource);
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/config/dependencyConfigELI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import PostgresProposalDataSource from '../datasources/postgres/ProposalDataSour
import PostgresProposalInternalCommentsDataSource from '../datasources/postgres/ProposalInternalCommentsDataSource';
import PostgresProposalPdfTemplateDataSource from '../datasources/postgres/ProposalPdfTemplateDataSource';
import PostgresQuestionaryDataSource from '../datasources/postgres/QuestionaryDataSource';
import PostgresRedeemCodesDataSource from '../datasources/postgres/RedeemCodesDataSource';
import PostgresReviewDataSource from '../datasources/postgres/ReviewDataSource';
import PostgresRoleClaimDataSource from '../datasources/postgres/RoleClaimsDataSource';
import PostgresSampleDataSource from '../datasources/postgres/SampleDataSource';
Expand Down Expand Up @@ -90,7 +89,6 @@ mapClass(
);
mapClass(Tokens.StatusActionsDataSource, PostgresStatusActionsDataSource);
mapClass(Tokens.QuestionaryDataSource, PostgresQuestionaryDataSource);
mapClass(Tokens.RedeemCodesDataSource, PostgresRedeemCodesDataSource);
mapClass(Tokens.ReviewDataSource, PostgresReviewDataSource);
mapClass(Tokens.FapDataSource, PostgresFapDataSource);
mapClass(Tokens.SampleDataSource, PostgresSampleDataSource);
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/config/dependencyConfigESS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import PostgresProposalDataSource from '../datasources/postgres/ProposalDataSour
import PostgresProposalInternalCommentsDataSource from '../datasources/postgres/ProposalInternalCommentsDataSource';
import PostgresProposalPdfTemplateDataSource from '../datasources/postgres/ProposalPdfTemplateDataSource';
import PostgresQuestionaryDataSource from '../datasources/postgres/QuestionaryDataSource';
import PostgresRedeemCodesDataSource from '../datasources/postgres/RedeemCodesDataSource';
import PostgresReviewDataSource from '../datasources/postgres/ReviewDataSource';
import PostgresRoleClaimDataSource from '../datasources/postgres/RoleClaimsDataSource';
import PostgresSampleDataSource from '../datasources/postgres/SampleDataSource';
Expand Down Expand Up @@ -90,7 +89,6 @@ mapClass(
);
mapClass(Tokens.StatusActionsDataSource, PostgresStatusActionsDataSource);
mapClass(Tokens.QuestionaryDataSource, PostgresQuestionaryDataSource);
mapClass(Tokens.RedeemCodesDataSource, PostgresRedeemCodesDataSource);
mapClass(Tokens.ReviewDataSource, PostgresReviewDataSource);
mapClass(Tokens.FapDataSource, PostgresFapDataSource);
mapClass(Tokens.SampleDataSource, PostgresSampleDataSource);
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/config/dependencyConfigSTFC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import PostgresPredefinedMessageDataSource from '../datasources/postgres/Predefi
import PostgresProposalInternalCommentsDataSource from '../datasources/postgres/ProposalInternalCommentsDataSource';
import PostgresProposalPdfTemplateDataSource from '../datasources/postgres/ProposalPdfTemplateDataSource';
import PostgresQuestionaryDataSource from '../datasources/postgres/QuestionaryDataSource';
import PostgresRedeemCodesDataSource from '../datasources/postgres/RedeemCodesDataSource';
import PostgresReviewDataSource from '../datasources/postgres/ReviewDataSource';
import PostgresRoleClaimDataSource from '../datasources/postgres/RoleClaimsDataSource';
import PostgresSampleDataSource from '../datasources/postgres/SampleDataSource';
Expand Down Expand Up @@ -88,7 +87,6 @@ mapClass(
);
mapClass(Tokens.StatusActionsDataSource, PostgresStatusActionsDataSource);
mapClass(Tokens.QuestionaryDataSource, PostgresQuestionaryDataSource);
mapClass(Tokens.RedeemCodesDataSource, PostgresRedeemCodesDataSource);
mapClass(Tokens.ReviewDataSource, PostgresReviewDataSource);
mapClass(Tokens.FapDataSource, StfcFapDataSource);
mapClass(Tokens.SampleDataSource, PostgresSampleDataSource);
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/config/dependencyConfigTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { ProposalDataSourceMock } from '../datasources/mockups/ProposalDataSourc
import { PostgresProposalInternalCommentsDataSourceMock } from '../datasources/mockups/ProposalInternalCommentsDataSource';
import { ProposalPdfTemplateDataSourceMock } from '../datasources/mockups/ProposalPdfTemplateDataSource';
import { QuestionaryDataSourceMock } from '../datasources/mockups/QuestionaryDataSource';
import { RedeemDataSourceMock } from '../datasources/mockups/RedeemDataSource';
import { ReviewDataSourceMock } from '../datasources/mockups/ReviewDataSource';
import { RoleClaimDataSourceMock } from '../datasources/mockups/RoleClaimDataSource';
import { SampleDataSourceMock } from '../datasources/mockups/SampleDataSource';
Expand Down Expand Up @@ -86,7 +85,6 @@ mapClass(Tokens.StatusDataSource, StatusDataSourceMock);
mapClass(Tokens.ExperimentDataSource, ExperimentDataSourceMock);
mapClass(Tokens.StatusActionsDataSource, StatusActionsDataSourceMock);
mapClass(Tokens.QuestionaryDataSource, QuestionaryDataSourceMock);
mapClass(Tokens.RedeemCodesDataSource, RedeemDataSourceMock);
mapClass(Tokens.ReviewDataSource, ReviewDataSourceMock);
mapClass(Tokens.FapDataSource, FapDataSourceMock);
mapClass(Tokens.SampleDataSource, SampleDataSourceMock);
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import PredefinedMessageMutations from '../mutations/PredefinedMessageMutations'
import ProposalMutations from '../mutations/ProposalMutations';
import ProposalPdfTemplateMutations from '../mutations/ProposalPdfTemplateMutations';
import QuestionaryMutations from '../mutations/QuestionaryMutations';
import RedeemCodesMutations from '../mutations/RedeemCodesMutations';
import ReviewMutations from '../mutations/ReviewMutations';
import SampleMutations from '../mutations/SampleMutations';
import ShipmentMutations from '../mutations/ShipmentMutations';
Expand Down Expand Up @@ -115,7 +114,6 @@ interface ResolverContextMutations {
experimentSafetyPdfTemplate: ExperimentSafetyPdfTemplateMutations;
proposal: ProposalMutations;
questionary: QuestionaryMutations;
redeemCodes: RedeemCodesMutations;
review: ReviewMutations;
sample: SampleMutations;
fap: FapMutations;
Expand Down
18 changes: 0 additions & 18 deletions apps/backend/src/datasources/RedeemCodesDataSource.ts

This file was deleted.

10 changes: 1 addition & 9 deletions apps/backend/src/datasources/UserDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Institution } from '../models/Institution';
import { Role, Roles } from '../models/Role';
import { BasicUserDetails, User, UserRole } from '../models/User';
import { AddUserRoleArgs } from '../resolvers/mutations/AddUserRoleMutation';
import { CreateUserByEmailInviteArgs } from '../resolvers/mutations/CreateUserByEmailInviteMutation';
import {
UpdateUserByOidcSubArgs,
UpdateUserByIdArgs,
Expand All @@ -13,7 +12,6 @@ import { UsersArgs } from '../resolvers/queries/UsersQuery';
export interface UserDataSource {
delete(id: number): Promise<User | null>;
addUserRole(args: AddUserRoleArgs): Promise<boolean>;
createInviteUser(args: CreateUserByEmailInviteArgs): Promise<number>;
getBasicUserInfo(id: number): Promise<BasicUserDetails | null>;
getBasicUsersInfo(ids: readonly number[]): Promise<BasicUserDetails[]>;
getBasicUserDetailsByEmail(
Expand Down Expand Up @@ -61,18 +59,12 @@ export interface UserDataSource {
user_title: string | undefined,
firstname: string,
lastname: string,
username: string,
preferredname: string | undefined,
oidc_sub: string,
oauth_refreshtoken: string,
oauth_issuer: string,
gender: string,
birthdate: Date,
institution: number,
department: string,
position: string,
email: string,
telephone: string
email: string
): Promise<User>;
ensureDummyUserExists(userId: number): Promise<User>;
ensureDummyUsersExist(userIds: number[]): Promise<User[]>;
Expand Down
Loading
Loading