Skip to content

Commit

Permalink
Ported GroundObject model from Go (#52)
Browse files Browse the repository at this point in the history
* Ported GroundObject model from Go

* Added endpoints for GroundObject

* Almost done with tests, need some help

* Urls import reordering

* Finished endpoint fixes

* Uncommitted Files Added

* Uncommitted Files Added

* lint: black

* refactor: rename images to vision

---------

Co-authored-by: 21chanas3 <[email protected]>
  • Loading branch information
0xc60f and 21chanas3 authored Oct 12, 2024
1 parent dd653dd commit dfa0d6b
Show file tree
Hide file tree
Showing 17 changed files with 411 additions and 134 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -34,4 +34,3 @@ jobs:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
tags: ubcuas/${{ github.event.repository.name }}:latest

4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ repos:
hooks:
- id: ruff
args: [ --fix ]
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.13.0
hooks:
- id: reorder-python-imports
2 changes: 1 addition & 1 deletion src/gcom/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"rest_framework",
"nav.apps.NavConfig",
"drone.apps.DroneConfig",
"images.apps.ImagesConfig",
"vision.apps.VisionConfig",
]

MIDDLEWARE = [
Expand Down
13 changes: 6 additions & 7 deletions src/gcom/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@
"""

from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView


from django.urls import include
from django.urls import path
from drf_spectacular.views import SpectacularAPIView
from drf_spectacular.views import SpectacularSwaggerView
from nav.views import WaypointViewset
from images.views import ImageViewset
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register(r"waypoint", WaypointViewset, basename="waypoint")
router.register(r"images", ImageViewset, basename="images")

urlpatterns = [
# Swagger Docs
Expand All @@ -42,6 +40,7 @@
# API
path("api/", include(router.urls)),
path("api/drone/", include("drone.urls")),
path("api/vision/", include("vision.urls")),
]

urlpatterns += staticfiles_urlpatterns()
41 changes: 0 additions & 41 deletions src/images/migrations/0001_initial.py

This file was deleted.

18 changes: 0 additions & 18 deletions src/images/migrations/0002_alter_image_image.py

This file was deleted.

40 changes: 0 additions & 40 deletions src/images/models.py

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/images/apps.py → src/vision/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.apps import AppConfig


class ImagesConfig(AppConfig):
class VisionConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "images"
name = "vision"
121 changes: 121 additions & 0 deletions src/vision/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Generated by Django 5.1.2 on 2024-10-12 14:39

import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="GroundObject",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
unique=True,
),
),
(
"object_type",
models.CharField(
choices=[("standard", "Standard"), ("emergent", "Emergent")],
default="standard",
max_length=10,
),
),
("lat", models.FloatField()),
("long", models.FloatField()),
(
"shape",
models.CharField(
choices=[
("circle", "Circle"),
("semicircle", "Semi-Circle"),
("quartercircle", "Quarter-Circle"),
("triangle", "Triangle"),
("rectangle", "Rectangle"),
("pentagon", "Pentagon"),
("star", "Star"),
("cross", "Cross"),
],
default="circle",
max_length=15,
),
),
(
"color",
models.CharField(
choices=[
("black", "Black"),
("red", "Red"),
("blue", "Blue"),
("green", "Green"),
("purple", "Purple"),
("brown", "Brown"),
("orange", "Orange"),
],
default="black",
max_length=10,
),
),
("text", models.CharField(max_length=100)),
(
"text_color",
models.CharField(
choices=[
("black", "Black"),
("red", "Red"),
("blue", "Blue"),
("green", "Green"),
("purple", "Purple"),
("brown", "Brown"),
("orange", "Orange"),
],
default="black",
max_length=10,
),
),
],
options={
"verbose_name": "Ground Object",
"verbose_name_plural": "Ground Objects",
},
),
migrations.CreateModel(
name="Image",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("image", models.ImageField(upload_to="files/")),
("title", models.CharField(max_length=100)),
(
"image_type",
models.CharField(
choices=[("visible", "Visible"), ("thermal", "Thermal")],
default="visible",
max_length=20,
),
),
("taken_at", models.DateTimeField()),
("longitude", models.FloatField(null=True)),
("latitude", models.FloatField(null=True)),
("altitude", models.FloatField(null=True)),
],
),
]
File renamed without changes.
Loading

0 comments on commit dfa0d6b

Please sign in to comment.