add missing file
This commit is contained in:
@@ -40,7 +40,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
|
|
||||||
started_at: datetime = fromisoformat(new_image['started_at']) # type: ignore
|
started_at: datetime = fromisoformat(new_image['started_at']) # type: ignore
|
||||||
completed_at: datetime = fromisoformat(new_image['completed_at']) # type: ignore
|
completed_at: datetime = fromisoformat(new_image['completed_at']) # type: ignore
|
||||||
# The certificate may not expire
|
# Certificate may have no expiration
|
||||||
cert_expires_at = (
|
cert_expires_at = (
|
||||||
completed_at + timedelta(days=int(cert['exp_interval']))
|
completed_at + timedelta(days=int(cert['exp_interval']))
|
||||||
if 'exp_interval' in cert
|
if 'exp_interval' in cert
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ from enrollment import LinkedEntity, enroll
|
|||||||
from schemas import Course, Enrollment, User
|
from schemas import Course, Enrollment, User
|
||||||
|
|
||||||
logger = Logger(__name__)
|
logger = Logger(__name__)
|
||||||
enrollment_layer = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||||
|
|
||||||
|
|
||||||
@event_source(data_class=EventBridgeEvent)
|
@event_source(data_class=EventBridgeEvent)
|
||||||
@logger.inject_lambda_context
|
@logger.inject_lambda_context
|
||||||
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||||
new_image = event.detail['new_image']
|
new_image = event.detail['new_image']
|
||||||
metadata = enrollment_layer.collection.get_items(
|
metadata = dyn.collection.get_items(
|
||||||
TransactKey(new_image['id'])
|
TransactKey(new_image['id'])
|
||||||
+ SortKey('METADATA#SUBSCRIPTION_COVERED', rename_key='subscription')
|
+ SortKey('METADATA#SUBSCRIPTION_COVERED', rename_key='subscription')
|
||||||
+ SortKey('METADATA#COURSE', rename_key='course')
|
+ SortKey('METADATA#COURSE', rename_key='course')
|
||||||
@@ -52,5 +52,5 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
subscription=subscription,
|
subscription=subscription,
|
||||||
deduplication_window={'offset_days': metadata['dedup_window_offset_days']},
|
deduplication_window={'offset_days': metadata['dedup_window_offset_days']},
|
||||||
linked_entities=frozenset({LinkedEntity(new_image['id'], 'ENROLLMENT')}),
|
linked_entities=frozenset({LinkedEntity(new_image['id'], 'ENROLLMENT')}),
|
||||||
persistence_layer=enrollment_layer,
|
persistence_layer=dyn,
|
||||||
)
|
)
|
||||||
|
|||||||
30
id.saladeaula.digital/client/app/routes/upstream.ts
Normal file
30
id.saladeaula.digital/client/app/routes/upstream.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import type { Route } from './+types'
|
||||||
|
|
||||||
|
export async function action({ request, context }: Route.ActionArgs) {
|
||||||
|
const url = new URL(request.url)
|
||||||
|
const issuerUrl = new URL(url.pathname, context.cloudflare.env.ISSUER_URL)
|
||||||
|
const r = await fetch(issuerUrl.toString(), {
|
||||||
|
method: request.method,
|
||||||
|
headers: request.headers,
|
||||||
|
body: await request.text()
|
||||||
|
})
|
||||||
|
|
||||||
|
return new Response(await r.text(), {
|
||||||
|
status: r.status,
|
||||||
|
headers: r.headers
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function loader({ request, context }: Route.ActionArgs) {
|
||||||
|
const url = new URL(request.url)
|
||||||
|
const issuerUrl = new URL(url.pathname, context.cloudflare.env.ISSUER_URL)
|
||||||
|
const r = await fetch(issuerUrl.toString(), {
|
||||||
|
method: request.method,
|
||||||
|
headers: request.headers
|
||||||
|
})
|
||||||
|
|
||||||
|
return new Response(await r.text(), {
|
||||||
|
status: r.status,
|
||||||
|
headers: r.headers
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user