Skip to content

Commit

Permalink
Merge pull request #217 from qccoders/develop
Browse files Browse the repository at this point in the history
Initial Scanner implementation
  • Loading branch information
wburklund authored Oct 2, 2018
2 parents 261e8ab + 9795cbe commit 0721e28
Show file tree
Hide file tree
Showing 19 changed files with 390 additions and 188 deletions.
26 changes: 20 additions & 6 deletions web/CONTRIBUTING.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ This project is maintained for free and for a non profit organization, and we re

## Contribution Workflow

1. Assign yourself to the issue that you'll be working on. If there's no issue, your pull request is likely
to be rejected until one is created and prioritized. Move the issue into the 'In progress' column on the project
board, if you have the necessary access.
1. Assign yourself to the issue that you'll be working on. Move the issue into the 'In progress' column on the project
board, if you have the necessary access. If there's no issue associated with the work you'd like to do, your pull request is likely
to be rejected until one is created and prioritized.
2. Clone the repository and `git checkout develop` to ensure you are on the development branch.
3. Create a new branch for your change with `git checkout -b <your-branch-name>` be descriptive, but terse.
4. Make your changes. When finished, push your branch with `git push origin --set-upstream <your-branch-name>`.
Expand Down Expand Up @@ -48,16 +48,30 @@ You're free to use whichever development tools you prefer. If you don't yet hav
## Debugging
### Front End

Front debugging is most easily expressed as a series of console commands, executed from the root folder of the repository:
Front end debugging is most easily expressed as a series of console commands, executed from the root folder of the repository:

```
cd web
npm install
npm start
```

On Windows, a browser should open and should navigate to the application. By default the development back end will be used for debugging.
On Windows, a browser should open and should navigate to the application. By default the development environment will be used for debugging.

### Back End

TBD
To debug the back end locally, you'll need to create the environment variable `QCVOC_DbConnectionString` and set it to the connection string for the development database. Visit us on Slack to discuss this.

Open the project in the 'api' folder in Visual Studio. On the toolbar, click the drop-down button next to 'IIS Express' and select 'QCVOC.Api' from the resulting list. This will tell Visual Studio to debug using the dotnet console command. Click the debug (green arrow) button to start debugging. A console should appear, displaying the following:

```
Hosting environment: Development
Content root path: C:\Users\JP.WHATNET\source\QCVOC\api\QCVOC.Api
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
```

Open a browser and navigate to http://localhost:5000/swagger to interact with the api via Swagger UI.

Expand the `/security/login` POST operation and execute it, providing your credentials. Copy the `accessToken` value from the result, then click on the green 'Authorize' button near the top of the screen to set your session authorization. Enter `Bearer <accessToken>` into the box and click Login. All future requests will be authenticated using this token.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# QCVOC
# Quad Cities Veteran Outreach Center

[![Build Status](https://travis-ci.org/qccoders/QCVOC.svg?branch=master)](https://travis-ci.org/qccoders/QCVOC/branches)
![license](https://img.shields.io/github/license/qccoders/QCVOC.svg)

Quad Cities Veteran Outreach Center
An event management application for the Quad Cities Veteran's Outreach Center.

Written in .NET Core, React, and Java, and hosted on AWS with RDS (PostgreSQL), Lambda, API Gateway, and S3.

## About Us

This project is developed and maintained by [QC Coders](http://www.qccoders.org/), a group of software enthusiasts from the [Quad Cities](https://en.wikipedia.org/wiki/Quad_Cities), a region on the border of Iowa and Illinois.

We get together for networking, presentations, and group projects several times a month; have a look at [our website]((http://www.qccoders.org/)) for a calendar of events, or find us on [Meetup](https://www.meetup.com/QCCoders/) or [Facebook](https://www.facebook.com/qccoders). We can also be found on Slack, which you can join via the invite link near the bottom of our site.

## Contributing

If you'd like to help with this project, join us on Slack and have a look at [CONTRIBUTING.md](https://github.com/qccoders/QCVOC/blob/develop/CONTRIBUTING.md) for some important notes about the nature of your contribution and an overview of our workflow and environment.
4 changes: 2 additions & 2 deletions api/QCVOC.Api/Events/Data/Repository/EventRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ LIMIT @limit OFFSET @offset
var dates = new { start = eventFilters.DateStart, end = eventFilters.DateEnd };

builder
.Where("e.startdate BETWEEN @start AND @end", dates)
.OrWhere("e.startdate BETWEEN @start AND @end", dates)
.OrWhere("e.enddate BETWEEN @start AND @end", dates)
.OrWhere("(e.startdate < @start AND e.enddate > @end)", dates);
.OrWhere("e.startdate < @start AND e.enddate > @end", dates);
}
}

Expand Down
2 changes: 1 addition & 1 deletion api/QCVOC.Api/Scans/Controller/ScansController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public IActionResult GetAll([FromQuery]ScanFilters filters)
/// <response code="403">The Veteran has not checked in for the Event.</response>
/// <response code="404">The specified Veteran, Event or Service was invalid.</response>
/// <response code="500">The server encountered an error while processing the request.</response>
[HttpPost("")]
[HttpPut("")]
[Authorize]
[ProducesResponseType(typeof(Scan), 200)]
[ProducesResponseType(typeof(Scan), 201)]
Expand Down
5 changes: 5 additions & 0 deletions api/QCVOC.Api/Scans/Data/Model/Scan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public class Scan : IEquatable<Scan>
/// </summary>
public Guid VeteranId { get; set; }

/// <summary>
/// Gets or sets the full name of the Veteran.
/// </summary>
public string Veteran { get; set; }

/// <summary>
/// Gets or sets the id of the Service.
/// </summary>
Expand Down
7 changes: 5 additions & 2 deletions api/QCVOC.Api/Scans/Data/Repository/ScanRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ public IEnumerable<Scan> GetAll(Filters filters = null)
s.plusone,
s.scandate,
s.scanbyid,
a.name AS scanby
a.name AS scanby,
v.firstname || ' ' || v.lastname AS veteran
FROM scans s
LEFT JOIN accounts a ON s.scanbyid = a.id
INNER JOIN veterans v ON s.veteranid = v.id
/**where**/
ORDER BY s.scandate {filters.OrderBy.ToString()}
LIMIT @limit OFFSET @offset
Expand All @@ -160,7 +162,8 @@ LIMIT @limit OFFSET @offset
.ApplyFilter(FilterType.Equals, "s.eventid", scanFilters.EventId)
.ApplyFilter(FilterType.Equals, "s.veteranid", scanFilters.VeteranId)
.ApplyFilter(FilterType.Equals, "s.serviceid", scanFilters.ServiceId)
.ApplyFilter(FilterType.Equals, "s.plusone", scanFilters.PlusOne);
.ApplyFilter(FilterType.Equals, "s.plusone", scanFilters.PlusOne)
.ApplyFilter(FilterType.Equals, "v.firstname || ' ' || v.lastname", scanFilters.Veteran);
}

using (var db = ConnectionFactory.CreateConnection())
Expand Down
5 changes: 5 additions & 0 deletions api/QCVOC.Api/Scans/ScanFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public class ScanFilters : Filters
/// </summary>
public Guid? VeteranId { get; set; }

/// <summary>
/// The full name of the Veteran.
/// </summary>
public string Veteran { get; set; }

/// <summary>
/// The id of the Service.
/// </summary>
Expand Down
34 changes: 2 additions & 32 deletions api/QCVOC.Api/Security/AccountFilters.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <copyright file="AccountFilters.cs" company="JP Dillingham, Nick Acosta, et. al.">
// Copyright (c) JP Dillingham, Nick Acosta, et. al.. All rights reserved. Licensed under the GPLv3 license. See LICENSE file
// <copyright file="AccountFilters.cs" company="QC Coders (JP Dillingham, Nick Acosta, et. al.)">
// Copyright (c) QC Coders (JP Dillingham, Nick Acosta, et. al.). All rights reserved. Licensed under the GPLv3 license. See LICENSE file
// in the project root for full license information.
// </copyright>

Expand Down Expand Up @@ -34,35 +34,5 @@ public class AccountFilters : Filters
/// The Role by which to filter results.
/// </summary>
public Role? Role { get; set; }

/// <summary>
/// The starting time of the Account creation date range.
/// </summary>
public DateTime? CreationDateStart { get; set; }

/// <summary>
/// The ending time of the Account creation date range.
/// </summary>
public DateTime? CreationDateEnd { get; set; }

/// <summary>
/// The id of the user which created the Account.
/// </summary>
public Guid? CreationById { get; set; }

/// <summary>
/// The starting time of a last updated date range.
/// </summary>
public DateTime? LastUpdateDateStart { get; set; }

/// <summary>
/// The ending time of a last updated date range.
/// </summary>
public DateTime? LastUpdateDateEnd { get; set; }

/// <summary>
/// The id of the user which performed the last update.
/// </summary>
public Guid? LastUpdateById { get; set; }
}
}
6 changes: 1 addition & 5 deletions api/QCVOC.Api/Security/Data/Repository/AccountRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,7 @@ LIMIT @limit OFFSET @offset
.ApplyFilter(FilterType.Equals, "a1.id", accountFilters.Id)
.ApplyFilter(FilterType.Equals, "a1.name", accountFilters.Name)
.ApplyFilter(FilterType.Equals, "a1.passwordresetrequired", accountFilters.PasswordResetRequired)
.ApplyFilter(FilterType.Equals, "a1.role", accountFilters.Role?.ToString())
.ApplyFilter(FilterType.Between, "a1.creationdate", accountFilters.CreationDateStart, accountFilters.CreationDateEnd)
.ApplyFilter(FilterType.Equals, "a1.creationbyid", accountFilters.CreationById)
.ApplyFilter(FilterType.Between, "a1.lastupdatedate", accountFilters.LastUpdateDateStart, accountFilters.LastUpdateDateEnd)
.ApplyFilter(FilterType.Equals, "a1.lastupdatebyid", accountFilters.LastUpdateById);
.ApplyFilter(FilterType.Equals, "a1.role", accountFilters.Role?.ToString());
}

using (var db = ConnectionFactory.CreateConnection())
Expand Down
8 changes: 1 addition & 7 deletions api/QCVOC.Api/Services/Data/Repository/ServiceRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,7 @@ LIMIT @limit OFFSET @offset
builder
.ApplyFilter(FilterType.Equals, "s.id", serviceFilters.Id)
.ApplyFilter(FilterType.Equals, "s.name", serviceFilters.Name)
.ApplyFilter(FilterType.Equals, "s.description", serviceFilters.Description)
.ApplyFilter(FilterType.Equals, "creationby", serviceFilters.CreationBy)
.ApplyFilter(FilterType.Equals, "creationbyid", serviceFilters.CreationById)
.ApplyFilter(FilterType.Between, "creationdate", serviceFilters.CreationDateStart, serviceFilters.CreationDateEnd)
.ApplyFilter(FilterType.Equals, "lastupdateby", serviceFilters.LastUpdateBy)
.ApplyFilter(FilterType.Equals, "lastupdatebyid", serviceFilters.LastUpdateById)
.ApplyFilter(FilterType.Between, "lastupdatedate", serviceFilters.LastUpdateDateStart, serviceFilters.LastUpdateDateEnd);
.ApplyFilter(FilterType.Equals, "s.description", serviceFilters.Description);
}

using (var db = ConnectionFactory.CreateConnection())
Expand Down
40 changes: 0 additions & 40 deletions api/QCVOC.Api/Services/ServiceFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,5 @@ public class ServiceFilters : Filters
/// The description of the service.
/// </summary>
public string Description { get; set; }

/// <summary>
/// The name of the user who created the service.
/// </summary>
public string CreationBy { get; set; }

/// <summary>
/// The id of the user who created the service.
/// </summary>
public Guid? CreationById { get; set; }

/// <summary>
/// The starting time of a creation date range.
/// </summary>
public DateTime? CreationDateStart { get; set; }

/// <summary>
/// The ending time of a creation date range.
/// </summary>
public DateTime? CreationDateEnd { get; set; }

/// <summary>
/// The name of the user who last updated the service.
/// </summary>
public string LastUpdateBy { get; set; }

/// <summary>
/// The id of the user who last updated the service.
/// </summary>
public Guid? LastUpdateById { get; set; }

/// <summary>
/// The starting date of a last updated date range.
/// </summary>
public DateTime? LastUpdateDateStart { get; set; }

/// <summary>
/// The ending date of a last updated date range.
/// </summary>
public DateTime? LastUpdateDateEnd { get; set; }
}
}
7 changes: 0 additions & 7 deletions api/QCVOC.Api/Veterans/Data/Repository/VeteranRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,9 @@ LIMIT @limit OFFSET @offset
builder
.ApplyFilter(FilterType.Equals, "v.address", veteranFilters.Address)
.ApplyFilter(FilterType.Equals, "v.email", veteranFilters.Email)
.ApplyFilter(FilterType.Between, "v.enrollmentdate", veteranFilters.EnrollmentDateStart, veteranFilters.EnrollmentDateEnd)
.ApplyFilter(FilterType.Equals, "v.enrollmentbyid", veteranFilters.EnrollmentById)
.ApplyFilter(FilterType.Equals, "enrollmentby", veteranFilters.EnrollmentBy)
.ApplyFilter(FilterType.Equals, "v.firstname", veteranFilters.FirstName)
.ApplyFilter(FilterType.Equals, "v.id", veteranFilters.Id)
.ApplyFilter(FilterType.Equals, "v.lastname", veteranFilters.LastName)
.ApplyFilter(FilterType.Between, "v.lastupdatedate", veteranFilters.LastUpdateDateStart, veteranFilters.LastUpdateDateEnd)
.ApplyFilter(FilterType.Equals, "a.name", veteranFilters.LastUpdateBy)
.ApplyFilter(FilterType.Equals, "v.lastupdatebyid", veteranFilters.LastUpdateById)
.ApplyFilter(FilterType.Equals, "lastupdateby", veteranFilters.LastUpdateBy)
.ApplyFilter(FilterType.Equals, "v.cardnumber", veteranFilters.CardNumber)
.ApplyFilter(FilterType.Equals, "v.primaryphone", veteranFilters.PrimaryPhone)
.ApplyFilter(FilterType.In, "v.verificationmethod", veteranFilters.VerificationMethod?.ToString());
Expand Down
40 changes: 0 additions & 40 deletions api/QCVOC.Api/Veterans/VeteranFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,6 @@ public class VeteranFilters : Filters
/// </summary>
public string Email { get; set; }

/// <summary>
/// Gets the name of the user which enrolled the Veteran.
/// </summary>
public string EnrollmentBy { get; }

/// <summary>
/// The id of the user which enrolled the Veteran.
/// </summary>
public string EnrollmentById { get; set; }

/// <summary>
/// The starting time of an enrollment date range.
/// </summary>
public DateTime? EnrollmentDateStart { get; set; }

/// <summary>
/// The ending time of an enrollment date range.
/// </summary>
public DateTime? EnrollmentDateEnd { get; set; }

/// <summary>
/// The first name of the Veteran.
/// </summary>
Expand All @@ -60,26 +40,6 @@ public class VeteranFilters : Filters
/// </summary>
public string LastName { get; set; }

/// <summary>
/// The starting time of a last updated date range.
/// </summary>
public DateTime? LastUpdateDateStart { get; set; }

/// <summary>
/// The ending time of a last updated date range.
/// </summary>
public DateTime? LastUpdateDateEnd { get; set; }

/// <summary>
/// The name of the user which performed the last update.
/// </summary>
public string LastUpdateBy { get; set; }

/// <summary>
/// The id of the user which performed the last update.
/// </summary>
public Guid? LastUpdateById { get; set; }

/// <summary>
/// The number of the card presently assigned to the Veteran.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions web/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Services from '../services/Services';
import Events from '../events/Events';
import LoginForm from '../security/LoginForm';
import LinkList from './LinkList';
import Scanner from '../scans/Scanner';
import { CircularProgress, ListSubheader } from '@material-ui/core';
import { getEnvironment } from '../util';

Expand Down Expand Up @@ -167,6 +168,7 @@ class App extends Component {
<Route path='/veterans' component={Veterans}/>
<Route path='/services' component={Services}/>
<Route path='/events' component={Events}/>
<Route path='/scanner' component={Scanner}/>
</Switch>
</div> :
<LoginForm onLogin={this.handleLogin}/>
Expand Down
4 changes: 2 additions & 2 deletions web/src/events/EventList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const EventList = (props) => {

return (
<List>
{events.sort(sortByProp('startDate')).map(e =>
{events.sort(sortByProp('startDate')).map((e, index) =>
<ListItem
key={e.id}
key={index}
button={onItemClick !== undefined && userCanView() }
onClick={onItemClick !== undefined && userCanView() ? () => onItemClick(e) : () => {}}
>
Expand Down
22 changes: 22 additions & 0 deletions web/src/mobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Copyright (c) QC Coders. All rights reserved. Licensed under the GPLv3 license. See LICENSE file
in the project root for full license information.
*/

export const isMobileAttached = () => {
return isAndroidAttached();
}

export const isAndroidAttached = () => {
return window["Android"] !== undefined;
}

export const initiateMobileScan = () => {
if (isAndroidAttached()) {
initiateAndroidScan();
}
}

export const initiateAndroidScan = () => {
window["Android"]["scanBarcode"]();
}
Loading

0 comments on commit 0721e28

Please sign in to comment.