This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NextAuth, {Profile} from "next-auth"; | |
import ZitadelProvider from "next-auth/providers/zitadel"; | |
import {CallbacksOptions} from "next-auth/src/core/types"; | |
const ZITADEL_PROJECT_ID = process.env.ZITADEL_PROJECT_ID!; | |
type ProjectURN = string; | |
type AllProjectsURN = 'urn:zitadel:iam:org:project:roles'; | |
type RoleKey = string; | |
type OrganizationId = string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iter_chunks(iter: Iterator[T], size: int) -> Iterator[Iterable[T]]: | |
"""Create chunks of given size out of an iterator""" | |
chunk: list[T] = [] | |
for idx, elem in enumerate(iter): | |
chunk.append(elem) | |
if idx + 1 % size == 0: | |
yield chunk | |
chunk = [] | |
if chunk: | |
yield chunk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections.abc | |
class TypeFilteredDictView(collections.abc.MappingView): | |
def __init__(self, d, value_type): | |
self._d = d | |
self._value_type = value_type | |
def __getitem__(self, key): | |
return self._d[key] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine | |
from sqlalchemy.ext.automap import automap_base | |
from sqlalchemy.orm import Session | |
from openapi_core import create_spec | |
from openapi_core.schema.schemas.models import Schema | |
from openapi_core.shortcuts import RequestBody, Response | |
# Connect to the SQL database | |
engine = create_engine("postgresql://user:password@host/dbname") | |
Base = automap_base() |