Skip to content

Commit

Permalink
GET endpoint now hooks up to database data + initial setup of s3 inte…
Browse files Browse the repository at this point in the history
…gration
  • Loading branch information
forreya committed Jan 19, 2025
1 parent d2a2bd4 commit f8a96d4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 24 deletions.
4 changes: 2 additions & 2 deletions reminders.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

This file is to remind myself what I was up to in the previous session so I can easily get back on track with the same ideas / solutions I was having.

- MUST perform all server side migrations + database related changes from the docker container (the local directory doesn't connect to the database)
- Binded the entire server directory to the docker equivalent just like the client directory
- Just finished setting up AWS CLI configuration, now need to setup `boto3` module to link up with Amazon S3.
- Use the mp3 object key for the database field and dynamically create the mp3 URL using the public + secret keys.
4 changes: 2 additions & 2 deletions server/music/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

@admin.register(Track)
class TrackAdmin(admin.ModelAdmin):
list_display = ('title', 'artist', 'release_date')
list_display = ('title', 'artist', 'release_date')

@admin.register(Channel)
class ChannelAdmin(admin.ModelAdmin):
list_display = ['name']
list_display = ['name']
4 changes: 2 additions & 2 deletions server/music/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.apps import AppConfig

class MusicConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'music'
default_auto_field = 'django.db.models.BigAutoField'
name = 'music'
2 changes: 1 addition & 1 deletion server/music/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Track(models.Model):
title = models.CharField(max_length=200)
artist = models.CharField(max_length=200)
featuring_artists = models.CharField(max_length=500, null=True)
url = models.URLField()
s3_key = models.CharField(max_length=200)
release_date = models.DateField()
channels = models.ManyToManyField(Channel, blank=True)

Expand Down
6 changes: 3 additions & 3 deletions server/music/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
from .models import Track

class TrackSerializer(serializers.ModelSerializer):
class Meta:
model = Track
fields = '__all__'
class Meta:
model = Track
fields = '__all__'
16 changes: 3 additions & 13 deletions server/music/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@

@api_view(['GET'])
def get_track(request):
serializer = TrackSerializer(data= {
'title': 'Test Song',
'artist': 'Test Artist',
'featuring_artists': None,
'url': 'https://www.google.com/',
'release_date': '2001-07-12',
'channels': [],
})
try:
serializer.is_valid(raise_exception=True)
except:
print(serializer.errors)
return Response(serializer.validated_data)
tracks = Track.objects.all()
serializer = TrackSerializer(tracks, many=True)
return Response(serializer.data)
3 changes: 2 additions & 1 deletion server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ asgiref==3.8.1
Django==5.1.4
sqlparse==0.5.3
psycopg2-binary==2.9.10
djangorestframework==3.15.2
djangorestframework==3.15.2
boto3==1.36.2

0 comments on commit f8a96d4

Please sign in to comment.