forked from spothero/eng-mgr-take-home-challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from navreddy23/springboot_setup
api contract specification setup
- Loading branch information
Showing
14 changed files
with
274 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,8 @@ mvnw.cmd | |
target/ | ||
HELP.md | ||
.idea/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
/out/ | ||
/src/generated/ |
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
21 changes: 20 additions & 1 deletion
21
src/main/java/com/manager/takehome/challenge/SpotHeroApplication.java
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 |
---|---|---|
@@ -1,12 +1,31 @@ | ||
package com.manager.takehome.challenge; | ||
|
||
import com.manager.takehome.challenge.config.AppConfigurations; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class SpotHeroApplication { | ||
|
||
@Autowired | ||
private AppConfigurations appConfig; | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SpotHeroApplication.class, args); | ||
SpringApplication.run(SpotHeroApplication.class); | ||
} | ||
|
||
/** | ||
* method to display app configs. | ||
*/ | ||
public void run(String... args) throws Exception { | ||
System.out.println("using environment:" + appConfig.getEnvironment()); | ||
System.out.println("using server port:" + appConfig.getServerPort()); | ||
System.out.println("using management port:" + appConfig.getManagementServerPort()); | ||
System.out.println("using management server address:" + appConfig.getManagementServerAddress()); | ||
System.out.println("using spring profile:" + appConfig.getSpringProfile()); | ||
System.out.println("using context path port: " + appConfig.getContextPath()); | ||
} | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/com/manager/takehome/challenge/controller/BaseController.java
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
2 changes: 1 addition & 1 deletion
2
...r/takehome/challenge/model/BaseModel.java → .../takehome/challenge/models/BaseModel.java
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
20 changes: 20 additions & 0 deletions
20
src/main/resources/api_contract_schema_specs/v1/active_users_retrieval_response.json
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,20 @@ | ||
{ | ||
"type": "object", | ||
"description": "Response Schema for returning all ACTIVE users", | ||
"title": "ActiveUsersResponse", | ||
"additionalProperties": false, | ||
"properties": { | ||
"activeUsers": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "user.json" | ||
} | ||
}, | ||
"error": { | ||
"type": "object", | ||
"$ref": "error.json" | ||
} | ||
}, | ||
"required": [], | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/resources/api_contract_schema_specs/v1/error.json
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,18 @@ | ||
{ | ||
"type": "object", | ||
"description": "Schema for Errors", | ||
"title": "Error", | ||
"additionalProperties": false, | ||
"properties": { | ||
"errorCode": { | ||
"type": "integer", | ||
"description": "Error Code" | ||
}, | ||
"errorMessage": { | ||
"type": "string", | ||
"description": "Error Message" | ||
} | ||
}, | ||
"required": [], | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} |
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,31 @@ | ||
{ | ||
"type": "object", | ||
"description": "Schema describing user properties", | ||
"title": "User", | ||
"additionalProperties": false, | ||
"properties": { | ||
"managerId": { | ||
"type": "integer", | ||
"description": "Id number of the" | ||
}, | ||
"firstName": { | ||
"type": "string", | ||
"description": "first name of the user" | ||
}, | ||
"lastName": { | ||
"type": "string", | ||
"description": "last name of the user" | ||
}, | ||
"email": { | ||
"type": "string", | ||
"description": "email address of the user" | ||
} | ||
}, | ||
"required": [ | ||
"firstName", | ||
"lastName", | ||
"email", | ||
"isActive" | ||
], | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/resources/api_contract_schema_specs/v1/worked_hours_postage_request.json
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,23 @@ | ||
{ | ||
"type": "object", | ||
"description": "Request schema to post new worked hours", | ||
"title": "WorkedHoursRequest", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"description": "Id number of the" | ||
}, | ||
"date": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "date on which hours were recorded" | ||
}, | ||
"hours": { | ||
"type": "number", | ||
"description": "first name of the user" | ||
} | ||
}, | ||
"required": ["id", "date", "hours"], | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/resources/api_contract_schema_specs/v1/worked_hours_postage_response.json
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,22 @@ | ||
{ | ||
"type": "object", | ||
"description": "Response schema after posting new worked hours", | ||
"title": "WorkedHoursPostageResponse", | ||
"additionalProperties": false, | ||
"properties": { | ||
"postageSuccess": { | ||
"type": "boolean", | ||
"description": "were the hours posted successfully? true or false" | ||
}, | ||
"message": { | ||
"type": "string", | ||
"description": "verbose message" | ||
}, | ||
"error": { | ||
"type": "object", | ||
"$ref": "error.json" | ||
} | ||
}, | ||
"required": [], | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/resources/api_contract_schema_specs/v1/worked_hours_retrieval_response.json
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,27 @@ | ||
{ | ||
"type": "object", | ||
"description": "Response schema for returning details about all the hours worked by a user", | ||
"title": "WorkedHoursResponse", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"description": "Id number of the" | ||
}, | ||
"date": { | ||
"type": "string", | ||
"format": "date-time", | ||
"description": "date on which hours were recorded" | ||
}, | ||
"hours": { | ||
"type": "number", | ||
"description": "first name of the user" | ||
}, | ||
"error": { | ||
"type": "object", | ||
"$ref": "error.json" | ||
} | ||
}, | ||
"required": [], | ||
"$schema": "http://json-schema.org/draft-06/schema#" | ||
} |
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.