Skip to content

Commit

Permalink
Merge pull request #45 from Ferlab-Ste-Justine/feat/cqdg-322
Browse files Browse the repository at this point in the history
feat: CQDG-322 allow more char for alias field in usersets model
  • Loading branch information
atoulous authored Aug 29, 2023
2 parents 91b623c + 2ab89c4 commit ce9a8ce
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions src/db/models/SavedFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export interface ISavedFilterInput extends ISavedFilterAttributes {}
export interface ISavedFilterOutput extends ISavedFilterAttributes {}

class SavedFilterModel extends Model<ISavedFilterAttributes, ISavedFilterInput> implements ISavedFilterAttributes {
public id!: string;
public keycloak_id!: string;
public title!: string;
public tag!: string;
public queries!: any[];
public type!: string;
public creation_date!: Date;
public updated_date!: Date;
public favorite!: boolean;
public id: string;
public keycloak_id: string;
public title: string;
public tag: string;
public queries: any[];
public type: string;
public creation_date: Date;
public updated_date: Date;
public favorite: boolean;
}

SavedFilterModel.init(
Expand Down
10 changes: 5 additions & 5 deletions src/db/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export interface IUserInput extends IUserAttributes {}
export interface IUserOuput extends IUserAttributes {}

class UserModel extends Model<IUserAttributes, IUserInput> implements IUserAttributes {
public id!: number;
public keycloak_id!: string;
public id: number;
public keycloak_id: string;
public commercial_use_reason: string;
public accepted_terms: boolean;
public understand_disclaimer: boolean;
public completed_registration: boolean;
public creation_date!: Date;
public updated_date!: Date;
public creation_date: Date;
public updated_date: Date;
public deleted: boolean;
public roles: string[];
public portal_usages: string[];
Expand Down Expand Up @@ -144,7 +144,7 @@ UserModel.init(
affiliation: {
type: DataTypes.CITEXT,
validate: {
isAlphanumeric: true,
is: NAME_REGEX,
},
},
public_email: {
Expand Down
18 changes: 9 additions & 9 deletions src/db/models/UserSets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DataTypes, Model } from 'sequelize';

import { UUID_VERSION } from '../../utils/constants';
import { NAME_REGEX, UUID_VERSION } from '../../utils/constants';
import sequelizeConnection from '../config';

interface IUserSetAttributes {
Expand All @@ -19,13 +19,13 @@ export interface IUserSetsInput extends IUserSetAttributes {}
export interface IUserSetsOutput extends IUserSetAttributes {}

class UserSetModel extends Model<IUserSetAttributes, IUserSetsInput> implements IUserSetAttributes {
public id!: string;
public keycloak_id!: string;
public content!: any;
public alias!: string;
public sharedpublicly!: boolean;
public creation_date!: Date;
public updated_date!: Date;
public id: string;
public keycloak_id: string;
public content: any;
public alias: string;
public sharedpublicly: boolean;
public creation_date: Date;
public updated_date: Date;
}

UserSetModel.init(
Expand All @@ -50,7 +50,7 @@ UserSetModel.init(
type: DataTypes.STRING,
allowNull: false,
validate: {
isAlpha: true,
is: NAME_REGEX,
},
},
sharedpublicly: {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const UUID_VERSION = 4;
export const NAME_REGEX = /^[a-zA-ZÀ-ÿ0-9- ]+$/;
export const NAME_REGEX = /^[a-zà-ÿ ,.'-_]+$/iu;
export const MAX_LENGTH_PER_ROLE = 35;

0 comments on commit ce9a8ce

Please sign in to comment.