30 lines
1.4 KiB
Python
30 lines
1.4 KiB
Python
import yksa_kit.models
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = []
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='ApiToken',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(help_text="Human-readable label, e.g. 'TMTC pipeline' or 'ground station 1'.", max_length=64, unique=True)),
|
|
('token', models.CharField(db_index=True, default=yksa_kit.models._generate_token, editable=False, help_text='Bearer credential. Treat as a secret.', max_length=128, unique=True)),
|
|
('kind', models.CharField(choices=[('read', 'Read (non-public visibility)'), ('ingest', 'Ingest (push)')], default='read', help_text='Read tokens extend visibility; ingest tokens may also push data.', max_length=16)),
|
|
('is_active', models.BooleanField(db_index=True, default=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('last_used_at', models.DateTimeField(blank=True, null=True)),
|
|
('notes', models.TextField(blank=True)),
|
|
],
|
|
options={
|
|
'verbose_name': 'API token',
|
|
'verbose_name_plural': 'API tokens',
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
]
|