-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcf461e
commit 4dd5a6b
Showing
25 changed files
with
222 additions
and
121 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
api/migrations/0007_delete_middleware_settings_delete_schedule_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.4 on 2024-04-05 10:06 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0006_delete_indicator_category_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.DeleteModel( | ||
name='middleware_settings', | ||
), | ||
migrations.DeleteModel( | ||
name='schedule_settings', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 5.0.4 on 2024-04-05 10:06 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='middleware_settings', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('syncdata', models.BooleanField(default=False)), | ||
('server_url', models.URLField(blank=True, default='https://khis.pmtct.uonbi.ac.ke/api/29/analytics.json&filter=ou:', null=True)), | ||
('server_username', models.CharField(default='healthit', max_length=255)), | ||
('server_password', models.CharField(default='rr23H3@1th1Tmtct', max_length=255)), | ||
], | ||
options={ | ||
'verbose_name_plural': 'Sync Settings', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='schedule_settings', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('sync_time', models.DateTimeField()), | ||
('shedule_description', models.CharField(blank=True, default='Weekely data sync', max_length=255, null=True)), | ||
], | ||
options={ | ||
'verbose_name_plural': 'Schedule Settings', | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
class middleware_settings(models.Model): | ||
syncdata = models.BooleanField(default=False) | ||
server_url = models.URLField( | ||
default="https://khis.pmtct.uonbi.ac.ke/api/29/analytics.json&filter=ou:", blank=True, null=True) | ||
server_username=models.CharField(max_length=255,default='healthit') | ||
server_password = models.CharField(max_length=255, default="rr23H3@1th1Tmtct") | ||
|
||
def __str__(self): | ||
return "Sync Settings" | ||
|
||
class Meta: | ||
verbose_name_plural = 'Sync Settings' | ||
|
||
class schedule_settings(models.Model): | ||
sync_time = models.DateTimeField() | ||
shedule_description = models.CharField( | ||
default="Weekely data sync", max_length=255, blank=True, null=True) | ||
|
||
def __str__(self): | ||
return "Schedule Settings" | ||
|
||
class Meta: | ||
verbose_name_plural = 'Schedule Settings' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from .models import * | ||
from rest_framework import serializers | ||
|
||
class middleware_settingSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = middleware_settings | ||
fields = '__all__' | ||
|
||
class ScheduleSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = schedule_settings | ||
fields = '__all__' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
from django.urls import path,include | ||
from rest_framework.routers import DefaultRouter | ||
from .views import DataClientViewSet | ||
from .views import * | ||
|
||
# Create a router and register our viewsets with it. | ||
router = DefaultRouter() | ||
router.register(r'pmtct-data', DataClientViewSet, basename='pmtct-data') | ||
router.register('listmiddleware_settings', MiddlewareSettingsViewSet) | ||
|
||
# The API URLs are now determined automatically by the router. | ||
urlpatterns = [ | ||
path('', include(router.urls)), | ||
path('listschedules/', ScheduleView.as_view(), name='schedules'), | ||
path('listschedules/<int:pk>/', | ||
ScheduleView.as_view(), name='update_schedules'), | ||
path('sync_data/', sync_data, | ||
name='sync_data'), | ||
] |
Oops, something went wrong.