feat(developers): create DeveloperApplication record on signup
All checks were successful
Build and Deploy / deploy (push) Successful in 42s
All checks were successful
Build and Deploy / deploy (push) Successful in 42s
After registering the user and creating the ticket, call the SilverDESK developer-program API to create a proper application record linking the user and ticket. This ensures applications appear in the /developer-program/applications dashboard. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,48 @@ public class DeveloperApplicationService
|
|||||||
return (true, "Your account has been created, but we had trouble submitting your application ticket. Please log in to SilverDESK and create a support ticket.", token);
|
return (true, "Your account has been created, but we had trouble submitting your application ticket. Please log in to SilverDESK and create a support ticket.", token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. Create DeveloperApplication record linking user + ticket
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var userId = authResult.GetProperty("user").GetProperty("id").GetString();
|
||||||
|
var ticketResult = await ticketResponse.Content.ReadFromJsonAsync<JsonElement>();
|
||||||
|
var ticketId = ticketResult.GetProperty("id").GetInt32();
|
||||||
|
|
||||||
|
var applicationPayload = new
|
||||||
|
{
|
||||||
|
userId,
|
||||||
|
ticketId,
|
||||||
|
fullName = application.FullName,
|
||||||
|
email = application.Email,
|
||||||
|
desiredUsername = application.DesiredUsername,
|
||||||
|
timezone = application.Timezone,
|
||||||
|
appliedRole = (int)application.Role,
|
||||||
|
platforms = application.Platforms,
|
||||||
|
skills = application.Skills ?? "",
|
||||||
|
motivation = application.Motivation,
|
||||||
|
status = 0, // Pending
|
||||||
|
silverDeskProvisioned = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var appResponse = await _httpClient.PostAsJsonAsync("/api/developer-program/applications", applicationPayload);
|
||||||
|
|
||||||
|
if (appResponse.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("DeveloperApplication record created for {Email}", application.Email);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var appError = await appResponse.Content.ReadAsStringAsync();
|
||||||
|
_logger.LogWarning("Failed to create DeveloperApplication record for {Email}: {StatusCode} - {Body}",
|
||||||
|
application.Email, appResponse.StatusCode, appError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Failed to create DeveloperApplication record for {Email} — user and ticket were created successfully",
|
||||||
|
application.Email);
|
||||||
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Developer application submitted for {Email} as {Role} — user registered and ticket created",
|
_logger.LogInformation("Developer application submitted for {Email} as {Role} — user registered and ticket created",
|
||||||
application.Email, application.Role);
|
application.Email, application.Role);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user