feat: add attVisualOnly to inbox messages
All checks were successful
Build / build (18) (push) Successful in 40s
Build / build (20) (push) Successful in 1m12s
Build / build (22) (push) Successful in 1m7s
Build / build (18) (pull_request) Successful in 40s
Build / build (20) (pull_request) Successful in 1m12s
Build / build (22) (pull_request) Successful in 1m9s

This commit is contained in:
Sainan 2025-04-07 01:18:48 +02:00
parent 94993a16aa
commit 3a7b1f2abd
2 changed files with 7 additions and 3 deletions

View File

@ -34,8 +34,8 @@ export const inboxController: RequestHandler = async (req, res) => {
message.r = true; message.r = true;
await message.save(); await message.save();
const attachmentItems = message.att; const attachmentItems = message.attVisualOnly ? undefined : message.att;
const attachmentCountedItems = message.countedAtt; const attachmentCountedItems = message.attVisualOnly ? undefined : message.countedAtt;
if (!attachmentItems && !attachmentCountedItems && !message.gifts) { if (!attachmentItems && !attachmentCountedItems && !message.gifts) {
res.status(200).end(); res.status(200).end();

View File

@ -4,7 +4,8 @@ import { typeCountSchema } from "@/src/models/inventoryModels/inventoryModel";
import { IMongoDate, IOid } from "@/src/types/commonTypes"; import { IMongoDate, IOid } from "@/src/types/commonTypes";
import { ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes"; import { ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes";
export interface IMessageClient extends Omit<IMessageDatabase, "_id" | "date" | "startDate" | "endDate" | "ownerId"> { export interface IMessageClient
extends Omit<IMessageDatabase, "_id" | "date" | "startDate" | "endDate" | "ownerId" | "attVisualOnly"> {
_id?: IOid; _id?: IOid;
date: IMongoDate; date: IMongoDate;
startDate?: IMongoDate; startDate?: IMongoDate;
@ -29,6 +30,7 @@ export interface IMessage {
endDate?: Date; endDate?: Date;
att?: string[]; att?: string[];
countedAtt?: ITypeCount[]; countedAtt?: ITypeCount[];
attVisualOnly?: boolean;
transmission?: string; transmission?: string;
arg?: Arg[]; arg?: Arg[];
gifts?: IGift[]; gifts?: IGift[];
@ -108,6 +110,7 @@ const messageSchema = new Schema<IMessageDatabase>(
att: { type: [String], default: undefined }, att: { type: [String], default: undefined },
gifts: { type: [giftSchema], default: undefined }, gifts: { type: [giftSchema], default: undefined },
countedAtt: { type: [typeCountSchema], default: undefined }, countedAtt: { type: [typeCountSchema], default: undefined },
attVisualOnly: Boolean,
transmission: String, transmission: String,
arg: { arg: {
type: [ type: [
@ -141,6 +144,7 @@ messageSchema.set("toJSON", {
delete returnedObject._id; delete returnedObject._id;
delete returnedObject.__v; delete returnedObject.__v;
delete returnedObject.attVisualOnly;
messageClient.date = toMongoDate(messageDatabase.date); messageClient.date = toMongoDate(messageDatabase.date);