@boarteam/boar-pack-users-backend 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boarteam/boar-pack-users-backend",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "NestJS Users module including permissions system, authentication strategies etc",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"files": [
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"yalc:push": "yalc push",
|
|
61
61
|
"gen-types": "SWAGGER=true JWT_SECRET=swagger nest start"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "acc7ba1cd1fa8a4972efed9ece60a50740370396"
|
|
64
64
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm';
|
|
1
|
+
import { Column, CreateDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm';
|
|
2
2
|
import { User } from "../../users";
|
|
3
3
|
|
|
4
4
|
export enum LogType {
|
|
@@ -113,6 +113,7 @@ export class EventLog {
|
|
|
113
113
|
})
|
|
114
114
|
statusCode: number | null;
|
|
115
115
|
|
|
116
|
+
@Index()
|
|
116
117
|
@Column({
|
|
117
118
|
default: 'main'
|
|
118
119
|
})
|
|
@@ -65,4 +65,16 @@ export class EventLogsController implements CrudController<EventLog>{
|
|
|
65
65
|
const end = query.endTime ? new Date(query.endTime) : undefined;
|
|
66
66
|
return this.service.getTimeline(start, end, query.timezone);
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
@CheckPolicies(new ViewEventLogsPolicy())
|
|
70
|
+
@Get('service-names')
|
|
71
|
+
@ApiOkResponse({
|
|
72
|
+
schema: {
|
|
73
|
+
type: 'array',
|
|
74
|
+
items: { type: 'string' },
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
async getServiceNames(): Promise<string[]> {
|
|
78
|
+
return this.service.getServiceNames();
|
|
79
|
+
}
|
|
68
80
|
}
|
|
@@ -163,6 +163,15 @@ export class EventLogsService extends TypeOrmCrudService<EventLog> {
|
|
|
163
163
|
]);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
async getServiceNames(): Promise<string[]> {
|
|
167
|
+
const result = await this.repo
|
|
168
|
+
.createQueryBuilder('event_logs')
|
|
169
|
+
.select('event_logs.service')
|
|
170
|
+
.distinctOn(['service'])
|
|
171
|
+
.getMany();
|
|
172
|
+
return result.map((data) => data.service);
|
|
173
|
+
}
|
|
174
|
+
|
|
166
175
|
private async getOldestLogDate(): Promise<Date> {
|
|
167
176
|
const oldestLog = await this.repo.createQueryBuilder('event_log')
|
|
168
177
|
.select('MIN(event_log.createdAt)', 'min')
|