Skip to content

Commit

Permalink
Merge pull request #193 from qccoders/immutable-checkin
Browse files Browse the repository at this point in the history
Implement immutable Check In Service
  • Loading branch information
wburklund authored Sep 23, 2018
2 parents a5fac98 + 6370b38 commit 75b5c7a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
10 changes: 10 additions & 0 deletions api/QCVOC.Api/Services/Data/Repository/ServiceRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ INSERT INTO services (
/// <param name="id">The id of the Service to delete.</param>
public void Delete(Guid id)
{
if (id == Guid.Empty)
{
throw new InvalidOperationException("The Check In Service may not be deleted.");
}

var builder = new SqlBuilder();

var query = builder.AddTemplate(@"
Expand Down Expand Up @@ -189,6 +194,11 @@ LIMIT @limit OFFSET @offset
/// <returns>The updated Service.</returns>
public Service Update(Service service)
{
if (service.Id == Guid.Empty)
{
throw new InvalidOperationException("The Check In Service may not be modified.");
}

var builder = new SqlBuilder();

var query = builder.AddTemplate(@"
Expand Down
2 changes: 1 addition & 1 deletion web/src/events/Events.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const styles = {
zIndex: 1000
},
card: {
minHeight: 220,
minHeight: 272,
maxWidth: 800,
margin: 'auto',
},
Expand Down
2 changes: 1 addition & 1 deletion web/src/services/ServiceDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class ServiceDialog extends Component {
<DialogTitle>{(intent === 'add' ? 'Create' : 'Update')} Service</DialogTitle>
<DialogContent>
<TextField
autofocus
autoFocus
id="name"
label="Name"
value={name}
Expand Down
21 changes: 18 additions & 3 deletions web/src/services/ServiceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
import React from 'react';
import PropTypes from 'prop-types';

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

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

return (
<List>
{services.map(s =>
{userDefined && userDefined.length > 0 && <ListSubheader>User Defined</ListSubheader>}
{userDefined.map(s =>
<ListItem
key={s.id}
button
Expand All @@ -28,6 +31,18 @@ const ServiceList = (props) => {
/>
</ListItem>
)}
<ListSubheader>System Defined</ListSubheader>
{systemDefined.map(s =>
<ListItem key={s.id}>
<ListItemIcon>
<Work/>
</ListItemIcon>
<ListItemText
primary={s.name}
secondary={s.description}
/>
</ListItem>
)}
</List>
);
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/services/Services.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const styles = {
right: 0,
marginLeft: 'auto',
marginRight: 'auto',
marginTop: 83,
marginTop: 72,
},
};

Expand Down

0 comments on commit 75b5c7a

Please sign in to comment.