I have model called session with composite key of three properties: seesionId, userNameId and accountId. In order to create new record I need to check if there's already session with the same userNameId and accountId.
the API of findByPk: public static async findByPk(param: number | string | Buffer, options: object): Promise
I don't understated how to pass userNameId and accountId together.
SESSION MODEL
export class Session extends Model<Session> implements ISessionModel {
@PrimaryKey
@Default(DataType.UUIDV4)
@AllowNull(false)
@Column(DataType.UUID)
sessionId: string;
@PrimaryKey
@IsUUID(4)
@AllowNull(false)
@Column(DataType.UUID)
accountId: string;
@PrimaryKey
@AllowNull(false)
@Column
userNameId: string;
@AllowNull(false)
@Column
userName: string;
..
..
}