Skip to content

Commit 7d0e9e9

Browse files
committed
Fix initial data conflict handling
1 parent 21b13a6 commit 7d0e9e9

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

rfd-api-spec.json

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@
5757
}
5858
},
5959
"/api-user": {
60+
"get": {
61+
"summary": "List details for users",
62+
"operationId": "list_api_users",
63+
"responses": {
64+
"200": {
65+
"description": "successful operation",
66+
"content": {
67+
"application/json": {
68+
"schema": {
69+
"title": "Array_of_GetUserResponse_for_RfdPermission",
70+
"type": "array",
71+
"items": {
72+
"$ref": "#/components/schemas/GetUserResponse_for_RfdPermission"
73+
}
74+
}
75+
}
76+
}
77+
},
78+
"4XX": {
79+
"$ref": "#/components/responses/Error"
80+
},
81+
"5XX": {
82+
"$ref": "#/components/responses/Error"
83+
}
84+
}
85+
},
6086
"post": {
6187
"summary": "Create a new user",
6288
"operationId": "create_api_user",
@@ -3555,10 +3581,20 @@
35553581
"type": "object",
35563582
"properties": {
35573583
"client_id": {
3558-
"$ref": "#/components/schemas/TypedUuidForOAuthClientId"
3584+
"nullable": true,
3585+
"allOf": [
3586+
{
3587+
"$ref": "#/components/schemas/TypedUuidForOAuthClientId"
3588+
}
3589+
]
35593590
},
35603591
"client_secret": {
3561-
"$ref": "#/components/schemas/SecretString"
3592+
"nullable": true,
3593+
"allOf": [
3594+
{
3595+
"$ref": "#/components/schemas/SecretString"
3596+
}
3597+
]
35623598
},
35633599
"code": {
35643600
"type": "string"
@@ -3575,8 +3611,6 @@
35753611
}
35763612
},
35773613
"required": [
3578-
"client_id",
3579-
"client_secret",
35803614
"code",
35813615
"grant_type",
35823616
"redirect_uri"

rfd-api/src/initial_data.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,8 @@ fn handle_unique_violation_error(
125125
err: ResourceError<StoreError>,
126126
) -> Result<(), ResourceError<StoreError>> {
127127
match err {
128-
ResourceError::InternalError(StoreError::Db(DieselError::DatabaseError(
129-
DatabaseErrorKind::UniqueViolation,
130-
info,
131-
))) => {
132-
tracing::info!(?info, "Record already exists. Skipping.");
128+
ResourceError::Conflict => {
129+
tracing::info!("Record already exists. Skipping.");
133130
Ok(())
134131
}
135132
err => {

0 commit comments

Comments
 (0)