update
This commit is contained in:
parent
ed14ddad0c
commit
4a0138297e
7 changed files with 29 additions and 11 deletions
|
|
@ -471,9 +471,8 @@ export class UserEntityService implements OnModuleInit {
|
|||
createdAt: this.idService.parse(announcement.id).date.toISOString(),
|
||||
...announcement,
|
||||
})) : null;
|
||||
|
||||
console.log(user.getPoints);
|
||||
const notificationsInfo = isMe && isDetailed ? await this.getNotificationsInfo(user.id) : null;
|
||||
|
||||
const packed = {
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ export class MiUser {
|
|||
})
|
||||
public lastFetchedAt: Date | null;
|
||||
|
||||
@Column('integer', {
|
||||
default: '0',
|
||||
})
|
||||
public getPoints: number;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
nullable: true,
|
||||
|
|
|
|||
|
|
@ -261,10 +261,6 @@ export class MiUserProfile {
|
|||
length: 32, array: true, default: '{}',
|
||||
})
|
||||
public loggedInDates: string[];
|
||||
@Column('integer', {
|
||||
default: '0',
|
||||
})
|
||||
public getPoints: number;
|
||||
|
||||
@Column('jsonb', {
|
||||
default: [],
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { UserProfilesRepository } from '@/models/_.js';
|
||||
import type { UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
|
@ -44,6 +44,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
constructor(
|
||||
@Inject(DI.userProfilesRepository)
|
||||
private userProfilesRepository: UserProfilesRepository,
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
||||
private notificationService: NotificationService,
|
||||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
|
|
@ -70,7 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.userProfilesRepository.update({ userId: user.id }, {
|
||||
loggedInDates: [...userProfile.loggedInDates, today],
|
||||
});
|
||||
this.userProfilesRepository.update({ userId: user.id }, {
|
||||
this.usersRepository.update({ userId: user.id }, {
|
||||
getPoints: userProfile.getPoints + todayGetPoints,
|
||||
});
|
||||
this.notificationService.createNotification(user.id, 'loginbonus', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue