mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-09-30 20:43:12 +00:00
Restructure src/ to per-function layout with shared Layer
Move from flat src/ to per-function directories: - src/slack-bot/ — Slack Bolt Lambda handler - src/weekly-post/ — Monday schedule + pay post - src/roster-sync/ — Daily 3CX roster sync - src/shared/ — Lambda Layer with schedule, blocks, three_cx_client Each function has its own requirements.txt and CodeUri. Shared modules are deployed as a SAM Layer (afterhours-shared) importable as `from shared.X import Y`.
This commit is contained in:
parent
3de9243f6b
commit
0fed60248a
14 changed files with 40 additions and 15 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
|
@ -7,4 +7,4 @@ jobs:
|
|||
ci:
|
||||
uses: Sea-Haven-Industries/.github/.github/workflows/ci-python-sam.yaml@main
|
||||
with:
|
||||
source-dirs: "src"
|
||||
source-dirs: "src/slack-bot src/weekly-post src/roster-sync src/shared/python/shared"
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ from zoneinfo import ZoneInfo
|
|||
|
||||
import boto3
|
||||
|
||||
from src.three_cx_client import ThreeCXClient
|
||||
from src.schedule import ShiftSchedule
|
||||
from shared.three_cx_client import ThreeCXClient
|
||||
from shared.schedule import ShiftSchedule
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
2
src/roster-sync/requirements.txt
Normal file
2
src/roster-sync/requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
boto3>=1.43.6
|
||||
requests>=2.33.1
|
||||
2
src/shared/requirements.txt
Normal file
2
src/shared/requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
boto3>=1.43.6
|
||||
requests>=2.33.1
|
||||
|
|
@ -10,14 +10,14 @@ from zoneinfo import ZoneInfo
|
|||
import boto3
|
||||
from slack_bolt import App
|
||||
|
||||
from src.blocks import (
|
||||
from shared.blocks import (
|
||||
build_help_blocks,
|
||||
build_pay_summary_blocks,
|
||||
build_roster_blocks,
|
||||
build_shift_change_message,
|
||||
build_week_schedule,
|
||||
)
|
||||
from src.schedule import FALLBACK_EXTENSION, ShiftSchedule
|
||||
from shared.schedule import FALLBACK_EXTENSION, ShiftSchedule
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
EASTERN = ZoneInfo("America/New_York")
|
||||
|
|
@ -6,7 +6,7 @@ import os
|
|||
import boto3
|
||||
from slack_bolt.adapter.aws_lambda import SlackRequestHandler
|
||||
|
||||
from src.app import create_app
|
||||
from app import create_app
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
|
|
@ -1,3 +1,2 @@
|
|||
slack_bolt>=1.28.0,<2.0
|
||||
boto3>=1.43.6
|
||||
requests>=2.33.1
|
||||
|
|
@ -10,8 +10,8 @@ from zoneinfo import ZoneInfo
|
|||
import boto3
|
||||
from slack_sdk import WebClient
|
||||
|
||||
from src.blocks import build_pay_summary_blocks, build_week_schedule
|
||||
from src.schedule import FALLBACK_EXTENSION, ShiftSchedule
|
||||
from shared.blocks import build_pay_summary_blocks, build_week_schedule
|
||||
from shared.schedule import FALLBACK_EXTENSION, ShiftSchedule
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
2
src/weekly-post/requirements.txt
Normal file
2
src/weekly-post/requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
slack_sdk>=3.33.0,<4.0
|
||||
boto3>=1.43.6
|
||||
|
|
@ -20,6 +20,20 @@ Globals:
|
|||
- arm64
|
||||
|
||||
Resources:
|
||||
# --- Shared Lambda Layer ---
|
||||
SharedLayer:
|
||||
Type: AWS::Serverless::LayerVersion
|
||||
Properties:
|
||||
LayerName: afterhours-shared
|
||||
ContentUri: src/shared/
|
||||
CompatibleRuntimes:
|
||||
- python3.12
|
||||
CompatibleArchitectures:
|
||||
- arm64
|
||||
Metadata:
|
||||
BuildMethod: python3.12
|
||||
BuildArchitecture: arm64
|
||||
|
||||
# --- DynamoDB ---
|
||||
ShiftTable:
|
||||
Type: AWS::DynamoDB::Table
|
||||
|
|
@ -42,8 +56,10 @@ Resources:
|
|||
Type: AWS::Serverless::Function
|
||||
Properties:
|
||||
FunctionName: afterhours-shift-manager
|
||||
Handler: src/handler.handler
|
||||
CodeUri: .
|
||||
Handler: handler.handler
|
||||
CodeUri: src/slack-bot/
|
||||
Layers:
|
||||
- !Ref SharedLayer
|
||||
Environment:
|
||||
Variables:
|
||||
SHIFT_TABLE: !Ref ShiftTable
|
||||
|
|
@ -85,8 +101,10 @@ Resources:
|
|||
Type: AWS::Serverless::Function
|
||||
Properties:
|
||||
FunctionName: afterhours-weekly-post
|
||||
Handler: src/weekly_post.handler
|
||||
CodeUri: .
|
||||
Handler: app.handler
|
||||
CodeUri: src/weekly-post/
|
||||
Layers:
|
||||
- !Ref SharedLayer
|
||||
Environment:
|
||||
Variables:
|
||||
SHIFT_TABLE: !Ref ShiftTable
|
||||
|
|
@ -138,8 +156,10 @@ Resources:
|
|||
Type: AWS::Serverless::Function
|
||||
Properties:
|
||||
FunctionName: afterhours-roster-sync
|
||||
Handler: src/roster_sync.handler
|
||||
CodeUri: .
|
||||
Handler: app.handler
|
||||
CodeUri: src/roster-sync/
|
||||
Layers:
|
||||
- !Ref SharedLayer
|
||||
Timeout: 60
|
||||
Environment:
|
||||
Variables:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue