mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 17:26:26 +01:00
Initial commit
This commit is contained in:
commit
241b947f92
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# cache
|
||||||
|
**/__pycache__
|
||||||
|
|
||||||
|
# config
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
# data
|
||||||
|
partitioncloud/partitioncloud.db
|
||||||
|
|
30
make.sh
Executable file
30
make.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
init () {
|
||||||
|
if [ ! -x partitioncloud/partitioncloud.db ]; then
|
||||||
|
printf "Souhaitez vous supprimer la base de données existante ? [y/n] "
|
||||||
|
read -r CONFIRMATION
|
||||||
|
fi
|
||||||
|
[[ $CONFIRMATION == y ]] || exit 1
|
||||||
|
sqlite3 "partitioncloud/partitioncloud.db" '.read partitioncloud/schema.sql'
|
||||||
|
echo "Base de données initialisée"
|
||||||
|
}
|
||||||
|
|
||||||
|
start () {
|
||||||
|
flask run
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
usage () {
|
||||||
|
echo "Usage:"
|
||||||
|
echo -e "\t$0 init"
|
||||||
|
echo -e "\t$0 start"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $1 && $(type "$1") = *"is a"*"function"* || $(type "$1") == *"est une fonction"* ]]; then
|
||||||
|
$1 ${*:2} # Call the function
|
||||||
|
else
|
||||||
|
usage
|
||||||
|
echo $(type "$1")
|
||||||
|
exit 1
|
||||||
|
fi;
|
36
partitioncloud/schema.sql
Normal file
36
partitioncloud/schema.sql
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
DROP TABLE IF EXISTS user;
|
||||||
|
DROP TABLE IF EXISTS partition;
|
||||||
|
DROP TABLE IF EXISTS album;
|
||||||
|
DROP TABLE IF EXISTS contient_partition;
|
||||||
|
DROP TABLE IF EXISTS contient_user;
|
||||||
|
|
||||||
|
CREATE TABLE user (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
username TEXT UNIQUE NOT NULL,
|
||||||
|
password TEXT NOT NULL,
|
||||||
|
access_level INTEGER NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE partition (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
author TEXT,
|
||||||
|
body TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE album (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
name TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE contient_partition (
|
||||||
|
partition_id INTEGER NOT NULL,
|
||||||
|
album_id INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (partition_id, album_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE contient_user (
|
||||||
|
user_id INTEGER NOT NULL,
|
||||||
|
album_id INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (user_id, album_id)
|
||||||
|
);
|
Loading…
Reference in New Issue
Block a user