Skip to content

Commit

Permalink
fix: 🐛 remove status in updateIncidentById api
Browse files Browse the repository at this point in the history
  • Loading branch information
yeukfei02 committed Jan 4, 2023
1 parent a92ddb2 commit 80c540a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 44 deletions.
3 changes: 1 addition & 2 deletions apps/api/src/incident/dto/updateIncidentById.dto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { IncidentType, Status } from '@prisma/client';
import { IncidentType } from '@prisma/client';

export class UpdateIncidentByIdDto {
title: string;
description: string;
incidentType: IncidentType;
status: Status;
}
2 changes: 0 additions & 2 deletions apps/api/src/incident/incident.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ export class IncidentRepository {
const title = updateIncidentByIdDto.title;
const description = updateIncidentByIdDto.description;
const incidentType = updateIncidentByIdDto.incidentType;
const status = updateIncidentByIdDto.status;

const incident = await this.prisma.incident.update({
where: {
Expand All @@ -279,7 +278,6 @@ export class IncidentRepository {
title: title,
description: description,
type: incidentType,
status: status,
},
include: {
creator: {
Expand Down
65 changes: 28 additions & 37 deletions apps/web/src/components/incidentDetail/IncidentDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ function IncidentDetail() {
setIncidentType(event.target.value as IncidentType);
};

const handleStatusChange = (event: SelectChangeEvent) => {
setStatus(event.target.value as Status);
};

const handleUpdateIncidentClick = async () => {
const token = localStorage.getItem('token');
if (token && incident) {
Expand All @@ -85,8 +81,7 @@ function IncidentDetail() {
incident.id,
title,
description,
incidentType,
status
incidentType
);
if (response) {
const responseData = response.data;
Expand Down Expand Up @@ -155,24 +150,18 @@ function IncidentDetail() {
</Select>
</FormControl>
</div>
<div className="mt-5">
<FormControl className="w-full">
<InputLabel id="demo-simple-select-helper-label">
Status
</InputLabel>
<Select
labelId="demo-simple-select-helper-label"
id="demo-simple-select-helper"
value={status}
label="Status"
onChange={handleStatusChange}
>
<MenuItem value={Status.UNASSIGNED}>Unassigned</MenuItem>
<MenuItem value={Status.ASSIGNED}>Assigned</MenuItem>
<MenuItem value={Status.ACKNOWLEDGED}>Acknowledged</MenuItem>
<MenuItem value={Status.RESOLVED}>Resolved</MenuItem>
</Select>
</FormControl>
<div className="mt-1">
<TextField
margin="normal"
fullWidth
id="status"
label="Status"
name="status"
type="text"
autoComplete="status"
value={status}
disabled
/>
</div>
<div className="mt-1">
<TextField
Expand All @@ -189,19 +178,21 @@ function IncidentDetail() {
disabled
/>
</div>
<TextField
margin="normal"
fullWidth
id="assignee"
label="Assignee"
name="assignee"
type="text"
autoComplete="assignee"
value={
incident && incident.assignee ? incident.assignee.name : ''
}
disabled
/>
<div className="mt-1">
<TextField
margin="normal"
fullWidth
id="assignee"
label="Assignee"
name="assignee"
type="text"
autoComplete="assignee"
value={
incident && incident.assignee ? incident.assignee.name : ''
}
disabled
/>
</div>
<Button
fullWidth
color="primary"
Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/services/incidentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,12 @@ export const updateIncidentById = async (
id: string,
title: string,
description: string,
incidentType: IncidentType,
status: Status
incidentType: IncidentType
) => {
const data = {
title: title,
description: description,
incidentType: incidentType,
status: status,
};

const response = await axios.patch(`${rootUrl}/incidents/${id}`, data, {
Expand Down

0 comments on commit 80c540a

Please sign in to comment.