Closed FilipJany closed 10 years ago
Nie udało mi się zreprodukować błędu. U mnie działa na obu komputerach.
?> curl http://localhost:5000/recipes/3
{
"author_id": 1,
"author_name": "user0@gmail.com",
"creation_date": "",
"difficultyMark": "",
"dish_name": "Old-Fashioned Pancakes",
"eventToAdminControl": "",
"id": 3,
"ingredients": [
{
"amount": 1,
"ingr_name": "all-purpose flour",
"unit_name": "cups"
},
{
"amount": 3,
"ingr_name": "baking powder",
"unit_name": "teaspoons"
},
{
"amount": 1,
"ingr_name": "salt",
"unit_name": "teaspoon"
},
{
"amount": 1,
"ingr_name": "white sugar",
"unit_name": "tablespoon"
},
{
"amount": 3,
"ingr_name": "butter, melted",
"unit_name": "tablespoons"
},
{
"amount": 1,
"ingr_name": "egg",
"unit_name": ""
},
{
"amount": 1,
"ingr_name": "milk",
"unit_name": "cups"
},
{
"amount": 1,
"ingr_name": "cooking spray",
"unit_name": ""
}
],
"portions": "Sift together flour, baking powder, salt, and sugar in a large bowl.\nWhisk in melted butter, egg, and milk until combined. Let batter rest for 5 minutes.\nPreheat a large skillet over medium-high heat. Spray with cooking spray. Pour batter into the hot skillet, about 1/4 cup of batter for each pancake. Cook for 2 to 3 minutes, until bubbles appear on the sides and center of each pancake. Flip and cook until golden, about 1 to 2 minutes.",
"preparation_time": "",
"rank": "",
"recipe_text": "25 mins",
"tags": [
{
"id": 2,
"name": "Tag2",
"type": ""
},
{
"id": 3,
"name": "Tag3",
"type": ""
},
{
"id": 4,
"name": "Tag4",
"type": ""
},
{
"id": 5,
"name": "Tag5",
"type": ""
},
{
"id": 6,
"name": "Tag6",
"type": ""
},
{
"id": 8,
"name": "Tag8",
"type": ""
},
{
"id": 13,
"name": "Tag13",
"type": ""
},
{
"id": 14,
"name": "Tag14",
"type": ""
},
{
"id": 16,
"name": "Tag16",
"type": ""
},
{
"id": 22,
"name": "Tag22",
"type": ""
},
{
"id": 23,
"name": "Tag23",
"type": ""
},
{
"id": 29,
"name": "Tag29",
"type": ""
},
{
"id": 31,
"name": "Tag31",
"type": ""
},
{
"id": 32,
"name": "Tag32",
"type": ""
},
{
"id": 34,
"name": "Tag34",
"type": ""
},
{
"id": 35,
"name": "Tag35",
"type": ""
},
{
"id": 36,
"name": "Tag36",
"type": ""
},
{
"id": 37,
"name": "Tag37",
"type": ""
},
{
"id": 38,
"name": "Tag38",
"type": ""
},
{
"id": 39,
"name": "Tag39",
"type": ""
},
{
"id": 40,
"name": "Tag40",
"type": ""
},
{
"id": 45,
"name": "Tag45",
"type": ""
},
{
"id": 48,
"name": "Tag48",
"type": ""
},
{
"id": 49,
"name": "Tag49",
"type": ""
},
{
"id": 53,
"name": "Tag53",
"type": ""
},
{
"id": 54,
"name": "Tag54",
"type": ""
},
{
"id": 55,
"name": "Tag55",
"type": ""
},
{
"id": 56,
"name": "Tag56",
"type": ""
},
{
"id": 59,
"name": "Tag59",
"type": ""
},
{
"id": 60,
"name": "Tag60",
"type": ""
},
{
"id": 61,
"name": "Tag61",
"type": ""
},
{
"id": 65,
"name": "Tag65",
"type": ""
},
{
"id": 68,
"name": "Tag68",
"type": ""
},
{
"id": 69,
"name": "Tag69",
"type": ""
},
{
"id": 70,
"name": "Tag70",
"type": ""
},
{
"id": 72,
"name": "Tag72",
"type": ""
},
{
"id": 74,
"name": "Tag74",
"type": ""
},
{
"id": 78,
"name": "Tag78",
"type": ""
},
{
"id": 79,
"name": "Tag79",
"type": ""
},
{
"id": 80,
"name": "Tag80",
"type": ""
},
{
"id": 83,
"name": "Tag83",
"type": ""
},
{
"id": 84,
"name": "Tag84",
"type": ""
},
{
"id": 86,
"name": "Tag86",
"type": ""
},
{
"id": 88,
"name": "Tag88",
"type": ""
},
{
"id": 90,
"name": "Tag90",
"type": ""
},
{
"id": 92,
"name": "Tag92",
"type": ""
},
{
"id": 94,
"name": "Tag94",
"type": ""
},
{
"id": 97,
"name": "Tag97",
"type": ""
},
{
"id": 98,
"name": "Tag98",
"type": ""
},
{
"id": 99,
"name": "Tag99",
"type": ""
},
{
"id": 100,
"name": "Tag100",
"type": ""
}
],
"tasteMark": ""
}
Możliwe, że problem leży w Twojej bazie danych, schemat mojej jest następujący.
CREATE TABLE "Unit" (
id INTEGER NOT NULL,
unit_name VARCHAR(40),
unit_value FLOAT,
other_id INTEGER,
PRIMARY KEY (id),
UNIQUE (unit_name),
FOREIGN KEY(other_id) REFERENCES "Unit" (id)
);
CREATE TABLE "Ingredient" (
id INTEGER NOT NULL,
name VARCHAR(100),
PRIMARY KEY (id)
);
CREATE TABLE "User" (
id INTEGER NOT NULL,
email VARCHAR(128) NOT NULL,
salt VARCHAR(128) NOT NULL,
password VARCHAR(128) NOT NULL,
type VARCHAR(13),
PRIMARY KEY (id),
UNIQUE (email),
CONSTRAINT "UserType" CHECK (type IN ('COMMON', 'ADMINISTRATOR'))
);
CREATE TABLE "Tag" (
id INTEGER NOT NULL,
name VARCHAR(40),
type VARCHAR(39),
PRIMARY KEY (id),
UNIQUE (name)
);
CREATE TABLE "Recipe" (
id INTEGER NOT NULL,
dish_name VARCHAR(120),
author_id INTEGER,
creation_date DATETIME,
preparation_time SMALLINT,
recipe_text TEXT,
"tasteMark" FLOAT,
"difficultyMark" FLOAT,
rank FLOAT,
"eventToAdminControl" BOOLEAN,
portions SMALLINT,
PRIMARY KEY (id),
FOREIGN KEY(author_id) REFERENCES "User" (id),
CHECK ("eventToAdminControl" IN (0, 1))
);
CREATE TABLE "IngredientUnit" (
id INTEGER NOT NULL,
unit_id INTEGER,
ingredient_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(unit_id) REFERENCES "Unit" (id),
FOREIGN KEY(ingredient_id) REFERENCES "Ingredient" (id)
);
CREATE TABLE tag_assignment (
recipe INTEGER,
tag INTEGER,
FOREIGN KEY(recipe) REFERENCES "Recipe" (id),
FOREIGN KEY(tag) REFERENCES "Tag" (id)
);
CREATE TABLE favour_recipes (
user INTEGER,
recipe INTEGER,
FOREIGN KEY(user) REFERENCES "User" (id),
FOREIGN KEY(recipe) REFERENCES "Recipe" (id)
);
CREATE TABLE "IngredientAssociation" (
id INTEGER NOT NULL,
recipe_id INTEGER,
ingredient_unit_id INTEGER,
amount INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(recipe_id) REFERENCES "Recipe" (id),
FOREIGN KEY(ingredient_unit_id) REFERENCES "IngredientUnit" (id)
);
CREATE TABLE "Comment" (
id INTEGER NOT NULL,
text TEXT,
taste FLOAT,
difficulty FLOAT,
date DATETIME,
author_id INTEGER,
recipe_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(author_id) REFERENCES "User" (id),
FOREIGN KEY(recipe_id) REFERENCES "Recipe" (id)
);
CREATE TABLE "Photo" (
id INTEGER NOT NULL,
recipe_id INTEGER NOT NULL,
full_data BLOB NOT NULL,
mini_data BLOB,
PRIMARY KEY (id),
FOREIGN KEY(recipe_id) REFERENCES "Recipe" (id)
);
CREATE TABLE "Rate" (
id INTEGER NOT NULL,
author_id INTEGER,
recipe_id INTEGER,
taste_rate SMALLINT,
difficulty_rate SMALLINT,
PRIMARY KEY (id),
FOREIGN KEY(author_id) REFERENCES "User" (id),
FOREIGN KEY(recipe_id) REFERENCES "Recipe" (id)
);
porównaj proszę ze swoją bazą poprzez jakiegoś znośnego diffa :-)
PS. Schemat można uzyskać poprzez komendę sqlite3 /sciezka/do/bazy ".schema"
Ok, jak skoncze z AOD to zajme sie tym :)
Czy to ze u mnie wydrukowalo tabele w innej kolejnosci moze byc przyczyna?
Nie raczej nie
Nie powtarza sie juz, wiec zamykam
Trace recived from server (newest api version):