Skip to content

Commit

Permalink
Remove pronouns from member info
Browse files Browse the repository at this point in the history
  • Loading branch information
Litome committed Dec 13, 2024
1 parent f97c9aa commit 3e22972
Show file tree
Hide file tree
Showing 18 changed files with 2 additions and 165 deletions.
5 changes: 0 additions & 5 deletions scripts/populate-local-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,27 @@ event 'api/equipment/add-training-sheet' '{"equipmentId": "4224ee94-09b0-47d4-ae
# Ada Admin (superuser)
event 'api/members/create' '{"memberNumber": "1337", "email": "[email protected]"}'
event 'api/members/edit-name' '{"memberNumber": "1337", "name": "Ada Admin"}'
event 'api/members/edit-pronouns' '{"memberNumber": "1337", "pronouns": "she/her"}'
event 'api/super-users/declare' '{"memberNumber": "1337"}'

# Owen Owner (owner of metal shop area)
event 'api/members/create' '{"memberNumber": "4150", "email": "[email protected]"}'
event 'api/members/edit-name' '{"memberNumber": "4150", "name": "Owen Owner"}'
event 'api/members/edit-pronouns' '{"memberNumber": "4150", "pronouns": "he/him"}'
event 'api/areas/add-owner' '{"areaId": "eeaf7f8b-77a3-429d-ae9d-2f7ade53736e", "memberNumber": "4150"}'

# Treacle Trainer (Trainer for metal lathe)
event 'api/members/create' '{"memberNumber": "7777", "email": "[email protected]"}'
event 'api/members/edit-name' '{"memberNumber": "7777", "name": "Treacle Trainer"}'
event 'api/members/edit-pronouns' '{"memberNumber": "7777", "pronouns": "they/them"}'
event 'api/equipment/mark-member-trained' '{"equipmentId": "4224ee94-09b0-47d4-ae60-fac46b8ca93e", "memberNumber": "7777"}'
event 'api/equipment/add-trainer' '{"equipmentId": "4224ee94-09b0-47d4-ae60-fac46b8ca93e", "memberNumber": "7777"}'

# Lucy Lathe (Trained on Lathe)
event 'api/members/create' '{"memberNumber": "8888", "email": "[email protected]"}'
event 'api/members/edit-name' '{"memberNumber": "8888", "name": "Lucy Lathe"}'
event 'api/members/edit-pronouns' '{"memberNumber": "8888", "pronouns": "she/her"}'
event 'api/equipment/mark-member-trained' '{"equipmentId": "4224ee94-09b0-47d4-ae60-fac46b8ca93e", "memberNumber": "8888"}'

# Neon Newmember (has completed the lathe training sheet)
event 'api/members/create' '{"memberNumber": "9999", "email": "[email protected]"}'
event 'api/members/edit-name' '{"memberNumber": "9999", "name": "Neon Newmember"}'
event 'api/members/edit-pronouns' '{"memberNumber": "9999", "pronouns": "they/them"}'

# [email protected]
event 'api/members/create' '{"memberNumber": "1234", "email": "[email protected]"}'
1 change: 0 additions & 1 deletion src/commands/members/edit-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const process: Command<EditName>['process'] = input =>
constructEvent('MemberDetailsUpdated')({
memberNumber: input.command.memberNumber,
name: input.command.name,
pronouns: undefined,
})
);

Expand Down
64 changes: 0 additions & 64 deletions src/commands/members/edit-pronouns-form.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/commands/members/edit-pronouns.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/commands/members/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {editEmail} from './edit-email';
import {editName} from './edit-name';
import {editNameForm} from './edit-name-form';
import {editPronouns} from './edit-pronouns';
import {editPronounsForm} from './edit-pronouns-form';
import {signOwnerAgreement} from './sign-owner-agreement';
import {signOwnerAgreementForm} from './sign-owner-agreement-form';

Expand All @@ -14,10 +12,6 @@ export const members = {
editEmail: {
...editEmail,
},
editPronouns: {
...editPronouns,
...editPronounsForm,
},
signOwnerAgreement: {
...signOwnerAgreement,
...signOwnerAgreementForm,
Expand Down
12 changes: 0 additions & 12 deletions src/queries/me/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ const editName = (viewModel: ViewModel) =>
>Edit</a
>`;

const editPronouns = (viewModel: ViewModel) =>
html`<a href="/members/edit-pronouns?member=${viewModel.member.memberNumber}"
>Edit</a
>`;

const editAvatar = () =>
html`<a href="https://gravatar.com/profile">Edit via Gravatar</a>`;

Expand All @@ -35,13 +30,6 @@ const renderMemberDetails = (viewModel: ViewModel) => html`
<th scope="row">Name</th>
<td>${sanitizeOption(viewModel.member.name)} ${editName(viewModel)}</td>
</tr>
<tr>
<th scope="row">Pronouns</th>
<td>
${sanitizeOption(viewModel.member.pronouns)}
${editPronouns(viewModel)}
</td>
</tr>
<tr>
<th scope="row">Avatar</th>
<td>
Expand Down
12 changes: 0 additions & 12 deletions src/queries/member/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ const editName = (viewModel: ViewModel) =>
>Edit</a
>`;

const editPronouns = (viewModel: ViewModel) =>
html`<a href="/members/edit-pronouns?member=${viewModel.member.memberNumber}"
>Edit</a
>`;

const editAvatar = () =>
html`<a href="https://gravatar.com/profile">Edit via Gravatar</a>`;

Expand Down Expand Up @@ -53,13 +48,6 @@ export const render = (viewModel: ViewModel) => html`
${ifSelf(viewModel, editName(viewModel))}
</td>
</tr>
<tr>
<th scope="row">Pronouns</th>
<td>
${sanitizeOption(viewModel.member.pronouns)}
${ifSelf(viewModel, editPronouns(viewModel))}
</td>
</tr>
<tr>
<th scope="row">Avatar</th>
<td>
Expand Down
2 changes: 0 additions & 2 deletions src/queries/members/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const renderMembers = (viewModel: ViewModel) =>
</td>
<td>${renderMemberNumber(member.memberNumber)}</td>
<td>${sanitizeOption(member.name)}</td>
<td>${sanitizeOption(member.pronouns)}</td>
<td>${sanitizeString(member.emailAddress)}</td>
</tr>
`
Expand All @@ -39,7 +38,6 @@ const renderMembers = (viewModel: ViewModel) =>
<th></th>
<th>Member number</th>
<th>Name</th>
<th>Pronouns</th>
<th>Email</th>
</tr>
</thead>
Expand Down
1 change: 0 additions & 1 deletion src/read-models/members/return-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export type Member = {
emailAddress: EmailAddress;
prevEmails: ReadonlyArray<EmailAddress>;
name: O.Option<string>;
pronouns: O.Option<string>;
agreementSigned: O.Option<Date>;
isSuperUser: boolean;
gravatarHash: GravatarHash;
Expand Down
7 changes: 1 addition & 6 deletions src/read-models/shared-state/deprecated-replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const handleEvent = (
memberNumber: event.memberNumber,
emailAddress: event.email,
name: O.none,
pronouns: O.none,
agreementSigned: O.none,
isSuperUser: false,
prevEmails: [],
Expand All @@ -41,11 +40,7 @@ const handleEvent = (
if (current) {
const name =
event.name !== undefined ? O.fromNullable(event.name) : current.name;
const pronouns =
event.pronouns !== undefined
? O.fromNullable(event.pronouns)
: current.pronouns;
state.members.set(event.memberNumber, {...current, name, pronouns});
state.members.set(event.memberNumber, {...current, name});
}
}
if (isEventOfType('MemberEmailChanged')(event)) {
Expand Down
1 change: 0 additions & 1 deletion src/read-models/shared-state/return-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export type MemberCoreInfo = {
emailAddress: EmailAddress;
prevEmails: ReadonlyArray<EmailAddress>;
name: O.Option<string>;
pronouns: O.Option<string>;
agreementSigned: O.Option<Date>;
isSuperUser: boolean;
gravatarHash: GravatarHash;
Expand Down
5 changes: 0 additions & 5 deletions src/read-models/shared-state/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ export const membersTable = sqliteTable('members', {
emailAddress: text('emailAddress').notNull().$type<EmailAddress>(),
gravatarHash: text('gravatarHash').notNull().$type<GravatarHash>(),
name: blob('name', {mode: 'json'}).notNull().$type<O.Option<string>>(),
pronouns: blob('pronouns', {mode: 'json'})
.notNull()
.$type<O.Option<string>>(),
prevEmails: blob('prevEmails', {mode: 'json'})
.notNull()
.$type<ReadonlyArray<EmailAddress>>(),
Expand All @@ -29,7 +26,6 @@ const createMembersTable = sql`
emailAddress TEXT,
gravatarHash TEXT,
name BLOB,
pronouns BLOB,
prevEmails BLOB,
isSuperUser INTEGER,
agreementSigned INTEGER
Expand Down Expand Up @@ -178,7 +174,6 @@ type Member = {
emailAddress: EmailAddress;
prevEmails: ReadonlyArray<EmailAddress>;
name: O.Option<string>;
pronouns: O.Option<string>;
agreementSigned: O.Option<Date>;
isSuperUser: boolean;
gravatarHash: GravatarHash;
Expand Down
7 changes: 0 additions & 7 deletions src/read-models/shared-state/update-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const updateState =
emailAddress: event.email,
gravatarHash: gravatarHashFromEmail(event.email),
name: O.none,
pronouns: O.none,
prevEmails: [],
isSuperUser: false,
agreementSigned: undefined,
Expand All @@ -40,12 +39,6 @@ export const updateState =
.where(eq(membersTable.memberNumber, event.memberNumber))
.run();
}
if (event.pronouns) {
db.update(membersTable)
.set({pronouns: O.some(event.pronouns)})
.where(eq(membersTable.memberNumber, event.memberNumber))
.run();
}
break;
case 'MemberEmailChanged': {
const current = db
Expand Down
1 change: 0 additions & 1 deletion src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const initRoutes = (
query('/members', queries.members),
...command('members', 'create', commands.memberNumbers.linkNumberToEmail),
...command('members', 'edit-name', commands.members.editName),
...command('members', 'edit-pronouns', commands.members.editPronouns),
...command(
'members',
'sign-owner-agreement',
Expand Down
2 changes: 1 addition & 1 deletion src/templates/member-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const memberInputSelector = (member: Member): Html => html`
<label for="member-${member.memberNumber}">
${getGravatarThumbnail(member.gravatarHash, member.memberNumber)}
<span>
${sanitizeOption(member.name)} (${sanitizeOption(member.pronouns)})
(${sanitizeOption(member.name)})
(${sanitizeString(member.emailAddress)})
</span>
</label>
Expand Down
1 change: 0 additions & 1 deletion src/types/domain-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export const DomainEvent = t.union([
eventCodec('MemberDetailsUpdated', {
memberNumber: t.number,
name: t.union([t.string, t.undefined]),
pronouns: t.union([t.string, t.undefined]),
}),
eventCodec('OwnerAgreementSigned', {
memberNumber: t.number,
Expand Down
5 changes: 0 additions & 5 deletions tests/read-models/shared-state/get-member.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ describe('get-via-shared-read-model', () => {
memberNumber,
name: 'Ix',
});
await framework.commands.members.editPronouns({
memberNumber,
pronouns: 'he/him',
});
await framework.commands.members.editName({
memberNumber,
name: 'Ford Prefect',
Expand All @@ -87,7 +83,6 @@ describe('get-via-shared-read-model', () => {
it('returns latest details', () => {
const result = runQuery();
expect(result.name).toStrictEqual(O.some('Ford Prefect'));
expect(result.pronouns).toStrictEqual(O.some('he/him'));
});
});

Expand Down
1 change: 0 additions & 1 deletion tests/read-models/test-framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export const initTestFramework = async (
},
members: {
editName: frameworkify(commands.members.editName),
editPronouns: frameworkify(commands.members.editPronouns),
signOwnerAgreement: frameworkify(commands.members.signOwnerAgreement),
editEmail: frameworkify(commands.members.editEmail),
},
Expand Down

0 comments on commit 3e22972

Please sign in to comment.