inserted_id as_object_id first before to_string

This commit is contained in:
mbecker20
2024-01-07 15:57:34 -08:00
parent f0baa7496f
commit 61f7efaa85
11 changed files with 34 additions and 0 deletions

View File

@@ -50,6 +50,8 @@ impl Resolve<CreateAlerter, RequestUser> for State {
.await
.context("failed to add alerter to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let alerter: Alerter = self.get_resource(&alerter_id).await?;
@@ -112,6 +114,8 @@ impl Resolve<CopyAlerter, RequestUser> for State {
.await
.context("failed to add alerter to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let alerter: Alerter = self.get_resource(&alerter_id).await?;

View File

@@ -60,6 +60,8 @@ impl Resolve<CreateBuild, RequestUser> for State {
.await
.context("failed to add build to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let build: Build = self.get_resource(&build_id).await?;
@@ -125,6 +127,8 @@ impl Resolve<CopyBuild, RequestUser> for State {
.await
.context("failed to add build to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let build: Build = self.get_resource(&build_id).await?;

View File

@@ -46,6 +46,8 @@ impl Resolve<CreateBuilder, RequestUser> for State {
.await
.context("failed to add builder to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let builder: Builder = self.get_resource(&builder_id).await?;
let update = Update {
@@ -112,6 +114,8 @@ impl Resolve<CopyBuilder, RequestUser> for State {
.await
.context("failed to add builder to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let builder: Builder = self.get_resource(&builder_id).await?;
let update = Update {

View File

@@ -72,6 +72,8 @@ impl Resolve<CreateDeployment, RequestUser> for State {
.await
.context("failed to add deployment to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let deployment: Deployment =
self.get_resource(&deployment_id).await?;
@@ -153,6 +155,8 @@ impl Resolve<CopyDeployment, RequestUser> for State {
.await
.context("failed to add deployment to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let deployment: Deployment =
self.get_resource(&deployment_id).await?;

View File

@@ -47,6 +47,8 @@ impl Resolve<CreateProcedure, RequestUser> for State {
.await
.context("failed to add procedure to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let procedure: Procedure =
self.get_resource(&procedure_id).await?;
@@ -113,6 +115,8 @@ impl Resolve<CopyProcedure, RequestUser> for State {
.await
.context("failed to add build to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let procedure: Procedure =
self.get_resource(&procedure_id).await?;

View File

@@ -63,6 +63,8 @@ impl Resolve<CreateRepo, RequestUser> for State {
.await
.context("failed to add repo to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let repo: Repo = self.get_resource(&repo_id).await?;
@@ -154,6 +156,8 @@ impl Resolve<CopyRepo, RequestUser> for State {
.await
.context("failed to add repo to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let repo: Repo = self.get_resource(&repo_id).await?;
let update = Update {

View File

@@ -54,6 +54,8 @@ impl Resolve<CreateServer, RequestUser> for State {
.await
.context("failed to add server to db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let server: Server = self.get_resource(&server_id).await?;
let update = Update {

View File

@@ -37,6 +37,8 @@ impl Resolve<CreateTag, RequestUser> for State {
.await
.context("failed to create tag on db")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
Ok(tag)
}

View File

@@ -87,6 +87,8 @@ async fn callback(
.await
.context("failed to create user on mongo")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
state
.jwt

View File

@@ -111,6 +111,8 @@ async fn callback(
.await
.context("failed to create user on mongo")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
state
.jwt

View File

@@ -52,6 +52,8 @@ impl Resolve<CreateLocalUser> for State {
.await
.context("failed to create user")?
.inserted_id
.as_object_id()
.context("inserted_id is not ObjectId")?
.to_string();
let jwt = self