This is the starter-code for our rails take-home assessment. This project includes the following data models:
Model | Description |
---|---|
User |
Users using the platform |
NatureCode |
Categories describing the nature of a 911 call |
Chatroom |
Chatrooms where users can send messages back and forth |
ChatMessage |
Chat messages sent into chatrooms |
This project has also been set up with GraphQL.
-
All requests will go through the
POST /graphql
route -
You can test the graphql operations by visiting
/graphiql
. You can use tools like GraphiQL or Postman, orcURL
User authentication is handled by passing the user's email in the X-Email
request header.
For this take-home assignment, you'll be asked to do the following:
Create the following GraphQL operations:
-
createChatroom($label: String!, $natureCodeId: ID)
- Creates a new
Chatroom
with a label and optionally aNatureCode
- Creates a new
-
updateChatroom($id: ID!, $label: String, $natureCodeId: ID)
- Updates an existing
Chatroom
's label and/orNatureCode
- Updates an existing
-
resolveChatroom($id: ID!)
- Sets an existing
Chatroom
'sresolved
flag totrue
- Sets an existing
createChatMessage($chatroomId: ID!, message: String!, $authorId: ID!)
- Creates a
ChatMessage
in an existingChatroom
with amessage
and aUser
as theauthor
- Creates a
chatMessages($search: String, $authorId: ID)
- Searches for
ChatMessage
s where themessage
contains the value of$search
, and where the author matches the given$authorId
- Searches for
Create a model, or a set of models, that represent an audit trail. These new models should allow us to:
-
Include timestamps for actions performed
-
See all GraphQL queries performed, including the
User
and the query variables -
See all GraphQL mutations performed, including the
User
and the mutation variables
It is up to you to decide how those models are created and how the audit trail will be populated.
auditTrail($userId: ID)
- Returns all actions tracked through the audit trail, optionally filtered by the given
$userId
- Returns all actions tracked through the audit trail, optionally filtered by the given