Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Kolego
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Onboarding
AlekSIS-App-Kolego
Commits
debd14e2
Commit
debd14e2
authored
1 year ago
by
magicfelix
Browse files
Options
Downloads
Patches
Plain Diff
Add graphql schema for absence and reason
parent
ab9a0fdc
No related branches found
No related tags found
1 merge request
!7
Resolve "Implement Absence model based on FreeBusy"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/kolego/schema/__init__.py
+28
-0
28 additions, 0 deletions
aleksis/apps/kolego/schema/__init__.py
aleksis/apps/kolego/schema/absence.py
+93
-0
93 additions, 0 deletions
aleksis/apps/kolego/schema/absence.py
with
121 additions
and
0 deletions
aleksis/apps/kolego/schema/__init__.py
+
28
−
0
View file @
debd14e2
...
@@ -2,9 +2,37 @@ from django.apps import apps
...
@@ -2,9 +2,37 @@ from django.apps import apps
import
graphene
import
graphene
from
aleksis.core.schema.base
import
DjangoFilterMixin
,
FilterOrderList
from
.absence
import
(
AbsenceType
,
AbsenceCreateMutation
,
AbsenceBatchCreateMutation
,
AbsenceDeleteMutation
,
AbsenceBatchPatchMutation
,
AbsenceReasonType
,
AbsenceReasonCreateMutation
,
AbsenceReasonBatchCreateMutation
,
AbsenceReasonDeleteMutation
,
AbsenceReasonBatchPatchMutation
)
class
Query
(
graphene
.
ObjectType
):
class
Query
(
graphene
.
ObjectType
):
app_name
=
graphene
.
String
()
app_name
=
graphene
.
String
()
absences
=
FilterOrderList
(
AbsenceType
)
absence_reasons
=
FilterOrderList
(
AbsenceReasonType
)
def
resolve_app_name
(
root
,
info
,
**
kwargs
)
->
str
:
def
resolve_app_name
(
root
,
info
,
**
kwargs
)
->
str
:
return
apps
.
get_app_config
(
"
kolego
"
).
verbose_name
return
apps
.
get_app_config
(
"
kolego
"
).
verbose_name
class
Mutation
(
graphene
.
ObjectType
):
create_absence
=
AbsenceCreateMutation
.
Field
()
create_absences
=
AbsenceBatchCreateMutation
.
Field
()
delete_absence
=
AbsenceDeleteMutation
.
Field
()
update_absences
=
AbsenceBatchPatchMutation
.
Field
()
create_absence_reason
=
AbsenceReasonCreateMutation
.
Field
()
create_absence_reasons
=
AbsenceReasonBatchCreateMutation
.
Field
()
delete_absence_reason
=
AbsenceReasonDeleteMutation
.
Field
()
update_absence_reasons
=
AbsenceReasonBatchPatchMutation
.
Field
()
This diff is collapsed.
Click to expand it.
aleksis/apps/kolego/schema/absence.py
0 → 100644
+
93
−
0
View file @
debd14e2
import
graphene
from
graphene_django
import
DjangoListField
from
graphene_django.types
import
DjangoObjectType
from
graphene_django_cud.mutations
import
(
DjangoBatchCreateMutation
,
DjangoBatchPatchMutation
,
DjangoCreateMutation
,
)
from
guardian.shortcuts
import
get_objects_for_user
from
aleksis.core.schema.base
import
(
DeleteMutation
,
DjangoFilterMixin
,
PermissionBatchPatchMixin
,
PermissionsTypeMixin
,
)
from
..models
import
Absence
,
AbsenceReason
class
AbsenceReasonType
(
PermissionsTypeMixin
,
DjangoFilterMixin
,
DjangoObjectType
):
class
Meta
:
model
=
AbsenceReason
fields
=
(
"
id
"
,
"
short_name
"
,
"
name
"
)
filter_fields
=
{
"
short_name
"
:
[
"
icontains
"
,
"
exact
"
],
"
name
"
:
[
"
icontains
"
,
"
exact
"
],
}
class
AbsenceType
(
PermissionsTypeMixin
,
DjangoFilterMixin
,
DjangoObjectType
):
class
Meta
:
model
=
Absence
fields
=
(
"
id
"
,
"
person
"
,
"
reason
"
,
"
comment
"
,
"
datetime_start
"
,
"
datetime_end
"
,
"
date_start
"
,
"
date_end
"
)
filter_fields
=
{
"
person__full_name
"
:
[
"
icontains
"
,
"
exact
"
],
"
comment
"
:
[
"
icontains
"
,
"
exact
"
],
}
class
AbsenceCreateMutation
(
DjangoCreateMutation
):
class
Meta
:
model
=
Absence
fields
=
(
"
person
"
,
"
reason
"
,
"
comment
"
,
"
datetime_start
"
,
"
datetime_end
"
,
"
date_start
"
,
"
date_end
"
)
optional_fields
=
(
"
comment
"
,
"
reason
"
,
"
datetime_start
"
,
"
datetime_end
"
,
"
date_start
"
,
"
date_end
"
)
permissions
=
(
""
,)
# FIXME
class
AbsenceBatchCreateMutation
(
DjangoBatchCreateMutation
):
class
Meta
:
model
=
Absence
fields
=
(
"
id
"
,
"
person
"
,
"
reason
"
,
"
comment
"
,
"
datetime_start
"
,
"
datetime_end
"
,
"
date_start
"
,
"
date_end
"
)
permissions
=
(
""
,)
# FIXME
class
AbsenceDeleteMutation
(
DeleteMutation
):
klass
=
Absence
permission_required
=
""
# FIXME
class
AbsenceBatchPatchMutation
(
PermissionBatchPatchMixin
,
DjangoBatchPatchMutation
):
class
Meta
:
model
=
Absence
fields
=
(
"
id
"
,
"
person
"
,
"
reason
"
,
"
comment
"
,
"
datetime_start
"
,
"
datetime_end
"
,
"
date_start
"
,
"
date_end
"
)
permissions
=
(
""
,)
# FIXME
class
AbsenceReasonCreateMutation
(
DjangoCreateMutation
):
class
Meta
:
model
=
AbsenceReason
fields
=
(
"
short_name
"
,
"
name
"
)
optional_fields
=
(
"
name
"
,)
permissions
=
(
""
,)
# FIXME
class
AbsenceReasonBatchCreateMutation
(
DjangoBatchCreateMutation
):
class
Meta
:
model
=
AbsenceReason
fields
=
(
"
short_name
"
,
"
name
"
)
optional_fields
=
(
"
name
"
,)
permissions
=
(
""
,)
# FIXME
class
AbsenceReasonDeleteMutation
(
DeleteMutation
):
klass
=
AbsenceReason
permission_required
=
""
# FIXME
class
AbsenceReasonBatchPatchMutation
(
PermissionBatchPatchMixin
,
DjangoBatchPatchMutation
):
class
Meta
:
model
=
AbsenceReason
fields
=
(
"
id
"
,
"
short_name
"
,
"
name
"
)
permissions
=
(
""
,)
# FIXME
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment