
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@ideal-photography/shared
Advanced tools
Shared GraphQL (Apollo Server v5) and Mongoose logic for Ideal Photography PWAs: users, products, services, bookings, orders/cart, galleries, reviews, notifications, campaigns, settings, audit logs, and minimart items/orders.
A comprehensive shared package for photography business applications with GraphQL (Apollo Server v5) and Mongoose integration. It powers bookings, rentals, mini‑mart sales, client galleries, notifications, campaigns, settings, and admin workflows.
User
, Product
, Service
, Booking
, Order
(cart/checkout/payments), Gallery
, Review
, Notification
, Campaign
, Settings
, AuditLog
createApolloServer
, applyApolloMiddleware
) with merged typeDefs
/resolvers
requireAuth
, requireAdmin
, role/permission checks (pluggable JWT verification placeholder)@ideal-photography/shared/validations/common.js
)npm install @ideal-photography/shared
import express from 'express';
import { createApolloServer, applyApolloMiddleware, connectDB } from '@ideal-photography/shared';
const app = express();
// Connect to MongoDB
await connectDB(process.env.MONGODB_URI || 'mongodb://localhost:27017/ideal-photography');
// Create Apollo Server instance
const server = createApolloServer({
context: ({ req }) => ({
// Add authentication context here
user: req.user,
}),
});
// Apply Apollo middleware to Express app
await applyApolloMiddleware(app, server, {
context: ({ req }) => ({
user: req.user,
}),
});
app.listen(4000, () => {
console.log(`🚀 Server ready at http://localhost:4000/graphql`);
});
import express from 'express';
import { ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@as-integrations/express5';
import { typeDefs, resolvers, connectDB } from '@ideal-photography/shared';
const app = express();
// Connect to MongoDB
await connectDB(process.env.MONGODB_URI || 'mongodb://localhost:27017/ideal-photography');
// Create Apollo Server
const server = new ApolloServer({
typeDefs,
resolvers,
context: ({ req }) => ({
user: req.user,
}),
});
// Start server and apply middleware
await server.start();
app.use('/graphql', expressMiddleware(server, {
context: async ({ req }) => ({
user: req.user,
}),
}));
app.listen(4000, () => {
console.log(`🚀 Server ready at http://localhost:4000/graphql`);
});
import { models } from '@ideal-photography/shared';
// Create a user
const user = await models.User.create({
name: 'John Doe',
email: 'john@example.com',
password: 'securepassword123',
role: 'client'
});
// Create a booking
const booking = await models.Booking.create({
client: user._id,
product: productId,
date: new Date('2024-01-15'),
time: '14:00',
duration: 2,
totalAmount: 150,
location: {
type: 'studio',
address: '123 Studio St'
}
});
import {
isEmail,
isValidPrice,
isValidRating,
isValidBookingStatus
} from '@ideal-photography/shared/validations/common.js';
// Validate user input
if (!isEmail(email)) {
throw new Error('Invalid email format');
}
if (!isValidPrice(price)) {
throw new Error('Invalid price value');
}
me
, users
, user
, userByEmail
, stats/queuesmyCart
, myOrders
, orders
, order
, orderStats
, revenue series, overdue rentalsThe models include optimized indexes for common queries:
expiresAt
const { models } = require('@ideal-photography/shared/mongoDB');
// Create a photography service
const service = await models.Service.create({
name: 'Portrait Session',
description: 'Professional portrait photography session',
category: 'portrait',
basePrice: 150,
priceStructure: {
type: 'fixed',
packageDetails: '2-hour session with 20 edited photos'
},
duration: { min: 1, max: 3 },
includes: ['Professional editing', 'Online gallery', 'Print rights'],
deliverables: {
photos: { digital: 20, prints: 5 },
editedPhotos: 20,
deliveryTime: '7-10 days',
format: ['jpeg', 'raw']
}
});
// Create a booking
const booking = await models.Booking.create({
client: userId,
product: service._id,
date: new Date('2024-01-20'),
time: '15:00',
duration: 2,
totalAmount: 150,
location: {
type: 'studio',
address: '123 Photography Studio'
},
contactInfo: {
phone: '+1234567890',
email: 'client@example.com'
}
});
// Get dashboard statistics
const stats = await models.Booking.aggregate([
{ $match: { status: { $in: ['confirmed', 'completed'] } } },
{ $group: {
_id: null,
totalBookings: { $sum: 1 },
totalRevenue: { $sum: '$totalAmount' }
}}
]);
// Get pending reviews for moderation
const pendingReviews = await models.Review.find({ isApproved: false })
.populate('client')
.populate('booking')
.sort({ createdAt: -1 });
User
validations/common.js
If you're upgrading from Apollo Server v3, here are the key changes:
const { ApolloServer } = require('apollo-server-express');
const { typeDefs, resolvers } = require('@ideal-photography/shared/graphql');
const server = new ApolloServer({
typeDefs,
resolvers,
context: ({ req }) => ({ user: req.user }),
});
server.applyMiddleware({ app });
const { createApolloServer, applyApolloMiddleware } = require('@ideal-photography/shared/graphql');
const server = createApolloServer({
context: ({ req }) => ({ user: req.user }),
});
await applyApolloMiddleware(app, server);
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This package is provided under a proprietary license. See the LICENSE file for terms.
@apollo/client
- GraphQL client for React applications@apollo/server
- GraphQL server for Node.jsmongoose
- MongoDB object modeling for Node.jsBuilt with ❤️ for the photography community
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.