fixes
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Admin Panel / Deploy Admin Panel (push) Waiting to run
Deploy Admin Panel / Admin Panel Verification (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions

This commit is contained in:
Dmitry 2025-12-15 00:55:42 +03:00
parent 7c1e2bcaf7
commit 8ce8569625
13 changed files with 62 additions and 101 deletions

View file

@ -34,7 +34,6 @@ import {
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import { Label } from '@/components/ui/label'
import { Textarea } from '@/components/ui/textarea'
import { ImageUpload } from '@/components/ui/image-upload'
import { Plus, Search, Edit, Trash2, ChevronLeft, ChevronRight } from 'lucide-react'

View file

@ -200,8 +200,8 @@ class AppDatabase extends _$AppDatabase {
// Users indexes
await customStatement('CREATE INDEX IF NOT EXISTS idx_users_email ON users(email) WHERE email IS NOT NULL');
await customStatement('CREATE INDEX IF NOT EXISTS idx_users_admin ON users(admin) WHERE admin = true');
await customStatement('CREATE INDEX IF NOT EXISTS idx_users_not_deleted ON users(is_deleted) WHERE is_deleted = false');
await customStatement('CREATE INDEX IF NOT EXISTS idx_users_admin ON users(admin) WHERE admin = TRUE');
await customStatement('CREATE INDEX IF NOT EXISTS idx_users_not_deleted ON users(is_deleted) WHERE is_deleted = FALSE');
// UserDatas indexes
await customStatement('CREATE INDEX IF NOT EXISTS idx_user_datas_user_id ON user_datas(user_id)');
@ -213,12 +213,12 @@ class AppDatabase extends _$AppDatabase {
await customStatement('CREATE INDEX IF NOT EXISTS idx_tokens_expires ON tokens(expires)');
await customStatement('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_user_id ON refresh_tokens(user_id)');
await customStatement('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_jti ON refresh_tokens(jti)');
await customStatement('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_not_blacklisted ON refresh_tokens(is_blacklisted) WHERE is_blacklisted = false');
await customStatement('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_not_blacklisted ON refresh_tokens(is_blacklisted) WHERE is_blacklisted = FALSE');
await customStatement('CREATE INDEX IF NOT EXISTS idx_telegram_codes_code ON telegram_auth_codes(code)');
await customStatement('CREATE INDEX IF NOT EXISTS idx_telegram_codes_not_used ON telegram_auth_codes(is_used) WHERE is_used = false');
await customStatement('CREATE INDEX IF NOT EXISTS idx_telegram_codes_not_used ON telegram_auth_codes(is_used) WHERE is_used = FALSE');
// CardPacks indexes
await customStatement('CREATE INDEX IF NOT EXISTS idx_packs_enabled ON card_packs(enabled) WHERE enabled = true');
await customStatement('CREATE INDEX IF NOT EXISTS idx_packs_enabled ON card_packs(enabled) WHERE enabled = TRUE');
await customStatement('CREATE INDEX IF NOT EXISTS idx_packs_order ON card_packs("order")');
// GameCards indexes

View file

@ -56,10 +56,8 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("admin" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _userSettingsMeta = const VerificationMeta(
'userSettings',
@ -118,10 +116,8 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
@ -1524,10 +1520,8 @@ class $TokensTable extends Tokens with TableInfo<$TokensTable, Token> {
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -2024,10 +2018,8 @@ class $RefreshTokensTable extends RefreshTokens
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_blacklisted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
@ -2064,10 +2056,8 @@ class $RefreshTokensTable extends RefreshTokens
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -2638,10 +2628,8 @@ class $TelegramAuthCodesTable extends TelegramAuthCodes
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -3358,10 +3346,8 @@ class $CardPacksTable extends CardPacks
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("enabled" IN (0, 1))',
),
defaultValue: const Constant(true),
$customConstraints: 'NOT NULL DEFAULT TRUE',
defaultValue: const CustomExpression('TRUE'),
);
@override
late final GeneratedColumnWithTypeConverter<List<String>, String> cardsOrder =
@ -3463,10 +3449,8 @@ class $CardPacksTable extends CardPacks
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
@ -4447,10 +4431,8 @@ class $GameCardsTable extends GameCards
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
@ -6602,10 +6584,8 @@ class $SubscriptionPlansTable extends SubscriptionPlans
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
@ -7768,10 +7748,8 @@ class $PaymentsTable extends Payments with TableInfo<$PaymentsTable, Payment> {
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -8557,10 +8535,8 @@ class $TestsTable extends Tests with TableInfo<$TestsTable, Test> {
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -9204,10 +9180,8 @@ class $TestQuestionsTable extends TestQuestions
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -12953,10 +12927,8 @@ class $PromoCodesCampaignsTable extends PromoCodesCampaigns
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -13782,10 +13754,8 @@ class $PromoCodesTable extends PromoCodes
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -14366,10 +14336,8 @@ class $DiscountCampaignsTable extends DiscountCampaigns
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -14979,10 +14947,8 @@ class $DiscountsTable extends Discounts
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -15866,10 +15832,8 @@ class $StudySessionsTable extends StudySessions
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
@ -16685,10 +16649,8 @@ class $WordStatisticsTable extends WordStatistics
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_deleted" IN (0, 1))',
),
defaultValue: const Constant(false),
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',

View file

@ -18,7 +18,7 @@ class Tokens extends Table {
.withDefault(now())();
Column<PgDateTime> get expires => customType(PgTypes.timestampWithTimezone)();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();
@ -42,13 +42,13 @@ class RefreshTokens extends Table {
TextColumn get jti => text().unique()(); // JWT ID
BoolColumn get isBlacklisted => boolean()
.withDefault(const Constant(false))(); // PostgreSQL использует нативный BOOLEAN
.customConstraint('NOT NULL DEFAULT FALSE')(); // PostgreSQL использует нативный BOOLEAN
Column<PgDateTime> get createdAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
Column<PgDateTime> get expiresAt => customType(PgTypes.timestampWithTimezone)();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();
@ -78,7 +78,7 @@ class TelegramAuthCodes extends Table {
.withDefault(now())();
Column<PgDateTime> get expiresAt => customType(PgTypes.timestampWithTimezone)();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();

View file

@ -28,7 +28,7 @@ class DiscountCampaigns extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
// PostgreSQL использует нативный BOOLEAN
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();
@ -59,7 +59,7 @@ class Discounts extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
// PostgreSQL использует нативный BOOLEAN
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();

View file

@ -22,7 +22,7 @@ class CardPacks extends Table {
TextColumn get version => text().nullable()();
IntColumn get order => integer().withDefault(const Constant(0))();
BoolColumn get enabled => boolean()
.withDefault(const Constant(true))();
.customConstraint('NOT NULL DEFAULT TRUE')();
// PostgreSQL использует нативный BOOLEAN
// Порядок карточек (JSON array of IDs)
@ -45,7 +45,7 @@ class CardPacks extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
// PostgreSQL использует нативный BOOLEAN
@override
@ -81,7 +81,7 @@ class GameCards extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
// PostgreSQL использует нативный BOOLEAN
@override

View file

@ -35,7 +35,7 @@ class Payments extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();

View file

@ -38,7 +38,7 @@ class PromoCodesCampaigns extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
// PostgreSQL использует нативный BOOLEAN
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();
@ -69,7 +69,7 @@ class PromoCodes extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();

View file

@ -30,7 +30,7 @@ class StudySessions extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();

View file

@ -32,7 +32,7 @@ class SubscriptionPlans extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
// PostgreSQL использует нативный BOOLEAN
@override

View file

@ -22,7 +22,7 @@ class Tests extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
// PostgreSQL использует нативный BOOLEAN
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();
@ -49,7 +49,7 @@ class TestQuestions extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();

View file

@ -11,7 +11,7 @@ class Users extends Table {
TextColumn get name => text().nullable()();
TextColumn get email => text().nullable()();
BoolColumn get admin => boolean()
.withDefault(const Constant(false))(); // PostgreSQL использует нативный BOOLEAN
.customConstraint('NOT NULL DEFAULT FALSE')(); // PostgreSQL использует нативный BOOLEAN
// UserSettings (JSON)
TextColumn get userSettings => text().nullable()();
@ -28,7 +28,7 @@ class Users extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))(); // PostgreSQL использует нативный BOOLEAN
.customConstraint('NOT NULL DEFAULT FALSE')(); // PostgreSQL использует нативный BOOLEAN
@override
Set<Column> get primaryKey => {id};

View file

@ -38,7 +38,7 @@ class WordStatistics extends Table {
Column<PgDateTime> get updatedAt => customType(PgTypes.timestampWithTimezone)
.withDefault(now())();
BoolColumn get isDeleted => boolean()
.withDefault(const Constant(false))();
.customConstraint('NOT NULL DEFAULT FALSE')();
Column<PgDateTime> get deletedAt => customType(PgTypes.timestampWithTimezone)
.nullable()();