gapguide-api / apps /resources /migrations /0001_initial.py
arifRB's picture
Deploy GapGuide backend (Docker)
ffd36e0 verified
Raw
History Blame Contribute Delete
3.98 kB
# Generated by Django 6.0.4 on 2026-04-20 17:36
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('skills', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Resource',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=300)),
('provider', models.CharField(max_length=100)),
('url', models.URLField(max_length=500, unique=True)),
('difficulty_level', models.CharField(choices=[('BEGINNER', 'Beginner'), ('INTERMEDIATE', 'Intermediate'), ('ADVANCED', 'Advanced')], max_length=20)),
('duration', models.IntegerField(help_text='Total duration in minutes.', validators=[django.core.validators.MinValueValidator(0)])),
('type', models.CharField(choices=[('VIDEO', 'Video'), ('COURSE', 'Course'), ('ARTICLE', 'Article'), ('DOCS', 'Docs')], max_length=20)),
('rating', models.FloatField(default=3.5, help_text='Curator-assigned 0.0-5.0 rating used by recommendation ranking.', validators=[django.core.validators.MinValueValidator(0.0), django.core.validators.MaxValueValidator(5.0)])),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'ordering': ['title'],
},
),
migrations.CreateModel(
name='SkillResource',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('relevance_score', models.FloatField(default=1.0, help_text='0.0-1.0 how relevant this resource is to the skill.', validators=[django.core.validators.MinValueValidator(0.0), django.core.validators.MaxValueValidator(1.0)])),
('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resources.resource')),
('skill', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='skills.skill')),
],
options={
'unique_together': {('skill', 'resource')},
},
),
migrations.AddField(
model_name='resource',
name='skills',
field=models.ManyToManyField(related_name='resources', through='resources.SkillResource', to='skills.skill'),
),
migrations.CreateModel(
name='ResourceCheckpoint',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('order_index', models.IntegerField(help_text='1-based position within the resource.', validators=[django.core.validators.MinValueValidator(1)])),
('title', models.CharField(max_length=500)),
('url_fragment', models.CharField(blank=True, default='', help_text='Optional anchor/path suffix linking to this module.', max_length=500)),
('estimated_minutes', models.IntegerField(blank=True, null=True)),
('source', models.CharField(choices=[('manual', 'Manual'), ('playwright', 'Playwright'), ('youtube_api', 'YouTube API'), ('fcc_github', 'freeCodeCamp GitHub')], default='manual', max_length=20)),
('extracted_at', models.DateTimeField(blank=True, null=True)),
('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checkpoints', to='resources.resource')),
],
options={
'ordering': ['resource', 'order_index'],
'unique_together': {('resource', 'order_index')},
},
),
]