projects layout
This commit is contained in:
@@ -1361,6 +1361,41 @@ export const resolveCurrentOrgForOwner = internalQuery({
|
||||
},
|
||||
});
|
||||
|
||||
export const listProviderAccounts = query({
|
||||
args: {},
|
||||
handler: async (ctx) => {
|
||||
const { organizationId } = await requireCurrentOrganization(ctx);
|
||||
const connections = await ctx.db
|
||||
.query("gitConnections")
|
||||
.withIndex("by_organizationId", (q) =>
|
||||
q.eq("organizationId", organizationId)
|
||||
)
|
||||
.collect();
|
||||
|
||||
const results = await Promise.all(
|
||||
connections.map(async (connection) => {
|
||||
const providerAccount = connection.gitProviderAccountId
|
||||
? await ctx.db.get(connection.gitProviderAccountId)
|
||||
: null;
|
||||
const externalUsername =
|
||||
providerAccount?.externalUsername ??
|
||||
connection.username ??
|
||||
"connected";
|
||||
|
||||
return {
|
||||
externalUsername,
|
||||
id: String(connection._id),
|
||||
provider: connection.provider,
|
||||
serverUrl: connection.serverUrl,
|
||||
status: connection.state ?? "active",
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
return results;
|
||||
},
|
||||
});
|
||||
|
||||
export const listRepositories = query({
|
||||
args: {},
|
||||
handler: async (ctx) => {
|
||||
|
||||
Reference in New Issue
Block a user