Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def env_list(name, default=None):
# See docs/03-platform/module-authoring-guide.md to add one.
DOMAIN_MODULES = [
"modules.placement",
"modules.elm",
]

INSTALLED_APPS = (DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
Expand Down
1 change: 1 addition & 0 deletions modules/elm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file is intentionally left empty
6 changes: 6 additions & 0 deletions modules/elm/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ElmConfig(AppConfig):
name = "modules.elm"
label = "elm"
126 changes: 126 additions & 0 deletions modules/elm/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Generated by Django 5.2.17 on 2026-10-05 10:46

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
("directory", "0002_userref_profile_completed_userref_resume_link"),
]

operations = [
migrations.CreateModel(
name="LeaveCategory",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("name", models.CharField(max_length=100)),
("description", models.TextField(blank=True)),
],
options={
"verbose_name_plural": "Leave Categories",
"db_table": "elm_leave_category",
},
),
migrations.CreateModel(
name="LeaveBalance",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("balance", models.IntegerField()),
(
"employee",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="leave_balances",
to="directory.userref",
),
),
(
"category",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="balances",
to="elm.leavecategory",
),
),
],
options={
"verbose_name_plural": "Leave Balances",
"db_table": "elm_leave_balance",
},
),
migrations.CreateModel(
name="LeaveApplication",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("start_date", models.DateField()),
("end_date", models.DateField()),
("reason", models.TextField()),
(
"status",
models.CharField(
choices=[
("pending", "Pending"),
("approved", "Approved"),
("rejected", "Rejected"),
],
default="pending",
max_length=20,
),
),
(
"employee",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="leave_applications",
to="directory.userref",
),
),
(
"category",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="applications",
to="elm.leavecategory",
),
),
],
options={
"verbose_name_plural": "Leave Applications",
"db_table": "elm_leave_application",
},
),
]
Empty file.
45 changes: 45 additions & 0 deletions modules/elm/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from django.db import models

from core.db.mixins import TimeStampedModel
from modules.directory.models import UserRef


class LeaveCategory(TimeStampedModel):
name = models.CharField(max_length=100)
description = models.TextField(blank=True)

class Meta:
db_table = "elm_leave_category"
verbose_name_plural = "Leave Categories"

def __str__(self) -> str:
return self.name


class LeaveApplication(TimeStampedModel):
employee = models.ForeignKey(UserRef, on_delete=models.CASCADE, related_name="leave_applications")
category = models.ForeignKey(LeaveCategory, on_delete=models.CASCADE, related_name="applications")
start_date = models.DateField()
end_date = models.DateField()
reason = models.TextField()
status = models.CharField(max_length=20, choices=[("pending", "Pending"), ("approved", "Approved"), ("rejected", "Rejected")], default="pending")

class Meta:
db_table = "elm_leave_application"
verbose_name_plural = "Leave Applications"

def __str__(self) -> str:
return f"{self.employee} - {self.category} - {self.status}"


class LeaveBalance(TimeStampedModel):
employee = models.ForeignKey(UserRef, on_delete=models.CASCADE, related_name="leave_balances")
category = models.ForeignKey(LeaveCategory, on_delete=models.CASCADE, related_name="balances")
balance = models.IntegerField()

class Meta:
db_table = "elm_leave_balance"
verbose_name_plural = "Leave Balances"

def __str__(self) -> str:
return f"{self.employee} - {self.category} - {self.balance}"