feat: add attVisualOnly to inbox messages (#1499)
In case we'll need it... Reviewed-on: #1499 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
dd32e082f3
commit
a2f1469779
@ -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();
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user