the town , founded in 1770 , was the capital of california under the spanish , mexican and american flags , and the site of the constitutional convention that preceded california 's admission into the union in 1850 . ;