-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Officer Table Overhaul (In Progress) - Adding tests for Officer API endpoints - Creating association objects for: - Accusation (Officer/Perpetrator) - Employment (Officer/Agency) * Officer Model Updates * Add additional officer endpoints and tests - Get officer by id - Get all officers - Create officer * Style Corrections * Officer search error fix
- Loading branch information
Showing
13 changed files
with
963 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from .. import db | ||
|
||
|
||
class Accusation(db.Model): | ||
id = db.Column(db.Integer, primary_key=True) | ||
perpetrator_id = db.Column(db.Integer, db.ForeignKey("perpetrator.id")) | ||
officer_id = db.Column(db.Integer, db.ForeignKey("officer.id")) | ||
user_id = db.Column(db.Integer, db.ForeignKey("user.id")) | ||
date_created = db.Column(db.Text) | ||
basis = db.Column(db.Text) | ||
|
||
attachments = db.relationship("Attachment", backref="accusation") | ||
perpetrator = db.relationship("Perpetrator", back_populates="suspects") | ||
officer = db.relationship("Officer", back_populates="accusations") | ||
|
||
def __repr__(self): | ||
return f"<Employment {self.id}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import enum | ||
from .. import db | ||
|
||
|
||
class Rank(str, enum.Enum): | ||
# TODO: Is this comprehensive? | ||
TECHNICIAN = "TECHNICIAN" | ||
OFFICER = "OFFICER" | ||
DETECTIVE = "DETECTIVE" | ||
CORPORAL = "CORPORAL" | ||
SERGEANT = "SERGEANT" | ||
LIEUTENANT = "LIEUTENANT" | ||
CAPTAIN = "CAPTAIN" | ||
DEPUTY = "DEPUTY" | ||
CHIEF = "CHIEF" | ||
COMMISSIONER = "COMMISSIONER" | ||
|
||
|
||
class Employment(db.Model): | ||
id = db.Column(db.Integer, primary_key=True) | ||
officer_id = db.Column(db.Integer, db.ForeignKey("officer.id")) | ||
agency_id = db.Column(db.Integer, db.ForeignKey("agency.id")) | ||
earliest_employment = db.Column(db.Text) | ||
latest_employment = db.Column(db.Text) | ||
badge_number = db.Column(db.Text) | ||
unit = db.Column(db.Text) | ||
highest_rank = db.Column(db.Enum(Rank)) | ||
currently_employed = db.Column(db.Boolean) | ||
|
||
officer = db.relationship("Officer", back_populates="known_employers") | ||
agency = db.relationship("Agency", back_populates="known_officers") | ||
|
||
def __repr__(self): | ||
return f"<Employment {self.id}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.