Changeset bb02e3a
- Timestamp:
- 12/21/25 18:15:59 (9 months ago)
- Branches:
- master
- Children:
- 848c1c5
- Parents:
- aee2b88
- Files:
-
- 3 added
- 3 edited
-
.dockerignore (added)
-
Dockerfile (added)
-
iknow-api/Controllers/UserController.cs (modified) (2 diffs)
-
iknow-api/Program.cs (modified) (2 diffs)
-
iknow-api/appsettings.json (modified) (1 diff)
-
render.yaml (added)
Legend:
- Unmodified
- Added
- Removed
-
iknow-api/Controllers/UserController.cs
raee2b88 rbb02e3a 15 15 _userService = userService; 16 16 } 17 18 // "birthInfo": { 19 // "placeOfBirth": "Скопје", 20 // "municipalityOfBirth": "Скопје", 21 // "country": "Република Северна Македонија" 22 // }, 23 // "previousEducation": { 24 // "type": "Гимназиско образование", 25 // "profession": "", 26 // "average": "54,857", 27 // "language": "Македонски", 28 // "country": "", 29 // "previousUniversity": "Гимназиско образование", 30 // "previousFaculty": "", 31 // "previousStudyMode": "" 32 // }, 33 // "enrollmentInfo": { 34 // "enrollmentYear": "2023", 35 // "status": "Редовен", 36 // "cycle": "Прв циклус", 37 // "program": "Примена на информациски технологии", 38 // "quota": "Кофинансирање-Редовен (2023, 24600)", 39 // "secondaryEducationNumber": "", 40 // "previousEducationCredits": "" 41 // }, 42 // "contact": { 43 // "placeOfResidence": "Скопје", 44 // "municipalityOfResidence": "Кисела Вода - Скопје", 45 // "country": "Република Северна Македонија", 46 // "address": "Драчево", 47 // "temporaryAddress": "", 48 // "phone": "", 49 // "mobilePhone": "075295582", 50 // "passportNumber": "", 51 // "passportExpiryDate": "", 52 // "email": "stefansaveski19@gmail.com", 53 // "microsoftEmail": "stefan.saveski@students.finki.ukim.mk" 54 // } 55 //} 17 56 [Authorize] 18 57 [HttpGet("getUser")] 19 58 public async Task<IActionResult> getUser() 20 59 { 60 //{ 61 // "personalInfo": { 62 // "index": "233149/2023", 63 // "embg": "/////////////", 64 // "lastName": "Савески", 65 // "middleName": "Дејан", 66 // "firstName": "Стефан", 67 // "maidenName": "", 68 // "dateOfBirth": "19.08.2004", 69 // "gender": "машки", 70 // "nationality": "Македонец", 71 // "citizenship": "Република Северна Македонија", 72 // "scholarship": "Користи", 73 // "currentPlan": "2023", 74 // "registryNumber": "", 75 // "notes": "Систематски преглед Студира 3 години", 76 // "studyGroup": "" 77 // }, 21 78 var authHeader = Request.Headers["Authorization"].ToString(); 22 79 if (authHeader.StartsWith("Bearer ")) … … 26 83 var userData = await _userService.GetUserData(token); 27 84 if (userData == null) return Ok(new { info = "can't get info" }); 28 return Ok(new { User = userData }); 85 var personalInfo = new 86 { 87 index = userData.Index ?? "", 88 embg = userData.EMBG ?? "", 89 lastName = userData.Surname ?? "", 90 middleName = userData.MiddleName ?? "", 91 firstName = userData.Name ?? "", 92 maidenName = "", // Property doesn't exist in User model 93 dateOfBirth = userData.Bday.ToString("dd.MM.yyyy"), 94 gender = userData.Gender ?? "", 95 nationality = userData.Nationality ?? "", 96 citizenship = userData.Citizenship ?? "", 97 scholarship = "", 98 currentPlan = userData.EnrollmentInfo?.EnrollmentYear.ToString() ?? "", 99 registryNumber = "", 100 notes = "", 101 studyGroup = "" 102 }; 103 var birthInfo = new 104 { 105 placeOfBirth = userData.ContactInfo?.City ?? "", 106 municipalityOfBirth = userData.ContactInfo?.Municipality ?? "", 107 country = userData.Citizenship ?? "" 108 }; 109 var previousEducation = new 110 { 111 type = userData.HighSchool?.HighSchoolType.ToString() ?? "", 112 profession = "", 113 average = userData.HighSchool?.GPA.ToString() ?? "", 114 language = userData.Nationality ?? "", 115 country = userData.Nationality ?? "", 116 previousUniversity = userData.HighSchool?.HighSchoolType.ToString() ?? "", 117 previousFaculty = "", // Property doesn't exist in HighSchool model 118 previousStudyMode = "" // Property doesn't exist in HighSchool model 119 }; 120 var enrollmentInfo = new 121 { 122 enrollmentYear = userData.EnrollmentInfo?.EnrollmentYear.ToString() ?? "", 123 status = userData.EnrollmentInfo?.StudyStatus ?? "", 124 cycle = "Прв циклус", 125 program = userData.EnrollmentInfo?.Major?.Name ?? "", 126 quota = userData.EnrollmentInfo?.Quota.ToString() ?? "", 127 secondaryEducationNumber = "", 128 previousEducationCredits = "" 129 }; 130 var contact = new 131 { 132 placeOfResidence = userData.ContactInfo?.City ?? "", 133 municipalityOfResidence = userData.ContactInfo?.Municipality ?? "", 134 country = userData.Citizenship ?? "", 135 address = userData.ContactInfo?.Address ?? "", 136 temporaryAddress = "", 137 phone = "", 138 mobilePhone = userData.ContactInfo?.PhoneNumber ?? "", 139 passportNumber = "", 140 passportExpiryDate = "", 141 email = userData.Email ?? "", 142 microsoftEmail = userData.ContactInfo?.MicrosoftEmail ?? "" 143 }; 144 return Ok(new { personalInfo = personalInfo, birthInfo = birthInfo, previousEducation = previousEducation, enrollmentInfo = enrollmentInfo, contact = contact }); 145 //return Ok(new { User = userData }); 29 146 } 30 147 return null; -
iknow-api/Program.cs
raee2b88 rbb02e3a 9 9 10 10 var builder = WebApplication.CreateBuilder(args); 11 12 // Add CORS policy 13 builder.Services.AddCors(options => 14 { 15 options.AddPolicy("AllowFrontend", policy => 16 { 17 var allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get<string[]>() 18 ?? new[] { "http://localhost:3000" }; 19 20 policy.WithOrigins(allowedOrigins) // Your frontend URL(s) 21 .AllowAnyHeader() 22 .AllowAnyMethod() 23 .AllowCredentials(); 24 }); 25 }); 26 11 27 builder.Services.AddAuthentication(options => 12 28 { … … 64 80 } 65 81 82 // Enable CORS - must be called before UseAuthentication and UseAuthorization 83 app.UseCors("AllowFrontend"); 84 66 85 app.UseHttpsRedirection(); 67 86 app.UseAuthentication(); // <-- must come BEFORE UseAuthorization -
iknow-api/appsettings.json
raee2b88 rbb02e3a 6 6 } 7 7 }, 8 "AllowedOrigins": [ 9 "http://localhost:3000" 10 ], 8 11 "ConnectionStrings": { 9 12 "DefaultConnection": "Host=ep-divine-term-aghfotgc-pooler.c-2.eu-central-1.aws.neon.tech; Database=neondb; Username=neondb_owner; Password=npg_SxbBZmtw4I7P; SSL Mode=VerifyFull; Channel Binding=Require;"
Note:
See TracChangeset
for help on using the changeset viewer.
