1 parent
3a04bb54bd
commit
e8727ca922
27 files changed
+145
-145
No files matched your search
+1
-1
@@ -8,5 +8,5 @@ export default {
|
|||||||
username: process.env.DB_USER,
|
username: process.env.DB_USER,
|
||||||
password: process.env.DB_PASSWORD,
|
password: process.env.DB_PASSWORD,
|
||||||
database: process.env.DB_NAME,
|
database: process.env.DB_NAME,
|
||||||
entities: ["src/models/*.ts"]
|
entities: ["src/models/entities/*.ts"]
|
||||||
};
|
};
|
||||||
@@ -2,9 +2,9 @@ import { JsonController, Param, Body, Get, Post, Put, Delete, OnUndefined } from
|
|||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { Runner } from '../models/Runner';
|
import { Runner } from '../models/entities/Runner';
|
||||||
import { RunnerGroupNeededError, RunnerGroupNotFoundError, RunnerIdsNotMatchingError, RunnerNotFoundError, RunnerOnlyOneGroupAllowedError } from '../errors/RunnerErrors';
|
import { RunnerGroupNeededError, RunnerGroupNotFoundError, RunnerIdsNotMatchingError, RunnerNotFoundError, RunnerOnlyOneGroupAllowedError } from '../errors/RunnerErrors';
|
||||||
import { CreateRunner } from '../models/CreateRunner';
|
import { CreateRunner } from '../models/creation/CreateRunner';
|
||||||
|
|
||||||
|
|
||||||
@JsonController('/runners')
|
@JsonController('/runners')
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import { JsonController, Param, Body, Get, Post, Put, Delete, OnUndefined } from
|
|||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { RunnerOrganisation } from '../models/RunnerOrganisation';
|
import { RunnerOrganisation } from '../models/entities/RunnerOrganisation';
|
||||||
import { RunnerOrganisationIdsNotMatchingError, RunnerOrganisationNotFoundError } from '../errors/RunnerOrganisationErrors';
|
import { RunnerOrganisationIdsNotMatchingError, RunnerOrganisationNotFoundError } from '../errors/RunnerOrganisationErrors';
|
||||||
import { CreateRunnerOrganisation } from '../models/CreateRunnerOrganisation';
|
import { CreateRunnerOrganisation } from '../models/creation/CreateRunnerOrganisation';
|
||||||
import { RunnerGroup } from '../models/RunnerGroup';
|
import { RunnerGroup } from '../models/entities/RunnerGroup';
|
||||||
|
|
||||||
|
|
||||||
@JsonController('/organisations')
|
@JsonController('/organisations')
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import { JsonController, Param, Body, Get, Post, Put, Delete, NotFoundError, OnU
|
|||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { Track } from '../models/Track';
|
import { Track } from '../models/entities/Track';
|
||||||
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
||||||
import { TrackIdsNotMatchingError, TrackNotFoundError } from "../errors/TrackErrors";
|
import { TrackIdsNotMatchingError, TrackNotFoundError } from "../errors/TrackErrors";
|
||||||
import { CreateTrack } from '../models/CreateTrack';
|
import { CreateTrack } from '../models/creation/CreateTrack';
|
||||||
|
|
||||||
@JsonController('/tracks')
|
@JsonController('/tracks')
|
||||||
//@Authorized("TRACKS:read")
|
//@Authorized("TRACKS:read")
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsPositive, IsString } from 'class-validator';
|
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsPositive, IsString } from 'class-validator';
|
||||||
import { Runner } from '../models/Runner';
|
import { Runner } from '../entities/Runner';
|
||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { group } from 'console';
|
import { group } from 'console';
|
||||||
import { RunnerOnlyOneGroupAllowedError, RunnerGroupNeededError, RunnerGroupNotFoundError } from '../errors/RunnerErrors';
|
import { RunnerOnlyOneGroupAllowedError, RunnerGroupNeededError, RunnerGroupNotFoundError } from '../../errors/RunnerErrors';
|
||||||
import { RunnerOrganisation } from './RunnerOrganisation';
|
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
||||||
import { RunnerTeam } from './RunnerTeam';
|
import { RunnerTeam } from '../entities/RunnerTeam';
|
||||||
import { RunnerGroup } from './RunnerGroup';
|
import { RunnerGroup } from '../entities/RunnerGroup';
|
||||||
import { Address } from 'cluster';
|
import { Address } from 'cluster';
|
||||||
|
|
||||||
export class CreateRunner {
|
export class CreateRunner {
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { IsString } from 'class-validator';
|
import { IsString } from 'class-validator';
|
||||||
import { RunnerOrganisation } from './RunnerOrganisation';
|
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
||||||
|
|
||||||
export class CreateRunnerOrganisation {
|
export class CreateRunnerOrganisation {
|
||||||
@IsString()
|
@IsString()
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
||||||
import { Track } from './Track';
|
import { Track } from '../entities/Track';
|
||||||
|
|
||||||
export class CreateTrack {
|
export class CreateTrack {
|
||||||
/**
|
/**
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,130 +1,130 @@
|
|||||||
import { Entity, Column, OneToMany, ManyToOne, PrimaryGeneratedColumn, Generated, Unique, JoinTable, ManyToMany } from "typeorm";
|
import { Entity, Column, OneToMany, ManyToOne, PrimaryGeneratedColumn, Generated, Unique, JoinTable, ManyToMany } from "typeorm";
|
||||||
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, isUUID, } from "class-validator";
|
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, isUUID, } from "class-validator";
|
||||||
import { UserGroup } from './UserGroup';
|
import { UserGroup } from './UserGroup';
|
||||||
import { Permission } from './Permission';
|
import { Permission } from './Permission';
|
||||||
import { UserAction } from './UserAction';
|
import { UserAction } from './UserAction';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a admin user.
|
* Defines a admin user.
|
||||||
*/
|
*/
|
||||||
@Entity()
|
@Entity()
|
||||||
export class User {
|
export class User {
|
||||||
/**
|
/**
|
||||||
* autogenerated unique id (primary key).
|
* autogenerated unique id (primary key).
|
||||||
*/
|
*/
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* autogenerated uuid
|
* autogenerated uuid
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@Generated("uuid")
|
@Generated("uuid")
|
||||||
uuid: string;
|
uuid: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* user email
|
* user email
|
||||||
*/
|
*/
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
email: string;
|
email: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* user phone
|
* user phone
|
||||||
*/
|
*/
|
||||||
@IsPhoneNumber("ZZ")
|
@IsPhoneNumber("ZZ")
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
phone: string;
|
phone: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* username
|
* username
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
username: string;
|
username: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* firstname
|
* firstname
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
firstname: string;
|
firstname: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* middlename
|
* middlename
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
middlename: string;
|
middlename: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lastname
|
* lastname
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* password
|
* password
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
password: string;
|
password: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* permissions
|
* permissions
|
||||||
*/
|
*/
|
||||||
@ManyToOne(() => Permission, permission => permission.users, { nullable: true })
|
@ManyToOne(() => Permission, permission => permission.users, { nullable: true })
|
||||||
permissions: Permission[];
|
permissions: Permission[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* groups
|
* groups
|
||||||
*/
|
*/
|
||||||
@ManyToMany(() => UserGroup)
|
@ManyToMany(() => UserGroup)
|
||||||
@JoinTable()
|
@JoinTable()
|
||||||
groups: UserGroup[];
|
groups: UserGroup[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is user enabled?
|
* is user enabled?
|
||||||
*/
|
*/
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jwt refresh count
|
* jwt refresh count
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@Column({ default: 1 })
|
@Column({ default: 1 })
|
||||||
refreshTokenCount: number;
|
refreshTokenCount: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* profilepic
|
* profilepic
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
profilepic: string;
|
profilepic: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* actions
|
* actions
|
||||||
*/
|
*/
|
||||||
@OneToMany(() => UserAction, action => action.user)
|
@OneToMany(() => UserAction, action => action.user)
|
||||||
actions: UserAction
|
actions: UserAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate all permissions
|
* calculate all permissions
|
||||||
*/
|
*/
|
||||||
public get calc_permissions(): Permission[] {
|
public get calc_permissions(): Permission[] {
|
||||||
let final_permissions = []
|
let final_permissions = []
|
||||||
this.groups.forEach((permission) => {
|
this.groups.forEach((permission) => {
|
||||||
if (!final_permissions.includes(permission)) {
|
if (!final_permissions.includes(permission)) {
|
||||||
final_permissions.push(permission)
|
final_permissions.push(permission)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.permissions.forEach((permission) => {
|
this.permissions.forEach((permission) => {
|
||||||
if (!final_permissions.includes(permission)) {
|
if (!final_permissions.includes(permission)) {
|
||||||
final_permissions.push(permission)
|
final_permissions.push(permission)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return final_permissions
|
return final_permissions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user