forked from geolba/tethys.backend
- add validator for checking languages of translated titles and description
- add notification messages via notiwind.ts - add Project.ts - add new component TabelPersons.vue - add additional routes - npm updates
This commit is contained in:
parent
59a99ff3c8
commit
080c21126b
24 changed files with 979 additions and 349 deletions
|
@ -26,7 +26,7 @@ export default class Dataset extends BaseModel {
|
|||
public publisherName: string;
|
||||
|
||||
@column.dateTime({ columnName: 'embargo_date' })
|
||||
public EmbargoDate: DateTime;
|
||||
public embargoDate: DateTime;
|
||||
|
||||
@column({})
|
||||
public type: string;
|
||||
|
|
|
@ -48,24 +48,24 @@ export default class Person extends BaseModel {
|
|||
},
|
||||
autoCreate: true,
|
||||
})
|
||||
public registeredAt: DateTime;
|
||||
public createdAt: DateTime;
|
||||
|
||||
@computed({
|
||||
serializeAs: 'name'
|
||||
})
|
||||
public get fullName() {
|
||||
return `${this.firstName} ${this.lastName} (${this.email})`;
|
||||
return `${this.firstName} ${this.lastName}`;
|
||||
}
|
||||
|
||||
@computed()
|
||||
public get progress(): number {
|
||||
return 50;
|
||||
}
|
||||
// @computed()
|
||||
// public get progress(): number {
|
||||
// return 50;
|
||||
// }
|
||||
|
||||
@computed()
|
||||
public get created_at() {
|
||||
return '2023-02-17 08:45:56';
|
||||
}
|
||||
// @computed()
|
||||
// public get created_at() {
|
||||
// return '2023-03-21 08:45:00';
|
||||
// }
|
||||
|
||||
@computed()
|
||||
public get datasetCount() {
|
||||
|
|
37
app/Models/Project.ts
Normal file
37
app/Models/Project.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { column, BaseModel, SnakeCaseNamingStrategy } from '@ioc:Adonis/Lucid/Orm';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
export default class Project extends BaseModel {
|
||||
public static namingStrategy = new SnakeCaseNamingStrategy();
|
||||
public static primaryKey = 'id';
|
||||
public static table = 'projects';
|
||||
public static selfAssignPrimaryKey = false;
|
||||
|
||||
@column({
|
||||
isPrimary: true,
|
||||
})
|
||||
public id: number;
|
||||
|
||||
|
||||
@column({})
|
||||
public label: string;
|
||||
|
||||
@column({})
|
||||
public name: string;
|
||||
|
||||
@column({})
|
||||
public description: string;
|
||||
|
||||
@column.dateTime({
|
||||
autoCreate: true,
|
||||
})
|
||||
public created_at: DateTime;
|
||||
|
||||
@column.dateTime({
|
||||
autoCreate: true,
|
||||
autoUpdate: true
|
||||
})
|
||||
public updated_at: DateTime;
|
||||
|
||||
|
||||
}
|
|
@ -2,21 +2,18 @@ import Database, {
|
|||
// DatabaseQueryBuilderContract,
|
||||
QueryClientContract,
|
||||
TransactionClientContract,
|
||||
} from "@ioc:Adonis/Lucid/Database";
|
||||
import Config from "@ioc:Adonis/Core/Config";
|
||||
} from '@ioc:Adonis/Lucid/Database';
|
||||
import Config from '@ioc:Adonis/Core/Config';
|
||||
|
||||
export function getUserRoles(
|
||||
userId: number,
|
||||
trx?: TransactionClientContract
|
||||
): Promise<Array<string>> {
|
||||
const { userRole } = Config.get("acl.joinTables");
|
||||
export function getUserRoles(userId: number, trx?: TransactionClientContract): Promise<Array<string>> {
|
||||
const { userRole } = Config.get('acl.joinTables');
|
||||
return ((trx || Database) as QueryClientContract | TransactionClientContract)
|
||||
.query()
|
||||
.from("roles")
|
||||
.distinct("roles.slug")
|
||||
.leftJoin(userRole, `${userRole}.role_id`, "roles.id")
|
||||
.where(`${userRole}.user_id`, userId)
|
||||
.then((res) => {
|
||||
return res.map((r) => r.slug);
|
||||
});
|
||||
}
|
||||
.query()
|
||||
.from('roles')
|
||||
.distinct('roles.slug')
|
||||
.leftJoin(userRole, `${userRole}.role_id`, 'roles.id')
|
||||
.where(`${userRole}.user_id`, userId)
|
||||
.then((res) => {
|
||||
return res.map((r) => r.slug);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue