Sum-frequency generation at molecule-nanostructure interfaces from diagrammatic theory of nonlinear optics