Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Sistem Informasi Zakat
Sizakat 5.0 (Refactoring)
Sizakat Backend
Commits
3d06c0ac
Commit
3d06c0ac
authored
Aug 06, 2020
by
addffa
Browse files
[GREEN] implementasi query transaction
parent
90b2dfea
Changes
5
Hide whitespace changes
Inline
Side-by-side
sizakat/schema.py
View file @
3d06c0ac
...
...
@@ -8,13 +8,14 @@ from .mustahik.mutations import (
DataSourcePekerjaMutation
,
DeleteDataSource
)
from
.mustahik.query
import
MustahikQuery
from
.transaction.query
import
TransactionQuery
ABOUT
=
(
'Si Zakat merupakan sistem informasi untuk membantu masjid dalam '
'mengelola transaksi zakat. Sistem ini dibuat oleh tim lab 1231, '
'yang dipimpin oleh Prof. Dr. Wisnu Jatmiko.'
)
class
Query
(
MustahikQuery
,
graphene
.
ObjectType
):
class
Query
(
MustahikQuery
,
TransactionQuery
,
graphene
.
ObjectType
):
about
=
graphene
.
String
()
def
resolve_about
(
self
,
info
):
...
...
sizakat/transaction/admin.py
View file @
3d06c0ac
from
django.contrib
import
admin
# Register your models here.
from
.models
import
ZakatType
admin
.
site
.
register
([
ZakatType
])
sizakat/transaction/models.py
View file @
3d06c0ac
...
...
@@ -27,6 +27,9 @@ class ZakatType(models.Model):
name
=
models
.
CharField
(
max_length
=
50
)
item_type
=
models
.
CharField
(
max_length
=
32
,
choices
=
ItemType
.
choices
)
def
__str__
(
self
):
return
'%s - %s'
%
(
self
.
name
,
self
.
ItemType
[
self
.
item_type
].
label
)
class
Transaction
(
models
.
Model
):
class
PaymentType
(
models
.
TextChoices
):
...
...
sizakat/transaction/query.py
0 → 100644
View file @
3d06c0ac
import
graphene
from
.models
import
Transaction
,
ZakatType
as
ZakatTypeModel
from
.types
import
TransactionType
,
ZakatType
class
TransactionQuery
(
graphene
.
ObjectType
):
transactions
=
graphene
.
List
(
TransactionType
)
transaction
=
graphene
.
Field
(
TransactionType
,
transaction_id
=
graphene
.
ID
(
required
=
True
)
)
zakat_types
=
graphene
.
List
(
ZakatType
)
def
resolve_transactions
(
self
,
info
,
**
kwargs
):
return
Transaction
.
objects
.
all
()
def
resolve_transaction
(
self
,
info
,
transaction_id
):
return
Transaction
.
objects
.
get
(
pk
=
transaction_id
)
def
resolve_zakat_types
(
self
,
info
,
**
kwargs
):
return
ZakatTypeModel
.
objects
.
all
()
sizakat/transaction/types.py
0 → 100644
View file @
3d06c0ac
import
graphene
from
graphene_django.types
import
DjangoObjectType
from
.models
import
(
Muzakki
,
Transaction
,
ZakatTransaction
,
ZakatType
as
ZakatTypeModel
)
class
MuzakkiType
(
DjangoObjectType
):
class
Meta
:
model
=
Muzakki
class
TransactionType
(
DjangoObjectType
):
class
Meta
:
model
=
Transaction
class
ZakatTransactionType
(
DjangoObjectType
):
class
Meta
:
model
=
ZakatTransaction
class
ZakatType
(
DjangoObjectType
):
class
Meta
:
model
=
ZakatTypeModel
exclude
=
(
'zakattransaction_set'
,
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment