Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

returning share user data for GET /project

Blue Mouse9a126e43088e
diff --git a/src/project/project.service.ts b/src/project/project.service.ts
index 30d53d98e..e34bb441e 100644
--- a/src/project/project.service.ts
+++ b/src/project/project.service.ts
@@ -8,6 +8,7 @@ import * as _size from 'lodash/size'
import * as _join from 'lodash/join'
import * as _find from 'lodash/find'
import * as _map from 'lodash/map'
+import * as _pick from 'lodash/pick'
import * as _findIndex from 'lodash/findIndex'
import * as _includes from 'lodash/includes'
import * as dayjs from 'dayjs'
@@ -25,6 +26,22 @@ import {
dayjs.extend(utc)
+const processProjectUser = (projects: Project[]): Project[] => {
+ for (let i = 0; i < _size(projects); ++i) {
+ const { share } = projects[i]
+
+ for (let j = 0; j < _size(share); ++j) {
+ const { user } = share[j]
+
+ if (user) {
+ share[j].user = _pick(user, ['email'])
+ }
+ }
+ }
+
+ return projects
+}
+
@Injectable()
export class ProjectService {
constructor(
@@ -42,11 +59,11 @@ export class ProjectService {
order: {
name: 'ASC',
},
- relations: ['share'],
+ relations: ['share', 'share.user'],
})
return new Pagination<Project>({
- results,
+ results: processProjectUser(results),
total,
})
}