Add stub handlers for the complete application
No handler is implemented!
This commit is contained in:
parent
48164aea40
commit
420a366b38
|
@ -0,0 +1,16 @@
|
||||||
|
//! The root handlers
|
||||||
|
|
||||||
|
use rocket::get;
|
||||||
|
|
||||||
|
pub mod company;
|
||||||
|
pub mod customers;
|
||||||
|
pub mod invoices;
|
||||||
|
pub mod timeline;
|
||||||
|
|
||||||
|
/// Presents the dashboard/overview as start/home view
|
||||||
|
///
|
||||||
|
/// It lists the running tasks and projects per customer and shows a global summary.
|
||||||
|
#[get("/")]
|
||||||
|
pub fn index() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
//! The company (information) handlers
|
||||||
|
//!
|
||||||
|
//! These handlers are for showing and updating information of the company of the user.
|
||||||
|
|
||||||
|
use rocket::{get, post};
|
||||||
|
|
||||||
|
/// Shows a form with the company information that allows for updating it.
|
||||||
|
///
|
||||||
|
/// When updating, it will create a new revision. The handler allows showing other revisions.
|
||||||
|
// FIXME: Implement revisions!
|
||||||
|
#[get("/")]
|
||||||
|
pub fn index() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the company information by creating a new revision.
|
||||||
|
#[post("/")]
|
||||||
|
pub fn create() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
//! The customer handlers
|
||||||
|
//!
|
||||||
|
//! Handlers for viewing a list of existing customers or creating a new one.
|
||||||
|
|
||||||
|
use rocket::{delete, get, post, put};
|
||||||
|
|
||||||
|
pub mod invoices;
|
||||||
|
pub mod tasks;
|
||||||
|
|
||||||
|
/// Shows the list of customers.
|
||||||
|
#[get("/")]
|
||||||
|
pub fn index() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates a new customer and redirects to the show handler.
|
||||||
|
#[post("/")]
|
||||||
|
pub fn create() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provides the form for the data required to create a new customer.
|
||||||
|
#[get("/new")]
|
||||||
|
pub fn new() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shows a form for viewing and updating information of the customer with the given ID.
|
||||||
|
#[get("/<_id>")]
|
||||||
|
pub fn show(_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the customer with the given ID.
|
||||||
|
#[put("/<_id>")]
|
||||||
|
pub fn update(_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Destroys the customer with the given ID and redirects to the index handler.
|
||||||
|
#[delete("/<_id>")]
|
||||||
|
pub fn destroy(_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
//! The invoice handlers
|
||||||
|
//!
|
||||||
|
//! These handlers are for creating and viewing invoices for a specific customer.
|
||||||
|
|
||||||
|
use rocket::{get, post, put};
|
||||||
|
|
||||||
|
/// Creates a new invoice object for the customer the given ID.
|
||||||
|
///
|
||||||
|
/// A unique number is generated for the invoice by taking the year and a sequence number.
|
||||||
|
///
|
||||||
|
/// Fixed cost tasks are directly tied to the invoice.
|
||||||
|
///
|
||||||
|
/// For a task with an hourly rate, a task copy is created with the select time entries that need
|
||||||
|
/// to be billed and put in the invoice; the remaining unbilled time entries are left in the
|
||||||
|
/// original task.
|
||||||
|
#[post("/<_customer_id>/invoices")]
|
||||||
|
pub fn create(_customer_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Generates the form to create a new invoice object by listing unbulled fixed cost tasks and
|
||||||
|
/// unbilled registered time (for tasks with an hourly rate) of the customer with the given ID so
|
||||||
|
/// that a selection can be made.
|
||||||
|
#[get("/<_customer_id>/invoices/new")]
|
||||||
|
pub fn new(_customer_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shows a form for the invoice with the given number for the customer with the given ID
|
||||||
|
/// and shows a firm for updating it.
|
||||||
|
// FIXME: Handle PDF and LaTex generation here too!
|
||||||
|
#[get("/<_customer_id>/invoices/<_number>", rank = 2)] // Number could be "new"
|
||||||
|
pub fn show(_customer_id: u32, _number: String) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the invoices with the given number for the customer with the given ID.
|
||||||
|
#[put("/<_customer_id>/invoices/<_number>")]
|
||||||
|
pub fn update(_customer_id: u32, _number: String) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
//! The tasks handlers
|
||||||
|
//!
|
||||||
|
//! These handlers are for creating, editing and deleting a task for a specific customer.
|
||||||
|
|
||||||
|
use rocket::{delete, get, post, put};
|
||||||
|
|
||||||
|
/// Creates a new task oject for a customer with the given ID.
|
||||||
|
#[post("/<_customer_id>/tasks")]
|
||||||
|
pub fn create(_customer_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provides the form for the data required to create a new task for a customer with the given ID.
|
||||||
|
#[get("/<_customer_id>/tasks/new")]
|
||||||
|
pub fn new(_customer_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shows a form for viewing and updating information of the task with the given ID for
|
||||||
|
/// a customer with the given ID.
|
||||||
|
#[get("/<_customer_id>/tasks/<_id>", rank = 2)] // FIXME: Why is rank 2 necessary?
|
||||||
|
pub fn show(_customer_id: u32, _id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the task with the given ID for a customer with the given ID.
|
||||||
|
#[put("/<_customer_id>/tasks/<_id>")]
|
||||||
|
pub fn update(_customer_id: u32, _id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Destroys the task with the given ID of a customer with the given ID.
|
||||||
|
#[delete("/<_customer_id>/tasks/<_id>")]
|
||||||
|
pub fn destroy(_customer_id: u32, _id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
//! The invoices handlers
|
||||||
|
//!
|
||||||
|
//! The handler is used for showing a list of all invoices.
|
||||||
|
|
||||||
|
use rocket::get;
|
||||||
|
|
||||||
|
/// Shows a list of invoices, sorted per customer.
|
||||||
|
#[get("/")]
|
||||||
|
pub fn index() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
//! The timeline handlers
|
||||||
|
//!
|
||||||
|
//! These handlers are used for presenting a timeline of registered time and also for quickly
|
||||||
|
//! registering new time entries.
|
||||||
|
|
||||||
|
use rocket::{delete, get, post, put};
|
||||||
|
|
||||||
|
/// Retrieves all registered time entries in descending order to present the timeline.
|
||||||
|
#[get("/")]
|
||||||
|
pub fn index() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Registers a time entry and redirects back.
|
||||||
|
#[post("/")]
|
||||||
|
pub fn create() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shows a form for quickly registering time using a list of customers and tasks and the current
|
||||||
|
/// date and time.
|
||||||
|
#[get("/new")]
|
||||||
|
pub fn new() {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Show a form of the time entry with the given ID for updating it.
|
||||||
|
#[get("/<_id>")]
|
||||||
|
pub fn show(_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update the time entry with the given ID.
|
||||||
|
#[put("/<_id>")]
|
||||||
|
pub fn update(_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Destroys the time entry with the given ID.
|
||||||
|
#[delete("/<_id>")]
|
||||||
|
pub fn destroy(_id: u32) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
46
src/main.rs
46
src/main.rs
|
@ -1,19 +1,53 @@
|
||||||
#![feature(proc_macro_hygiene, decl_macro)]
|
#![feature(proc_macro_hygiene, decl_macro)]
|
||||||
|
|
||||||
use rocket::{get, routes, Rocket};
|
use rocket::{routes, Rocket};
|
||||||
use rocket_contrib::serve::StaticFiles;
|
use rocket_contrib::serve::StaticFiles;
|
||||||
|
|
||||||
#[get("/")]
|
pub mod handlers;
|
||||||
fn index() -> &'static str {
|
|
||||||
"Hello, world!"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn rocket() -> Rocket {
|
fn rocket() -> Rocket {
|
||||||
let static_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/static");
|
let static_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/static");
|
||||||
let static_files = StaticFiles::from(static_dir);
|
let static_files = StaticFiles::from(static_dir);
|
||||||
|
|
||||||
rocket::ignite()
|
rocket::ignite()
|
||||||
.mount("/", routes![index])
|
.mount("/", routes![handlers::index])
|
||||||
|
.mount(
|
||||||
|
"/company",
|
||||||
|
routes![handlers::company::index, handlers::company::create],
|
||||||
|
)
|
||||||
|
.mount(
|
||||||
|
"/customers",
|
||||||
|
routes![
|
||||||
|
handlers::customers::index,
|
||||||
|
handlers::customers::create,
|
||||||
|
handlers::customers::new,
|
||||||
|
handlers::customers::show,
|
||||||
|
handlers::customers::update,
|
||||||
|
handlers::customers::destroy,
|
||||||
|
handlers::customers::invoices::create,
|
||||||
|
handlers::customers::invoices::new,
|
||||||
|
handlers::customers::invoices::show,
|
||||||
|
handlers::customers::invoices::update,
|
||||||
|
handlers::customers::tasks::create,
|
||||||
|
handlers::customers::tasks::new,
|
||||||
|
handlers::customers::tasks::show,
|
||||||
|
handlers::customers::tasks::update,
|
||||||
|
handlers::customers::tasks::destroy,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
.mount("/invoices", routes![handlers::invoices::index])
|
||||||
.mount("/static", static_files)
|
.mount("/static", static_files)
|
||||||
|
.mount(
|
||||||
|
"/timeline",
|
||||||
|
routes![
|
||||||
|
handlers::timeline::index,
|
||||||
|
handlers::timeline::create,
|
||||||
|
handlers::timeline::new,
|
||||||
|
handlers::timeline::show,
|
||||||
|
handlers::timeline::update,
|
||||||
|
handlers::timeline::destroy,
|
||||||
|
],
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
Loading…
Reference in New Issue