Skip to content

Commit

Permalink
Student File upload changes added
Browse files Browse the repository at this point in the history
  • Loading branch information
lahirulakruwan committed Jan 3, 2025
1 parent 48584d3 commit 8003cff
Show file tree
Hide file tree
Showing 6 changed files with 819 additions and 13 deletions.
4 changes: 4 additions & 0 deletions api/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ HOST="localhost"
PASSWORD="Admin@#123"
PORT=3306
USER="root"
GOOGLEDRIVECLIENTID=""
GOOGLEDRIVECLIENTSECRET=""
GOOGLEDRIVEREFRESHTOKEN=""
GOOGLEDRIVEREFRESHURL= ""
38 changes: 35 additions & 3 deletions api/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "mime"},
{org = "ballerina", name = "regex"},
{org = "ballerina", name = "sql"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "time"},
{org = "ballerinai", name = "observe"},
{org = "ballerinai", name = "transaction"},
{org = "ballerinax", name = "googleapis.drive"},
{org = "ballerinax", name = "mysql"},
{org = "ballerinax", name = "mysql.driver"}
]
Expand Down Expand Up @@ -113,7 +115,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.17"
version = "2.10.19"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -141,7 +143,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "io"
version = "1.6.1"
version = "1.6.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
Expand Down Expand Up @@ -283,6 +285,9 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.int"}
]
modules = [
{org = "ballerina", packageName = "mime", moduleName = "mime"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -395,7 +400,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "websocket"
version = "2.10.2"
version = "2.10.3"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "constraint"},
Expand Down Expand Up @@ -445,6 +450,33 @@ modules = [
{org = "ballerinai", packageName = "transaction", moduleName = "transaction"}
]

[[package]]
org = "ballerinax"
name = "client.config"
version = "1.0.1"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "oauth2"}
]

[[package]]
org = "ballerinax"
name = "googleapis.drive"
version = "3.3.0"
dependencies = [
{org = "ballerina", name = "file"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "os"},
{org = "ballerina", name = "url"},
{org = "ballerinai", name = "observe"},
{org = "ballerinax", name = "client.config"}
]
modules = [
{org = "ballerinax", packageName = "googleapis.drive", moduleName = "googleapis.drive"}
]

[[package]]
org = "ballerinax"
name = "mysql"
Expand Down
118 changes: 118 additions & 0 deletions api/documents_data.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
public isolated service class DocumentsData {
private UserDocument document_list;

isolated function init(int? id = 0, UserDocument? documentList = null) returns error? {

if (documentList != null) {
self.document_list = documentList.cloneReadOnly();
return;
}
lock {

UserDocument documents_raw;

if (id > 0) {

documents_raw = check db_client->queryRow(
`SELECT *
FROM user_documents
WHERE id = ${id};`);

}else{
return error("No id provided");
}
self.document_list = documents_raw.cloneReadOnly();
}
}

isolated resource function get id() returns int?|error {
lock {
return self.document_list.id;
}
}

isolated resource function get folder_id() returns string?|error {
lock{
return self.document_list.folder_id;
}
}

isolated resource function get nic_front_id() returns string?|error {
lock {
return self.document_list.nic_front_id;
}
}

isolated resource function get nic_back_id() returns string?|error {
lock {
return self.document_list.nic_back_id;
}
}

isolated resource function get birth_certificate_front_id() returns string?|error {
lock {
return self.document_list.birth_certificate_front_id;
}
}

isolated resource function get birth_certificate_back_id() returns string?|error {
lock {
return self.document_list.birth_certificate_back_id;
}
}

isolated resource function get ol_certificate_id() returns string?|error {
lock {
return self.document_list.ol_certificate_id;
}
}

isolated resource function get al_certificate_id() returns string?|error {
lock {
return self.document_list.al_certificate_id;
}
}

isolated resource function get additional_certificate_01_id() returns string?|error {
lock {
return self.document_list.additional_certificate_01_id;
}
}

isolated resource function get additional_certificate_02_id() returns string?|error {
lock {
return self.document_list.additional_certificate_02_id;
}
}

isolated resource function get additional_certificate_03_id() returns string?|error {
lock {
return self.document_list.additional_certificate_03_id;
}
}

isolated resource function get additional_certificate_04_id() returns string?|error {
lock {
return self.document_list.additional_certificate_04_id;
}
}

isolated resource function get additional_certificate_05_id() returns string?|error {
lock {
return self.document_list.additional_certificate_05_id;
}
}

isolated resource function get document_type() returns string?|error {
lock {
return self.document_list.document_type;
}
}

isolated resource function get document() returns string?|error {
lock {
return self.document_list.document;
}
}
}

Loading

0 comments on commit 8003cff

Please sign in to comment.