Merge remote-tracking branch 'refs/remotes/gh/dev' into dev
This commit is contained in:
commit
0bd1fc5397
5 changed files with 31 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@
|
||||||
*.dylib
|
*.dylib
|
||||||
|
|
||||||
bin
|
bin
|
||||||
|
database.txt
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
*.png
|
*.png
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ migrate:
|
||||||
db.sqlite3:
|
db.sqlite3:
|
||||||
make migrate
|
make migrate
|
||||||
|
|
||||||
|
dbdump:
|
||||||
|
sqlite3 $(DB_FILE) .dump > database.txt
|
||||||
|
|
||||||
backup:
|
backup:
|
||||||
mkdir -p backups
|
mkdir -p backups
|
||||||
sqlite3 $(DB_FILE) .dump | gzip -9 > ./backups/BACKUP_$(DB_FILE)_$(shell date +"%Y-%m-%d_%H:%M:%S").sql.gz
|
sqlite3 $(DB_FILE) .dump | gzip -9 > ./backups/BACKUP_$(DB_FILE)_$(shell date +"%Y-%m-%d_%H:%M:%S").sql.gz
|
||||||
|
|
|
@ -71,6 +71,7 @@ func main() {
|
||||||
|
|
||||||
server.Post("/api/loginrenew", gs.LoginRenew)
|
server.Post("/api/loginrenew", gs.LoginRenew)
|
||||||
server.Delete("/api/userdelete", gs.UserDelete) // Perhaps just use POST to avoid headaches
|
server.Delete("/api/userdelete", gs.UserDelete) // Perhaps just use POST to avoid headaches
|
||||||
|
server.Post("/api/project", gs.CreateProject)
|
||||||
|
|
||||||
// Announce the port we are listening on and start the server
|
// Announce the port we are listening on and start the server
|
||||||
err = server.Listen(fmt.Sprintf(":%d", conf.Port))
|
err = server.Listen(fmt.Sprintf(":%d", conf.Port))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { NewProject, Project } from "../Types/Project";
|
||||||
import { NewUser, User } from "../Types/Users";
|
import { NewUser, User } from "../Types/Users";
|
||||||
|
|
||||||
// Defines all the methods that an instance of the API must implement
|
// Defines all the methods that an instance of the API must implement
|
||||||
|
@ -6,6 +7,8 @@ interface API {
|
||||||
registerUser(user: NewUser): Promise<User>;
|
registerUser(user: NewUser): Promise<User>;
|
||||||
/** Remove a user */
|
/** Remove a user */
|
||||||
removeUser(username: string): Promise<User>;
|
removeUser(username: string): Promise<User>;
|
||||||
|
/** Create a project */
|
||||||
|
createProject(project: NewProject): Promise<Project>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export an instance of the API
|
// Export an instance of the API
|
||||||
|
@ -29,4 +32,14 @@ export const api: API = {
|
||||||
body: JSON.stringify(username),
|
body: JSON.stringify(username),
|
||||||
}).then((res) => res.json() as Promise<User>);
|
}).then((res) => res.json() as Promise<User>);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async createProject(project: NewProject): Promise<Project> {
|
||||||
|
return fetch("/api/project", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(project),
|
||||||
|
}).then((res) => res.json() as Promise<Project>);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
13
frontend/src/Types/Project.ts
Normal file
13
frontend/src/Types/Project.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
export interface Project {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
owner: string;
|
||||||
|
created: string; // This is a date
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NewProject {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
owner: string;
|
||||||
|
}
|
Loading…
Reference in a new issue