forked from OpenWF/SpaceNinjaServer
feat: add attVisualOnly to inbox messages (#1499)
In case we'll need it... Reviewed-on: OpenWF/SpaceNinjaServer#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;
|
||||
await message.save();
|
||||
|
||||
const attachmentItems = message.att;
|
||||
const attachmentCountedItems = message.countedAtt;
|
||||
const attachmentItems = message.attVisualOnly ? undefined : message.att;
|
||||
const attachmentCountedItems = message.attVisualOnly ? undefined : message.countedAtt;
|
||||
|
||||
if (!attachmentItems && !attachmentCountedItems && !message.gifts) {
|
||||
res.status(200).end();
|
||||
|
@ -4,7 +4,8 @@ import { typeCountSchema } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||
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;
|
||||
date: IMongoDate;
|
||||
startDate?: IMongoDate;
|
||||
@ -29,6 +30,7 @@ export interface IMessage {
|
||||
endDate?: Date;
|
||||
att?: string[];
|
||||
countedAtt?: ITypeCount[];
|
||||
attVisualOnly?: boolean;
|
||||
transmission?: string;
|
||||
arg?: Arg[];
|
||||
gifts?: IGift[];
|
||||
@ -108,6 +110,7 @@ const messageSchema = new Schema<IMessageDatabase>(
|
||||
att: { type: [String], default: undefined },
|
||||
gifts: { type: [giftSchema], default: undefined },
|
||||
countedAtt: { type: [typeCountSchema], default: undefined },
|
||||
attVisualOnly: Boolean,
|
||||
transmission: String,
|
||||
arg: {
|
||||
type: [
|
||||
@ -141,6 +144,7 @@ messageSchema.set("toJSON", {
|
||||
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
delete returnedObject.attVisualOnly;
|
||||
|
||||
messageClient.date = toMongoDate(messageDatabase.date);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user