Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.3 #15

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: golangci/golangci-lint-action@v5
- uses: golangci/golangci-lint-action@v6
with:
version: latest
tests:
Expand Down
7 changes: 6 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,10 @@ func serve(ctx context.Context) error {
r.Mount("/bouncer", authorization.Router())

slog.Info("Listening on :8080")
return http.ListenAndServe(":8080", r)
err = http.ListenAndServe(":8080", r)
if err != nil {
slog.Error("Failed to start server", "reason", err.Error())
}

return err
}
14 changes: 14 additions & 0 deletions db/migrations/20240819195341_ery_extension_cascade.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- migrate:up
ALTER TABLE ery_extension DROP CONSTRAINT ery_extension_endpoint_id_fkey;

ALTER TABLE
ery_extension
ADD CONSTRAINT
ry_extension_endpoint_id_fkey
FOREIGN KEY
(endpoint_id)
REFERENCES
ps_endpoints(sid)
ON DELETE CASCADE;

-- migrate:down
117 changes: 105 additions & 12 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,27 @@ definitions:
type: integer
password:
type: string
realm:
transport:
type: string
type: object
handler.getEndpointResponse:
properties:
codecs:
items:
type: string
type: array
context:
type: string
displayName:
type: string
extension:
type: string
id:
type: string
maxContacts:
type: integer
sid:
type: integer
transport:
type: string
type: object
Expand All @@ -48,13 +67,38 @@ definitions:
type: string
id:
type: string
sid:
type: integer
type: object
handler.listEndpointsRequest:
handler.listEndpointsResponse:
properties:
endpoints:
items:
$ref: '#/definitions/handler.listEndpointEntry'
type: array
retrieved:
type: integer
total:
type: integer
type: object
handler.updateEndpointRequest:
properties:
codecs:
items:
type: string
type: array
context:
type: string
displayName:
type: string
extension:
type: string
maxContacts:
type: integer
password:
type: string
transport:
type: string
type: object
host: localhost:8080
info:
Expand Down Expand Up @@ -92,18 +136,23 @@ paths:
/endpoints:
get:
parameters:
- default: 15
description: Limit the amount of endpoints returned
- default: 0
description: Zero based page to fetch
in: query
name: limit
name: page
type: integer
- default: 10
description: Max amount of results to be returned
in: query
name: pageSize
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.listEndpointsRequest'
$ref: '#/definitions/handler.listEndpointsResponse'
"400":
description: Bad Request
"500":
Expand All @@ -122,23 +171,25 @@ paths:
schema:
$ref: '#/definitions/handler.createEndpointRequest'
responses:
"204":
description: No Content
"201":
description: Created
schema:
$ref: '#/definitions/handler.getEndpointResponse'
"400":
description: Bad Request
"500":
description: Internal Server Error
summary: Create a new endpoint.
tags:
- endpoints
/endpoints/{id}:
/endpoints/{sid}:
delete:
parameters:
- description: ID of the endpoint to be deleted
- description: Sid of the endpoint to be deleted
in: path
name: id
name: sid
required: true
type: string
type: integer
responses:
"204":
description: No Content
Expand All @@ -149,4 +200,46 @@ paths:
summary: Delete an endpoint and its associated resources.
tags:
- endpoints
get:
parameters:
- description: Requested endpoint's sid
in: path
name: sid
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.getEndpointResponse'
"400":
description: Bad Request
"500":
description: Internal Server Error
summary: Get information from a specific endpoint.
tags:
- endpoints
patch:
parameters:
- description: Sid of the endpoint to be updated
in: path
name: sid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.updateEndpointRequest'
"400":
description: Bad Request
"404":
description: Not Found
"500":
description: Internal Server Error
summary: Update the specified endpoint. Omitted or null fields will remain unchanged.
tags:
- endpoints
swagger: "2.0"
Loading
Loading