Skip to content

Commit 75b5c7a

Browse files
authored
Merge pull request #193 from qccoders/immutable-checkin
Implement immutable Check In Service
2 parents a5fac98 + 6370b38 commit 75b5c7a

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

api/QCVOC.Api/Services/Data/Repository/ServiceRepository.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ INSERT INTO services (
8888
/// <param name="id">The id of the Service to delete.</param>
8989
public void Delete(Guid id)
9090
{
91+
if (id == Guid.Empty)
92+
{
93+
throw new InvalidOperationException("The Check In Service may not be deleted.");
94+
}
95+
9196
var builder = new SqlBuilder();
9297

9398
var query = builder.AddTemplate(@"
@@ -189,6 +194,11 @@ LIMIT @limit OFFSET @offset
189194
/// <returns>The updated Service.</returns>
190195
public Service Update(Service service)
191196
{
197+
if (service.Id == Guid.Empty)
198+
{
199+
throw new InvalidOperationException("The Check In Service may not be modified.");
200+
}
201+
192202
var builder = new SqlBuilder();
193203

194204
var query = builder.AddTemplate(@"

web/src/events/Events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const styles = {
2727
zIndex: 1000
2828
},
2929
card: {
30-
minHeight: 220,
30+
minHeight: 272,
3131
maxWidth: 800,
3232
margin: 'auto',
3333
},

web/src/services/ServiceDialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class ServiceDialog extends Component {
209209
<DialogTitle>{(intent === 'add' ? 'Create' : 'Update')} Service</DialogTitle>
210210
<DialogContent>
211211
<TextField
212-
autofocus
212+
autoFocus
213213
id="name"
214214
label="Name"
215215
value={name}

web/src/services/ServiceList.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
import React from 'react';
66
import PropTypes from 'prop-types';
77

8-
import { List, ListItem, ListItemIcon, ListItemText } from '@material-ui/core';
9-
import { Shop } from '@material-ui/icons'
8+
import { List, ListItem, ListItemIcon, ListItemText, ListSubheader } from '@material-ui/core';
9+
import { Shop, Work } from '@material-ui/icons'
1010

1111
const ServiceList = (props) => {
1212
let { services, onItemClick } = props;
13+
let userDefined = services.filter(s => s.id !== '00000000-0000-0000-0000-000000000000');
14+
let systemDefined = services.filter(s => s.id === '00000000-0000-0000-0000-000000000000');
1315

1416
return (
1517
<List>
16-
{services.map(s =>
18+
{userDefined && userDefined.length > 0 && <ListSubheader>User Defined</ListSubheader>}
19+
{userDefined.map(s =>
1720
<ListItem
1821
key={s.id}
1922
button
@@ -28,6 +31,18 @@ const ServiceList = (props) => {
2831
/>
2932
</ListItem>
3033
)}
34+
<ListSubheader>System Defined</ListSubheader>
35+
{systemDefined.map(s =>
36+
<ListItem key={s.id}>
37+
<ListItemIcon>
38+
<Work/>
39+
</ListItemIcon>
40+
<ListItemText
41+
primary={s.name}
42+
secondary={s.description}
43+
/>
44+
</ListItem>
45+
)}
3146
</List>
3247
);
3348
}

web/src/services/Services.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const styles = {
3838
right: 0,
3939
marginLeft: 'auto',
4040
marginRight: 'auto',
41-
marginTop: 83,
41+
marginTop: 72,
4242
},
4343
};
4444

0 commit comments

Comments
 (0)