
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
ideal-photography-shared
Advanced tools
Shared GraphQL and Mongoose logic for Ideal Photography PWAs - Complete photography business models with authentication, bookings, galleries, reviews, and admin management
A comprehensive shared package for photography business applications with GraphQL and Mongoose integration. Perfect for building photography booking systems, gallery management, client portals, and admin panels.
npm install ideal-photography-shared
const express = require('express');
const { ApolloServer } = require('apollo-server-express');
const { typeDefs, resolvers } = require('ideal-photography-shared/graphql');
const { mongoose } = require('ideal-photography-shared/mongoDB');
const app = express();
// Connect to MongoDB
mongoose.connect('mongodb://localhost:27017/ideal-photography', {
useNewUrlParser: true,
useUnifiedTopology: true,
});
// Set up Apollo Server
const server = new ApolloServer({
typeDefs,
resolvers,
context: ({ req }) => ({
// Add authentication context here
user: req.user,
}),
});
server.applyMiddleware({ app });
app.listen(4000, () => {
console.log(`🚀 Server ready at http://localhost:4000${server.graphqlPath}`);
});
const { models } = require('ideal-photography-shared/mongoDB');
// 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'
}
});
const {
isEmail,
isValidPrice,
isValidRating,
isValidBookingStatus
} = require('ideal-photography-shared/validations/common');
// Validate user input
if (!isEmail(email)) {
throw new Error('Invalid email format');
}
if (!isValidPrice(price)) {
throw new Error('Invalid price value');
}
The models include optimized indexes for common queries:
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 });
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
@apollo/client
- GraphQL client for React applicationsapollo-server-express
- GraphQL server for Expressmongoose
- 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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.