Skip to content

Commit

Permalink
fix duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
bryangerlach committed Oct 28, 2024
1 parent f5260f8 commit 2ea67c6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 47 deletions.
30 changes: 15 additions & 15 deletions api/migrations/0006_connlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ class Migration(migrations.Migration):
('api', '0005_log_alter_rustdesdevice_options_and_more'),
]

operations = [
migrations.CreateModel(
name='ConnLog',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False, verbose_name='ID')),
('action', models.CharField(max_length=20, verbose_name='Action')),
('conn_id', models.IntegerField(verbose_name='Connection ID')),
('from_ip', models.CharField(max_length=30, verbose_name='From IP')),
('rid', models.CharField(max_length=20, verbose_name='To ID')),
('logged_at', models.CharField(max_length=25, verbose_name='Logged At')),
('session_id', models.IntegerField(verbose_name='Session ID')),
('uuid', models.CharField(max_length=60, verbose_name='UUID')),
],
),
]
# operations = [
# migrations.CreateModel(
# name='ConnLog',
# fields=[
# ('id', models.IntegerField(primary_key=True, serialize=False, verbose_name='ID')),
# ('action', models.CharField(max_length=20, verbose_name='Action')),
# ('conn_id', models.IntegerField(verbose_name='Connection ID')),
# ('from_ip', models.CharField(max_length=30, verbose_name='From IP')),
# ('rid', models.CharField(max_length=20, verbose_name='To ID')),
# ('logged_at', models.CharField(max_length=25, verbose_name='Logged At')),
# ('session_id', models.IntegerField(verbose_name='Session ID')),
# ('uuid', models.CharField(max_length=60, verbose_name='UUID')),
# ],
# ),
# ]
32 changes: 0 additions & 32 deletions api/models_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,38 +122,6 @@ class RustDesDeviceAdmin(admin.ModelAdmin):
search_fields = ('hostname', 'memory')
list_filter = ('rid', )

class ConnLog(models.Model):
id = models.IntegerField(verbose_name='ID',primary_key=True)
action = models.CharField(verbose_name='Action', max_length=20, null=True)
conn_id = models.CharField(verbose_name='Connection ID', max_length=10, null=True)
from_ip = models.CharField(verbose_name='From IP', max_length=30, null=True)
from_id = models.CharField(verbose_name='From ID', max_length=20, null=True)
rid = models.CharField(verbose_name='To ID', max_length=20, null=True)
conn_start = models.DateTimeField(verbose_name='Connected', null=True)
conn_end = models.DateTimeField(verbose_name='Disconnected', null=True)
session_id = models.CharField(verbose_name='Session ID', max_length=60, null=True)
uuid = models.CharField(verbose_name='uuid', max_length=60, null=True)

class ConnLogAdmin(admin.ModelAdmin):
list_display = ('id', 'action', 'conn_id', 'from_ip', 'from_id', 'rid', 'conn_start', 'conn_end', 'session_id', 'uuid')
search_fields = ('from_ip', 'rid')
list_filter = ('id', 'from_ip', 'from_id', 'rid', 'conn_start', 'conn_end')

class FileLog(models.Model):
id = models.IntegerField(verbose_name='ID',primary_key=True)
file = models.CharField(verbose_name='Path', max_length=500)
remote_id = models.CharField(verbose_name='Remote ID', max_length=20, default='0')
user_id = models.CharField(verbose_name='User ID', max_length=20, default='0')
user_ip = models.CharField(verbose_name='User IP', max_length=20, default='0')
filesize = models.CharField(verbose_name='Filesize', max_length=500, default='')
direction = models.IntegerField(verbose_name='Direction', default=0)
logged_at = models.DateTimeField(verbose_name='Logged At', null=True)

class FileLogAdmin(admin.ModelAdmin):
list_display = ('id', 'file', 'remote_id', 'user_id', 'user_ip', 'filesize', 'direction', 'logged_at')
search_fields = ('file', 'remote_id', 'user_id', 'user_ip')
list_filter = ('id', 'file', 'remote_id', 'user_id', 'user_ip', 'filesize', 'direction', 'logged_at')

class ShareLink(models.Model):
''' Share link
'''
Expand Down

0 comments on commit 2ea67c6

Please sign in to comment.