1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-12-05 10:42:14 +03:00

Database refactoring

This commit is contained in:
Quentin Gliech
2022-10-21 11:25:38 +02:00
parent 0571c36da9
commit e2142f9cd4
79 changed files with 3070 additions and 3833 deletions

View File

@@ -12,8 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use chrono::Utc;
use mas_data_model::Session;
use sqlx::PgExecutor;
use uuid::Uuid;
use crate::PostgresqlBackend;
@@ -27,13 +29,15 @@ pub async fn end_oauth_session(
executor: impl PgExecutor<'_>,
session: Session<PostgresqlBackend>,
) -> anyhow::Result<()> {
let finished_at = Utc::now();
let res = sqlx::query!(
r#"
UPDATE oauth2_sessions
SET ended_at = NOW()
WHERE id = $1
SET finished_at = $2
WHERE oauth2_session_id = $1
"#,
session.data,
Uuid::from(session.data),
finished_at,
)
.execute(executor)
.await?;