update
This commit is contained in:
parent
ed14ddad0c
commit
4a0138297e
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "misskey",
|
||||
"version": "2024.5.0-beta1-mattyatea1",
|
||||
"version": "2024.5.0-beta1-mattyatea2",
|
||||
"codename": "nasubi",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import {Column} from "typeorm";
|
||||
|
||||
export class Loginbonus1715787239605 {
|
||||
name = 'Loginbonus1715787239605'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "getPoints" integer NOT NULL DEFAULT '0'`); }
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "getPoints"`); }
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "getPoints"`); }
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "getPoints" integer NOT NULL DEFAULT '0'`); }
|
||||
}
|
||||
|
|
13
packages/backend/migration/1715791271605-loginbonus1.js
Normal file
13
packages/backend/migration/1715791271605-loginbonus1.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
export class Loginbonus11715791271605 {
|
||||
name = 'Loginbonus11715791271605'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "getPoints"`);
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "getPoints" integer NOT NULL DEFAULT '0'`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "getPoints"`);
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" ADD "getPoints" integer NOT NULL DEFAULT '0'`);
|
||||
}
|
||||
}
|
|
@ -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…
Reference in a new issue