mirror of
https://github.com/CaramelFur/Picsur.git
synced 2025-11-13 15:25:39 +01:00
change from incremental id to uuid-v4
This commit is contained in:
@@ -3,8 +3,8 @@ import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class EImageBackend extends EImage {
|
export class EImageBackend extends EImage {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn("uuid")
|
||||||
override id?: number;
|
override id?: string;
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({ unique: true, nullable: false })
|
@Column({ unique: true, nullable: false })
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { Permissions } from '../dto/permissions.dto';
|
|||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class ERoleBackend extends ERole {
|
export class ERoleBackend extends ERole {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn("uuid")
|
||||||
override id?: number;
|
override id?: string;
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({ nullable: false, unique: true })
|
@Column({ nullable: false, unique: true })
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class ESysPreferenceBackend extends ESysPreference {
|
export class ESysPreferenceBackend extends ESysPreference {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn("uuid")
|
||||||
override id?: number;
|
override id?: string;
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({ nullable: false, unique: true })
|
@Column({ nullable: false, unique: true })
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class EUserBackend extends EUser {
|
export class EUserBackend extends EUser {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn("uuid")
|
||||||
override id?: number;
|
override id?: string;
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({ nullable: false, unique: true })
|
@Column({ nullable: false, unique: true })
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { EUsrPreference } from 'picsur-shared/dist/entities/usrpreference';
|
|||||||
import { Column, Index, PrimaryGeneratedColumn } from 'typeorm';
|
import { Column, Index, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
export class EUsrPreferenceBackend extends EUsrPreference {
|
export class EUsrPreferenceBackend extends EUsrPreference {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn("uuid")
|
||||||
override id?: number;
|
override id?: string;
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({ nullable: false, unique: true })
|
@Column({ nullable: false, unique: true })
|
||||||
@@ -33,7 +33,7 @@ export class ValuesPickerComponent implements OnInit, OnChanges {
|
|||||||
@Input('disabled-list') disabledSelection: string[] = [];
|
@Input('disabled-list') disabledSelection: string[] = [];
|
||||||
|
|
||||||
@Input('value-mapper')
|
@Input('value-mapper')
|
||||||
valueMapper: (value: string) => string = (value) => 'poopoo';
|
valueMapper: (value: string) => string = (value) => value;
|
||||||
|
|
||||||
// Selection
|
// Selection
|
||||||
private selectableSubject = new BehaviorSubject<string[]>([]);
|
private selectableSubject = new BehaviorSubject<string[]>([]);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { EntityID } from '../validators/entity-id.validator';
|
|||||||
|
|
||||||
export class EImage {
|
export class EImage {
|
||||||
@EntityID()
|
@EntityID()
|
||||||
id?: number;
|
id?: string;
|
||||||
|
|
||||||
@IsHash('sha256')
|
@IsHash('sha256')
|
||||||
hash: string;
|
hash: string;
|
||||||
|
|||||||
@@ -19,5 +19,5 @@ export class RoleNamePermsObject extends RoleNameObject {
|
|||||||
|
|
||||||
export class ERole extends RoleNamePermsObject {
|
export class ERole extends RoleNamePermsObject {
|
||||||
@EntityID()
|
@EntityID()
|
||||||
id?: number;
|
id?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { EntityID } from '../validators/entity-id.validator';
|
|||||||
|
|
||||||
export class ESysPreference {
|
export class ESysPreference {
|
||||||
@EntityID()
|
@EntityID()
|
||||||
id?: number;
|
id?: string;
|
||||||
|
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class NameRolesUser extends UsernameUser {
|
|||||||
// Actual entity that goes in the db
|
// Actual entity that goes in the db
|
||||||
export class EUser extends NameRolesUser {
|
export class EUser extends NameRolesUser {
|
||||||
@EntityID()
|
@EntityID()
|
||||||
id?: number;
|
id?: string;
|
||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@Exclude()
|
@Exclude()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { IsPosInt } from '../validators/positive-int.validator';
|
|||||||
|
|
||||||
export class EUsrPreference {
|
export class EUsrPreference {
|
||||||
@EntityID()
|
@EntityID()
|
||||||
id?: number;
|
id?: string;
|
||||||
|
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { IsInt, IsNotEmpty, IsOptional, Min } from 'class-validator';
|
import { IsNotEmpty, IsOptional, IsUUID } from 'class-validator';
|
||||||
import { CombinePDecorators } from '../util/decorator';
|
import { CombinePDecorators } from '../util/decorator';
|
||||||
|
|
||||||
export const EntityID = CombinePDecorators(IsOptional(), IsInt(), Min(0));
|
export const EntityID = CombinePDecorators(IsOptional(), IsUUID('4'));
|
||||||
export const EntityIDRequired = CombinePDecorators(IsNotEmpty(), IsInt(), Min(0));
|
export const EntityIDRequired = CombinePDecorators(IsNotEmpty(), IsUUID('4'));
|
||||||
|
|||||||
Reference in New Issue
Block a user