chore: improve cypress factory types

This commit is contained in:
kolaente 2025-06-03 18:23:07 +02:00
parent c3f3a23fe5
commit 59aca9fd5d
3 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import {Factory} from '../support/factory'
import {faker} from '@faker-js/faker'
export interface ProjectAttributes {
id: number | string; // Allow string for '{increment}'
id: number | '{increment}';
title: string;
owner_id: number;
created: string;
@ -12,7 +12,7 @@ export interface ProjectAttributes {
export class ProjectFactory extends Factory {
static table = 'projects'
static factory(): Omit<ProjectAttributes, 'id'> & { id: string } { // id is '{increment}' before seeding
static factory() {
const now = new Date()
return {
@ -23,4 +23,4 @@ export class ProjectFactory extends Factory {
updated: now.toISOString(),
}
}
}
}

View File

@ -2,7 +2,7 @@ import {faker} from '@faker-js/faker'
import {Factory} from '../support/factory'
export interface TokenAttributes {
id: number | string; // Allow string for '{increment}'
id: number | '{increment}';
user_id: number;
token: string;
kind: number;
@ -26,4 +26,4 @@ export class TokenFactory extends Factory {
...(attrs ?? {}),
}
}
}
}

View File

@ -3,7 +3,7 @@ import {faker} from '@faker-js/faker'
import {Factory} from '../support/factory'
export interface UserAttributes {
id: number | string;
id: number | '{increment}';
username: string;
password?: string;
status: number;
@ -16,7 +16,7 @@ export interface UserAttributes {
export class UserFactory extends Factory {
static table = 'users'
static factory(): Omit<UserAttributes, 'id' | 'password'> & { id: string; password?: string } {
static factory() {
const now = new Date()
return {
@ -30,4 +30,4 @@ export class UserFactory extends Factory {
updated: now.toISOString(),
}
}
}
}