|
|
@@ -1,5 +1,6 @@
|
|
1
|
1
|
/** @module entities/grouping */
|
|
2
|
2
|
|
|
|
3
|
+import { ref } from 'vue'
|
|
3
|
4
|
import { _baseRecord } from '../index.js'
|
|
4
|
5
|
import { groupingSchema } from './grouping.schema.js'
|
|
5
|
6
|
import { revealProfileInfo } from '../../services/profile.service.js'
|
|
|
@@ -14,6 +15,7 @@ class Grouping extends _baseRecord {
|
|
14
|
15
|
*/
|
|
15
|
16
|
constructor({ ...membership }) {
|
|
16
|
17
|
super()
|
|
|
18
|
+ this._loading = ref(true)
|
|
17
|
19
|
|
|
18
|
20
|
this.type = this.constructor.name.toLowerCase()
|
|
19
|
21
|
this.tags = []
|
|
|
@@ -41,7 +43,26 @@ class Grouping extends _baseRecord {
|
|
41
|
43
|
return [this.profile.profile_id]
|
|
42
|
44
|
}
|
|
43
|
45
|
async reveal(profileId, tagId) {
|
|
44
|
|
- return await revealProfileInfo(this.grouping_id, profileId, tagId)
|
|
|
46
|
+ console.log('[Grouping Entity log]: Attempting to reveal...', tagId)
|
|
|
47
|
+ this._loading.value = true
|
|
|
48
|
+ try {
|
|
|
49
|
+ const revealed = await revealProfileInfo(
|
|
|
50
|
+ this.grouping_id,
|
|
|
51
|
+ profileId,
|
|
|
52
|
+ tagId,
|
|
|
53
|
+ )
|
|
|
54
|
+ if (!revealed.tags) {
|
|
|
55
|
+ throw `[Grouping Entity error]: Could not reveal ${tagId} for ${profileId}`
|
|
|
56
|
+ }
|
|
|
57
|
+ // Overwrite with new revealed tags completely
|
|
|
58
|
+ const toKeep = this.tags.filter(
|
|
|
59
|
+ assoc => assoc.profile_id != profileId,
|
|
|
60
|
+ )
|
|
|
61
|
+ this.tags = [...toKeep, ...revealed.tags]
|
|
|
62
|
+ } catch (err) {
|
|
|
63
|
+ console.error(err)
|
|
|
64
|
+ }
|
|
|
65
|
+ this._loading.value = false
|
|
45
|
66
|
}
|
|
46
|
67
|
/**
|
|
47
|
68
|
* validate this record
|