diff --git a/src/app/views/groups.zig b/src/app/views/groups.zig new file mode 100644 index 0000000..85505c8 --- /dev/null +++ b/src/app/views/groups.zig @@ -0,0 +1,104 @@ +const std = @import("std"); +const jetzig = @import("jetzig"); + +pub fn index(request: *jetzig.Request) !jetzig.View { + return request.render(.ok); +} + +pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View { + _ = id; + return request.render(.ok); +} + +pub fn new(request: *jetzig.Request) !jetzig.View { + return request.render(.ok); +} + +pub fn edit(id: []const u8, request: *jetzig.Request) !jetzig.View { + _ = id; + return request.render(.ok); +} + +pub fn post(request: *jetzig.Request) !jetzig.View { + return request.render(.created); +} + +pub fn put(id: []const u8, request: *jetzig.Request) !jetzig.View { + _ = id; + return request.render(.ok); +} + +pub fn patch(id: []const u8, request: *jetzig.Request) !jetzig.View { + _ = id; + return request.render(.ok); +} + +pub fn delete(id: []const u8, request: *jetzig.Request) !jetzig.View { + _ = id; + return request.render(.ok); +} + + +test "index" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.GET, "/groups", .{}); + try response.expectStatus(.ok); +} + +test "get" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.GET, "/groups/example-id", .{}); + try response.expectStatus(.ok); +} + +test "new" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.GET, "/groups/new", .{}); + try response.expectStatus(.ok); +} + +test "edit" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.GET, "/groups/example-id/edit", .{}); + try response.expectStatus(.ok); +} + +test "post" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.POST, "/groups", .{}); + try response.expectStatus(.created); +} + +test "put" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.PUT, "/groups/example-id", .{}); + try response.expectStatus(.ok); +} + +test "patch" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.PATCH, "/groups/example-id", .{}); + try response.expectStatus(.ok); +} + +test "delete" { + var app = try jetzig.testing.app(std.testing.allocator, @import("routes")); + defer app.deinit(); + + const response = try app.request(.DELETE, "/groups/example-id", .{}); + try response.expectStatus(.ok); +} diff --git a/src/app/views/groups/delete.zmpl b/src/app/views/groups/delete.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/delete.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +
diff --git a/src/app/views/groups/edit.zmpl b/src/app/views/groups/edit.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/edit.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +
diff --git a/src/app/views/groups/get.zmpl b/src/app/views/groups/get.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/get.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +
diff --git a/src/app/views/groups/index.zmpl b/src/app/views/groups/index.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/index.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +
diff --git a/src/app/views/groups/new.zmpl b/src/app/views/groups/new.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/new.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +
diff --git a/src/app/views/groups/patch.zmpl b/src/app/views/groups/patch.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/patch.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +
diff --git a/src/app/views/groups/post.zmpl b/src/app/views/groups/post.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/post.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +
diff --git a/src/app/views/groups/put.zmpl b/src/app/views/groups/put.zmpl new file mode 100644 index 0000000..76457d0 --- /dev/null +++ b/src/app/views/groups/put.zmpl @@ -0,0 +1,3 @@ +
+ Content goes here +