Skip to content

Commit

Permalink
Merge pull request #885 from jboolean/record-reviewer
Browse files Browse the repository at this point in the history
Record reviewer email
  • Loading branch information
jboolean authored Sep 16, 2023
2 parents b1c404e + e56f447 commit 1d42d4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/src/api/stories/StoriesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import {
} from './storyToApi';
import EmailCampaignService from '../../business/email/EmailCampaignService';
import normalizeEmail from '../../business/utils/normalizeEmail';
import { UserData as NetlifyUserData } from 'gotrue-js';
import required from '../../business/utils/required';

function updateModelFromRequest(
story: Story,
Expand Down Expand Up @@ -238,7 +240,8 @@ export class StoriesController extends Controller {
@Patch('/{id}/state')
public async updateStoryState(
@Path('id') id: number,
@Body() updates: { state: StoryState }
@Body() updates: { state: StoryState },
@Request() req: Express.Request & { user?: NetlifyUserData }
): Promise<AdminStoryResponse> {
let story = await StoryRepository().findOneBy({ id });

Expand All @@ -259,6 +262,7 @@ export class StoriesController extends Controller {
}

story.state = updates.state;
story.lastReviewer = required(req.user, 'user').email;

story = await StoryRepository().save(story);

Expand Down
3 changes: 3 additions & 0 deletions backend/src/entities/Story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,7 @@ export default class Story {

@Column()
hasEverSubmitted: boolean;

@Column()
lastReviewer!: string | null;
}

0 comments on commit 1d42d4d

Please sign in to comment.