Skip to content

Commit

Permalink
Merge branch 'main' into timetable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nailsonseat authored Feb 16, 2024
2 parents 8afd129 + 1e51975 commit 47071cb
Show file tree
Hide file tree
Showing 31 changed files with 4,000 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter_build_apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: release-apk
path: frontend/build/app/outputs/apk/release/app-release.apk
path: frontend/build/app/outputs/apk/release/app-release.apk
4 changes: 3 additions & 1 deletion backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ import studentListResource from "./resources/student/studentListResource.js";
import facultyListResource from "./resources/faculty/facultyListResource.js";
import timetableListResource from "./resources/timetable/timetableListResource.js";
import timetableResource from "./resources/timetable/timetableResource.js";
import messageResource from './resources/chatroom/messageListResource.js'

const PORT = `${process.env.PORT || 3000}`;
const app = express();

app.use(logger("dev"));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(cors());

Expand All @@ -45,6 +46,7 @@ app.use("/", testResource);
app.use("/rooms", roomListResource);
app.use("/room", roomResource);
app.use("/lost-and-found", lostAndFoundListResource);
app.use("/messages",messageResource);

app.get("/protected", tokenRequired, (req, res) => {
res.json({ message: "Access granted" });
Expand Down
3 changes: 3 additions & 0 deletions backend/constants/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ export const tokenVerificationFailed =
"Token verification failed, authorization denied.";
export const invalidUserType = "Invalid user type";
export const tokenUpdateError = "Error updating token";
export const badRequest = "Bad request";
export const notFound = "Not found";
export const deleted = "Deleted";
20 changes: 20 additions & 0 deletions backend/models/message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import mongoose from "mongoose";

const MessageSchema = new mongoose.Schema({
sender: {
type: String,
required: true
},
content: {
type: String,
required: true
},
timestamp: {
type: Date,
default: Date.now()
}
});

const Message = mongoose.model('Message', MessageSchema);

export default Message;
Loading

0 comments on commit 47071cb

Please sign in to comment.