Skip to content

Commit

Permalink
Merge pull request #255 from USACE/chore/add-project-attributes
Browse files Browse the repository at this point in the history
Add project attributes
  • Loading branch information
dennisgsmith authored Feb 20, 2025
2 parents 001e779 + f415282 commit 68ac45e
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 99 deletions.
24 changes: 17 additions & 7 deletions api/internal/db/batch.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 23 additions & 12 deletions api/internal/db/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 59 additions & 14 deletions api/internal/db/project.sql_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions api/internal/dto/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import (
)

type ProjectDTO struct {
ID uuid.UUID `json:"-"`
Name string `json:"name"`
FederalID *string `json:"federal_id" required:"false"`
DistrictID *uuid.UUID `json:"district_id" required:"false"`
ID uuid.UUID `json:"-"`
Name string `json:"name"`
FederalID *string `json:"federal_id" required:"false"`
DistrictID uuid.UUID `json:"district_id" required:"false"`
LeveeSegmentID *string `json:"levee_segment_id" required:"false"`
BridgeID *string `json:"bridge_id" required:"false"`
Watershed *string `json:"watershed" required:"false"`
TzName *string `json:"tz_name" required:"false"`
Metadata *string `json:"metadata" required:"false"`
AuditInfo
}
22 changes: 19 additions & 3 deletions api/internal/handler/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const districtSchema = `{
"initials": { "type": "string" },
"division_name": { "type": "string" },
"division_initials": { "type": "string" },
"office_id": { "type": ["string", "null"] }
"office_id": { "type": ["string", "null"] },
"instrument_count": { "type": "number" }
},
"additionalProperties": false
}`
Expand All @@ -40,6 +41,11 @@ const projectSchema = `{
"district_id": { "type": [ "string", "null"] },
"slug": { "type": "string" },
"name": { "type": "string" },
"bridge_id": { "type": ["string", "null"] },
"levee_segment_id": { "type": ["string", "null"] },
"watershed": { "type": ["string", "null"] },
"tz_name": { "type": ["string", "null"] },
"metadata": { "type": ["string", "null"] },
"created_by": { "type": "string" },
"created_by_username": { "type": "string" },
"created_at": { "type": "string", "format": "date-time" },
Expand Down Expand Up @@ -84,7 +90,12 @@ const createProjectBulkBody = `[{
},
{
"name": "Test Project 100001",
"federal_id": null
"federal_id": null,
"levee_segment_id": "ABC123",
"bridge_id": "DEF456",
"watershed": "Test Watershed",
"tz_name": "UTC",
"metadata": "test metadata"
},
{
"name": "Test Project 100002",
Expand All @@ -93,7 +104,12 @@ const createProjectBulkBody = `[{

const updateProjectBody = `{
"federal_id": null,
"name": "Blue Water Reservoir"
"name": "Blue Water Reservoir",
"levee_segment_id": "UPDATED_ID",
"bridge_id": "UPDATED_ID",
"watershed": "Test Update Watershed",
"tz_name": "EST",
"metadata": "test update metadata"
}`

func TestProjects(t *testing.T) {
Expand Down
Loading

0 comments on commit 68ac45e

Please sign in to comment.