MCPcopy Create free account
hub / github.com/emwalker/digraph / create_github_user

Method create_github_user

backend/src/psql/user.rs:134–169  ·  view source on GitHub ↗
(&self, tx: &mut PgTransaction<'_>)

Source from the content-addressed store, hash-verified

132 }
133
134 async fn create_github_user(&self, tx: &mut PgTransaction<'_>) -> Result<Row> {
135 let row = sqlx::query_as::<_, Row>(
136 r#"insert into users
137 (name, avatar_url, primary_email, github_username, github_avatar_url)
138 values ($1, $2, $3, $4, $5)
139 returning id,
140 avatar_url,
141 name,
142 null as login,
143 null as selected_repository_id,
144 write_prefixes
145 "#,
146 )
147 .bind(&self.input.name)
148 .bind(&self.input.github_avatar_url)
149 .bind(&self.input.primary_email)
150 .bind(&self.input.github_username)
151 .bind(&self.input.github_avatar_url)
152 .fetch_one(&mut **tx)
153 .await?;
154
155 sqlx::query(
156 r#"insert into github_accounts
157 (avatar_url, name, primary_email, user_id, username)
158 values ($1, $2, $3, $4::uuid, $5)"#,
159 )
160 .bind(&self.input.name)
161 .bind(&self.input.github_avatar_url)
162 .bind(&self.input.primary_email)
163 .bind(row.id)
164 .bind(&self.input.github_username)
165 .execute(&mut **tx)
166 .await?;
167
168 Ok(row)
169 }
170}
171
172pub struct FetchAccountInfo {

Callers 1

callMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected