2025-03-27 03:33:08 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { GuildMember } from "@/src/models/guildModel";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { getInventory } from "@/src/services/inventoryService";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { getAccountIdForRequest } from "@/src/services/loginService";
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-01 02:28:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { IGuildMemberClient } from "@/src/types/guildTypes";
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-27 03:33:08 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { RequestHandler } from "express";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export const getGuildContributionsController: RequestHandler = async (req, res) => {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const accountId = await getAccountIdForRequest(req);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const guildId = (await getInventory(accountId, "GuildId")).GuildId;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const guildMember = (await GuildMember.findOne({ guildId, accountId: req.query.buddyId }))!;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    res.json({
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-01 02:28:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        _id: { $oid: req.query.buddyId as string },
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-27 03:33:08 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        RegularCreditsContributed: guildMember.RegularCreditsContributed,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        PremiumCreditsContributed: guildMember.PremiumCreditsContributed,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        MiscItemsContributed: guildMember.MiscItemsContributed,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ConsumablesContributed: [], // ???
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ShipDecorationsContributed: guildMember.ShipDecorationsContributed
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-01 02:28:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } satisfies Partial<IGuildMemberClient>);
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-27 03:33:08 -07:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 |