MoodCat / MoodCat.me-Core

Welcome to MoodCat.me, the music platform of the future, available today. Join us in the adventure of finding and enjoying music geared to you!
http://moodcat.me
MIT License
3 stars 2 forks source link

Combined pull request for #172 #173 #174 #176 and #179 #180

Closed jwgmeligmeyling closed 9 years ago

jwgmeligmeyling commented 9 years ago

Reworked Room backend

jwgmeligmeyling commented 9 years ago
--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'LATIN1';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: classification; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE classification (
    id integer NOT NULL,
    location geometry,
    room_id integer,
    song_id integer NOT NULL,
    user_id integer NOT NULL
);

ALTER TABLE classification OWNER TO postgres;

--
-- Name: classification_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE classification_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE classification_id_seq OWNER TO postgres;

--
-- Name: classification_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE classification_id_seq OWNED BY classification.id;

--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY classification ALTER COLUMN id SET DEFAULT nextval('classification_id_seq'::regclass);

--
-- Data for Name: classification; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY classification (id, location, room_id, song_id, user_id) FROM stdin;
\.

--
-- Name: classification_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('classification_id_seq', 1, false);

--
-- Name: classification_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY classification
    ADD CONSTRAINT classification_pkey PRIMARY KEY (id);

--
-- Name: unique_classification_song_user; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY classification
    ADD CONSTRAINT unique_classification_song_user UNIQUE (song_id, user_id, room_id);

--
-- Name: fk_36qb4bxhtqkivshynigm7kf4e; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY classification
    ADD CONSTRAINT fk_36qb4bxhtqkivshynigm7kf4e FOREIGN KEY (room_id) REFERENCES room(id);

--
-- Name: fk_oe0povlppswamdvwv5plghfq4; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY classification
    ADD CONSTRAINT fk_oe0povlppswamdvwv5plghfq4 FOREIGN KEY (user_id) REFERENCES users(id);

--
-- Name: fk_sbs7q175bekouphuqae4tlpiw; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY classification
    ADD CONSTRAINT fk_sbs7q175bekouphuqae4tlpiw FOREIGN KEY (song_id) REFERENCES song(id);

--
-- PostgreSQL database dump complete
--
jwgmeligmeyling commented 9 years ago

Added one more commit that prevents points from being added when a duplicate classification request or vote gets rejected. Verified it works on both the test runner and postgres.

jwgmeligmeyling commented 9 years ago

Looks good, but two method removals are unnecessairy imo :smile:

TimvdLippe commented 9 years ago

These methods are so small, we could easily recreate them when we actually need them. Currently I don't see any point in keeping them, they only bloat the code.